View source: R/get_enviro_cor.R
get_enviro_cor | R Documentation |
Calculates the correlation between columns of the response matrix, due to similarities in the response to explanatory variables i.e., shared environmental response.
get_enviro_cor(mod, type = "mean", prob = 0.95)
mod |
An object of class |
type |
A choice of either the posterior median ( |
prob |
A numeric scalar in the interval |
In both independent response and correlated response models, where each of the columns of the response matrix Y
are fitted to a set of explanatory variables given by X
,
the covariance between two columns j
and j'
, due to similarities in their response to the model matrix, is thus calculated based on the linear predictors X \beta_j
and X \beta_j'
, where \beta_j
are species effects relating to the explanatory variables.
Such correlation matrices are discussed and found in Ovaskainen et al., (2010), Pollock et al., (2014).
results, a list including :
cor, cor.lower, cor.upper |
A set of |
cor.sig |
A |
cov |
Average over the MCMC samples of the |
Ghislain Vieilledent <ghislain.vieilledent@cirad.fr>
Jeanne Clément <jeanne.clement16@laposte.net>
Hui FKC (2016). “boral: Bayesian Ordination and Regression Analysis of Multivariate Abundance Data in R.” Methods in Ecology and Evolution, 7, 744–750.
Ovaskainen et al. (2010). Modeling species co-occurrence by multivariate logistic regression generates new hypotheses on fungal interactions. Ecology, 91, 2514-2521.
Pollock et al. (2014). Understanding co-occurrence by modelling species simultaneously with a Joint Species Distribution Model (JSDM). Methods in Ecology and Evolution, 5, 397-406.
cov2cor
get_residual_cor
jSDM-package
jSDM_binomial_probit
jSDM_binomial_logit
jSDM_poisson_log
library(jSDM)
# frogs data
data(frogs, package="jSDM")
# Arranging data
PA_frogs <- frogs[,4:12]
# Normalized continuous variables
Env_frogs <- cbind(scale(frogs[,1]),frogs[,2],
scale(frogs[,3]))
colnames(Env_frogs) <- colnames(frogs[,1:3])
Env_frogs <- as.data.frame(Env_frogs)
# Parameter inference
# Increase the number of iterations to reach MCMC convergence
mod <- jSDM_binomial_probit(# Response variable
presence_data=PA_frogs,
# Explanatory variables
site_formula = ~.,
site_data = Env_frogs,
n_latent=0,
site_effect="random",
# Chains
burnin=100,
mcmc=100,
thin=1,
# Starting values
alpha_start=0,
beta_start=0,
V_alpha=1,
# Priors
shape=0.5, rate=0.0005,
mu_beta=0, V_beta=10,
# Various
seed=1234, verbose=1)
# Calcul of residual correlation between species
enviro.cors <- get_enviro_cor(mod)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.