coralGetXDataExt: coralGetXDataExt

View source: R/coralGetXDataExt.R

coralGetXDataExtR Documentation

coralGetXDataExt

Description

constructs extended XData and XFormula from fitted Hmsc for consequent CORAL analysis

Usage

coralGetXDataExt(m, nf = NULL, varProp = NULL)

Arguments

m

fitted Hmsc-class object

nf

upper number of leading latent factors to be used in CORAL analysis per HmscRandomLevel

varProp

proportion of explanatory variance for selection of the number of leading latent factors

Details

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}"

Value

A named list of extended XDataExt dataframe and corresponding extended XFormulaExt


hmsc-r/HMSC documentation built on March 5, 2025, 10:52 p.m.