Compute pairwise residual correlation in occurrence or abundance in a Joint Species Distribution Model (JSDM) with latent variables.
getLVcorrMat
computes the correlation matrix in residual occurrence or abundance in an latent-variable multi-species occupancy or N-mixture model which has been fit using MCMC (eg, in JAGS or WinBUGS). See Tobler et al. (2019) and Kéry & Royle (2021) chapter 8.
getEcorrMat
computes the correlation matrix for the coefficients of the observed environmental covariates.
getLVcorrMat(lv.coef, type=c("occupancy", "Nmix"), stat=mean)getEcorrMat(beta, stat=mean)
The relevant correlation matrix, species x species; if stat = NULL
, an array, iterations x species x species, with the MCMC chains.
MCMC chains for the coefficients of the latent variables, typically from the sims.list
of a model fit; an iterations x species x latent variables array.
MCMC chains for the coefficients of the environment variables (excluding the intercept), typically from the sims.list
of a model fit; an iterations x species x environmental variables array.
Indication of whether the model fit was for occupancy data (with a probit link) or an N-mixture model based on count data.
The function used to summarize the MCMC chains for the correlations; if stat = NULL
. the full array with the MCMC chains is returned
Mathias Tobler.
Tobler, M. et al. (2019) Joint species distribution models with species correlations and imperfect detection. Ecology, 100(8), e02754.
Kéry, M. & Royle, J.A. (2021) Applied Hierarchical Modeling in Ecology AHM2 - 8.4.2 and 8.5.4.