View source: R/computeVariancePartitioning.R
computeVariancePartitioning | R Documentation |
Computes variance components with respect to given grouping of fixed effects and levels of random effects
computeVariancePartitioning( hM, group = NULL, groupnames = NULL, start = 1, na.ignore = FALSE )
hM |
a fitted |
group |
vector of numeric values corresponding to group
identifiers in groupnames. If the model was defined with
|
groupnames |
vector of names for each group of fixed
effect. Should match |
start |
index of first MCMC sample included |
na.ignore |
logical. If TRUE, covariates are ignored for sites where the focal species is NA when computing variance-covariance matrices for each species |
The vector group
has one value for each column of the matrix hM$X
, describing the index of the
group in which this column is to be included. The names of the group are given by groupnames
. The output object
VP$vals
gives the variance proportion for each group and species. The output object VP$R2T
gives the
variance among species explained by traits, measured for species' responses to covariates (VP$R2T$Beta
) and species occurrences
(VP$R2T$Y
)
returns an object VP with components VP$vals, VP$R2T, VP$group and VP$groupnames.
Use plotVariancePartitioning
to display the result object.
# Partition the explained variance for a previously fitted model # without grouping environmental covariates VP = computeVariancePartitioning(TD$m) # Partition the explained variance for a previously fitted model # while grouping the two environmental variables together VP = computeVariancePartitioning(TD$m, group=c(1,1), groupnames = c("Habitat"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.