plot.bayescomm: Plot bayescomm parameter chains

Description Usage Arguments Details See Also Examples

Description

plot.bayescomm creates summary plots of a subset of the parameter chains in a bayescomm object using the coda package.

Usage

1
2
## S3 method for class 'bayescomm'
plot(x, chain, ...)

Arguments

x

a bayescomm object

chain

a character string of the parameter chains to plot

...

further arguments to pass to plot.mcmc

Details

chain should be one of 'R' (for correlation coefficients) or 'B$sp' where sp is the species of interest (for regression coefficients).

See Also

BC, plot.mcmc

Examples

1
2
3
m1 <- example(BC)[[1]]
plot(m1, 'R')
plot(m1, 'B$sp1')

Example output

BC> # create fake data
BC> n <- 100

BC> nsp <- 4

BC> k <- 3

BC> X <- matrix(c(rep(1, n), rnorm(n * k)), n)  # covariate matrix

BC> W <- matrix(rnorm(nsp * nsp), nsp)

BC> W <- W %*% t(W) / 2  # true covariance matrix

BC> B <- matrix(rnorm(nsp * (k + 1), 0, 3), nsp)  # true covariates

BC> mu <- apply(B, 1, function(b, x) x %*% b, X)  # true mean

BC> e <- matrix(rnorm(n * nsp), n) %*% chol(W)  # true e

BC> z <- mu + e  # true z

BC> Y <- ifelse(z > 0, 1, 0)  # true presence/absence

BC> # run BC (after removing intercept column from design matrix)
BC> m1 <- BC(Y, X[, -1], model = "full", its = 100)

BayesComm documentation built on May 2, 2019, 1:43 p.m.