View source: R/coralGetXDataExt.R
coralGetXDataExt | R Documentation |
constructs extended XData
and XFormula
from fitted Hmsc
for consequent CORAL analysis
coralGetXDataExt(m, nf = NULL, varProp = NULL)
m |
fitted |
nf |
upper number of leading latent factors to be used in CORAL analysis per |
varProp |
proportion of explanatory variance for selection of the number of leading latent factors |
This functions finds a point estimate of latent factors from fitted m
Hmsc
-class object
and stacks m$XData
and m$XFormula
with this point estimate.
Such point estimate of latent factors is selected among the posterior MCMC samples of the m
, specifically the one with top explanatory power.
The selected posterior sample is potentially truncated to a smaller number of leading latent factors, based on nf
or varProp
arguments.
Only one of nf
and varProp
can be specified.
Each of these arguments can be provided as vector of length m$nr
or scalar value that is broadcasted to such vector.
By default the nf
is set to infinity, resulting in selection of all estimated latent factors.
For example, if Hmsc
model has XFormula="~X1+X2"
and 2 random levels LF1, LF2
, with 3 and 4 latent factors extracted correspondingly,
then the extended XDataExt="~X1+X2 + LF1.1+LF1.2+LF1.3 + LF2.1+LF2.2+LF2.3+LF2.4}"
A named list of extended XDataExt
dataframe and corresponding extended XFormulaExt
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.