BCfit: Fit a BayesComm model

Description Usage Arguments Details Value See Also

View source: R/BCfit.R

Description

BCfit is the workhorse function for the BayesComm model. It is highly recommended to use the wrapper function BC which checks inputs and sets up different model types and initial values. BCfit arguments can be accessed through BC using the ... argument.

Usage

1
2
BCfit(y, X, covlist, R, z, mu, updateR, iters, thin = 1, burn = 0,
	priW = c(nrow(z) + 2 * ncol(z), 2 * ncol(z)), verbose = 0)

Arguments

y

matrix of species presence/absence data

X

matrix of environmental covariates

covlist

optional list of which covariates to assign to each species

R

initial values for correlation matrix

z

initial values for z

mu

initial values for mu

updateR

logical; if true the correlation matrix is updated, if false it is fixed at R

iters

total number of iterations

thin

amount to thin the posterior chains. Defaults to 1 (no thinning)

burn

number of iterations to discard at the beginning of the chain

priW

prior specification for correlation matrix W

verbose

how often to print updates to the console. 0 for no updates. 1 for updates every thin iterations after burnin. 2 for updates every iteration.

Details

priW specifies the inverse Wishart prior on the unknown and unidentifiable covariance matrix W from which the correlation matrix R is derived. priW is a vector of length two, the first element specifies the degrees of freedom, the second element is multiplied by an identity matrix to form the scale matrix. The default for priW is c(n + 2p, 2p), where n is the number of records and p is the number of species in the community; this therefore forms the prior: iW(n + 2p, 2pI). This prior was determined to exert minimal influence on the posterior of R whilst limiting dependence of R on the unidentifiable variance parameters of W.

For further details on how to specify Y, X and covlist see BC.

Value

A list containing elements:

R

samples from posteriors of the correlation matrix

B

samples from posteriors of regression coefficients (a list of matrices)

z

samples from posteriors of latent variables z

See Also

BC


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