JenniNiku / gllvm

Generalized Linear Latent Variable Models
https://jenniniku.github.io/gllvm/
48 stars 19 forks source link

anova.gllvm nested models and coefplot species coefficients #90

Closed mike-kratz closed 1 year ago

mike-kratz commented 1 year ago

Hi there!

In addition to a Procrustes correlation + test between my unconstrained and concurrent ordinations, I would also like to implement a likelihood-ratio test to compare the two (the more evidence the merrier!). Would an unconstrained ordination be considered nested within a concurrent ordination if all setting remained the same (i.e. same row.effect, family, offset, etc.)? I know this is necessary for the resulting p-value to have any meaning.

Also as a separate question, is there any way to extract the taxa coefficient for environmental variables that are used in the coefplot function? I am working with microbial data and it is not possibly to manually view which taxa had the strongest and weakest responses from the plot since there are too many taxa on the y-axis.

Thank you,

Mike Kratz Coefficient Plot

BertvanderVeen commented 1 year ago

Thanks for another excellent question, Mike. Unconstrained and concurrent ordination are nested, constrained and concurrent ordination are nested, unconstrained and constrained ordination are not nested. So it should be fine to compare your unconstrained and concurrent ordinations with a likelihood ratio test!

You can extract the taxa coefficients as: model$params$LvXcoef%*%t(model$params$theta) and their standard errors with t(gllvm:::RRse(model)).

mike-kratz commented 1 year ago

@BertvanderVeen Great, thank you for your quick response and code! I appreciate all the help you've provided me and hopefully others will benefit from seeing these posts!

Have a great rest of your week,

Mike Kratz