Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

which.matrix

Coerce a BAS list object of models into a matrix.


Description

This function coerces the list object of models to a matrix and fill in the zeros to facilitate other computations.

Usage

which.matrix(which, n.vars)

Arguments

which

a 'bas' model object x$which

n.vars

the total number of predictors, x$n.vars

Details

which.matrix coerces x$which into a matrix.

Value

a matrix representation of x$which, with number of rows equal to the length of which.models or total number of models and number of columns x$n.vars

Author(s)

Merlise Clyde clyde@duke.edu

See Also

Other as.matrix methods: list2matrix.bas(), list2matrix.which()

Examples

data(Hald)
Hald.bic <-  bas.lm(Y ~ ., data=Hald, prior="BIC", initprobs="eplogp")
# matrix of model indicators
models <- which.matrix(Hald.bic$which, Hald.bic$n.vars)

BAS

Bayesian Variable Selection and Model Averaging using Bayesian Adaptive Sampling

v1.5.5
GPL (>= 3)
Authors
Merlise Clyde [aut, cre, cph] (ORCID=0000-0002-3595-1872), Michael Littman [ctb], Quanli Wang [ctb], Joyee Ghosh [ctb], Yingbo Li [ctb], Don van de Bergh [ctb]
Initial release
2020-1-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.