[R-sig-eco] How to get the total variance explained from an envfit object?
Couch, Claire Elizabeth
couchc @end|ng |rom oregon@t@te@edu
Thu Nov 7 21:02:56 CET 2019
I am analyzing some microbiome data by using unconstrained ordination (PCA
or NMDS) followed by environmental vector fitting with the envfit function
in the vegan package. The output of envfit includes an r2 value for each
vector or factor included in the envfit model, but I am interested in the
total amount of variation explained by all the vectors/factors, rather than
just stand-alone variables. I presume I cannot simply add up the R2 values
assigned to each environmental variable, because there may be overlap in
the microbiome variation that is "explained" by each environmental
variable. However, there does not seem to be any way of accessing the total
r2 value for the model.
Using an example dataset, this is what I have tried so far:
library(vegan)
library(MASS)
data(varespec, varechem)
library(MASS)
ord <- metaMDS(varespec)
fit <- envfit(ord, varechem, perm = 999)
fit
This shows r2 for each environmental variable, but how do I extract the r2
value for the entire model?
I have tried running fit$r, attributes(fit)$r, and Rsquare.Adj(fit), but
these all return NULL.
I would greatly appreciate any suggestions!
[[alternative HTML version deleted]]
More information about the R-sig-ecology
mailing list