Description Usage Arguments Details Value See Also Examples
Runs a deviance partitioning procedure on a set of four bayescomm
objects.
1 | devpart(null, environment, community, full)
|
null |
a |
environment |
a |
community |
a |
full |
a |
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
.
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 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 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)
|
$devpart
env com full total
sp1 0.5656081 0.01829010 0.5442947 1
sp2 0.4722921 0.03302527 0.5550907 1
sp3 0.5384847 0.01865383 0.5300307 1
sp4 0.5409303 0.05344746 0.5952947 1
$null
sp1 sp2 sp3 sp4
Mean 59.72335 36.55178 35.89692 49.25254
25% 56.45592 32.78801 31.92609 46.98274
97.5% 68.29313 47.48585 44.54037 56.46274
$environment
sp1 sp2 sp3 sp4
Mean 25.94334 19.28866 16.56698 22.61035
25% 21.08225 14.98754 10.44144 18.30549
97.5% 48.68486 35.60690 35.93843 40.87600
$community
sp1 sp2 sp3 sp4
Mean 58.63101 35.34465 35.22730 46.62012
25% 55.45385 32.50487 32.26385 43.55613
97.5% 66.40259 43.42552 48.57801 54.71969
$full
sp1 sp2 sp3 sp4
Mean 27.21625 16.26223 16.87045 19.93277
25% 21.69271 13.37547 13.01667 14.32622
97.5% 44.03784 28.18769 31.47239 36.16930
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.