| devpart {BayesComm} | R Documentation |
Deviance partitioning
Description
Runs a deviance partitioning procedure on a set of four bayescomm objects.
Usage
devpart(null, environment, community, full)
Arguments
null |
a |
environment |
a |
community |
a |
full |
a |
Details
The deviance partitioning procedure determines the proportion of the null deviance explained by each of the other three model types.
The four model types are those created by BC.
Value
A list containing elements
devpart |
matrix containing the proportion of the null deviance explained by each model for each species |
null |
a matrix containing the mean and 95% credible intervals for the deviance for each species in the null model |
environment |
a matrix containing the mean and 95% credible intervals for the deviance for each species in the evironment model |
community |
a matrix containing the mean and 95% credible intervals for the deviance for each species in the community model |
full |
a matrix containing the mean and 95% credible intervals for the deviance for each species in the full model |
See Also
Examples
# create fake data
n <- 100
nsp <- 4
k <- 3
X <- matrix(c(rep(1, n), rnorm(n * k)), n) # covariate matrix
W <- matrix(rnorm(nsp * nsp), nsp)
W <- W %*% t(W) / 2 # true covariance matrix
B <- matrix(rnorm(nsp * (k + 1), 0, 3), nsp) # true covariates
mu <- apply(B, 1, function(b, x) x %*% b, X) # true mean
e <- matrix(rnorm(n * nsp), n) %*% chol(W) # true e
z <- mu + e # true z
Y <- ifelse(z > 0, 1, 0) # true presence/absence
# run BC (after removing intercept column from design matrix)
null <- BC(Y, X[, -1], model = "null", its = 100)
comm <- BC(Y, X[, -1], model = "community",its = 100)
envi <- BC(Y, X[, -1], model = "environment", its = 100)
full <- BC(Y, X[, -1], model = "full", its = 100)
devpart(null, envi, comm, full)