| mlWAIC | R Documentation |
Computes the widely applicable information criterion (WAIC) for multivariate logistic regression models. Serves as a wrapper for mlreg, mlpredict, djsdm, and waic for convenient WAIC calculations. Installation of the rstan package is required to use this function.
mlWAIC(
Y,
X,
multivariate = TRUE,
method = 2,
priors = c(B.mu = 0, B.sd = 1, lkj = 1),
iter = 20000,
thin = 20,
control = list(adapt_delta = 0.99, max_treedepth = 20, stepsize = 0.01),
...
)
Y |
Numeric response matrix. Each record represents an observation, and each field represents a response dimension. Matrix cells contain binary values (i.e., |
X |
Numeric predictor matrix. Each record represents an observation, and each field represents a predictor variable. Matrix cells contain predictor values. |
multivariate |
Logical scalar. If |
method |
Numeric scalar. Options are |
priors |
Named numeric vector. Elements represent the prior values of their respective named parameters. When predictors are centered and scaled, the defaults generally represent weakly informative priors. Regression coefficients ( |
iter |
Numeric scalar. Integer value specifying the number of iterations for each chain (including warmup). The default is |
thin |
Numeric scalar. Integer value specifying the thinning interval. The default is |
control |
Named list of parameters which control the behavior of the Stan sampler. Passed to the |
... |
Additional arguments passed to the |
For convenience, wraps the steps involved in WAIC calculations for Bayesian multivariate logistic regression models. Begins by fitting a Bayesian multivariate logistic regression model with the mlreg function, then generates resubstitution posterior predictions using the mlpredict function. The pointwise log-likelihood is calculated with the djsdm function given the response matrix and posterior predictions. WAIC is calculated from the pointwise log-likelihood using the waic function. Because djsdm does not consider residual correlations in density calculations, species interactions do not contribute to WAIC (i.e., response dimensions are independent).
Returns numeric scalar of the widely applicable information criterion.
Carpenter B, Gelman A, Hoffman MD, Lee D, Goodrich B, Betancourt M, Brubaker M, Guo J, Li P, and Riddell A. 2017. Stan: A probabilistic programming language. Journal of Statistical Software, 76: 1-32. DOI: 10.18637/jss.v076.i01
Gelman A, Hwang J, and Vehtari A. 2014. Understanding predictive information criteria for Bayesian models. Statistics and Computing, 24(6): 997-1016. DOI: 10.1007/s11222-013-9416-2
O'Brien SM, and Dunson DB. 2004. Bayesian multivariate logistic regression. Biometrics, 60: 739-746. DOI: 10.1111/j.0006-341X.2004.00224.x
Ovaskainen O, Hottola J, and Siitonen J. 2010. Modeling species co-occurrence by multivariate logistic regression generates new hypotheses on fungal interactions. Ecology, 91(9): 2514-2521. DOI: 10.1890/10-0173.1
Watanabe S. 2010. Asymptotic equivalence of Bayes cross validation and widely applicable information criterion in singular learning theory. Journal of Machine Learning Research, 11(116): 3571-3594.
mlreg for fitting multivariate logistic regression models.
mlpredict for generating predictions from multivariate logistic regression models.
djsdm for probability mass function of a joint species distribution model.
waic for generic function to compute widely applicable information criterion.
# Define example data file path.
path<-system.file("extdata",
"example_mvlogistic_data.rds",
package="LocaTT",
mustWork=TRUE)
# Read in example regression data.
data<-readRDS(file=path)
# Compute WAIC for multivariate logistic regression.
out<-mlWAIC(Y=data$Y,X=data$X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.