residual_cor.jsdgam | R Documentation |
Compute residual correlation estimates from Joint Species Distribution
(jsdgam
) or mvgam
models that either used latent factors
or included correlated process errors directly
residual_cor(object, ...)
## S3 method for class 'mvgam'
residual_cor(
object,
summary = TRUE,
robust = FALSE,
probs = c(0.025, 0.975),
...
)
## S3 method for class 'jsdgam'
residual_cor(
object,
summary = TRUE,
robust = FALSE,
probs = c(0.025, 0.975),
...
)
object |
|
... |
ignored |
summary |
Should summary statistics be returned
instead of the raw values? Default is |
robust |
If |
probs |
The percentiles to be computed by the |
See mvgam_residcor-class
for a full description of the quantities that are
computed and returned by this function, along with key references.
If summary = TRUE
, a list
of mvgam_residcor-class
with the following components:
cor , cor_lower , cor_upper |
A set of |
sig_cor |
A |
prec , prec_lower , prec_upper |
A set of |
sig_prec |
A |
cov |
A |
trace |
The median/mean point estimator of the trace (sum of the diagonal elements)
of the residual covariance matrix |
If summary = FALSE
, this function returns a list
containing the following components:
all_cormat |
A |
all_covmat |
A |
all_presmat |
A |
all_trace |
A |
jsdgam()
, lv_correlations()
, mvgam_residcor-class
# Fit a JSDGAM to the portal_data captures
mod <- jsdgam(
formula = captures ~
# Fixed effects of NDVI and mintemp, row effect as a GP of time
ndvi_ma12:series + mintemp:series + gp(time, k = 15),
factor_formula = ~ -1,
data = portal_data,
unit = time,
species = series,
family = poisson(),
n_lv = 2,
silent = 2,
chains = 2
)
# Plot residual correlations
plot(
residual_cor(mod)
)
# Compare to a residual ordination biplot
if(requireNamespace('ggrepel', quietly = TRUE)){
ordinate(mod)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.