model.matrix creates a design matrix.# for the use of bayesglm
model.matrix.bayes(object, data = environment(object),
contrasts.arg = NULL, xlev = NULL, keep.order = FALSE, ...)
# for the use of bayesglm.hiearchical (not implement yet!)
model.matrix.bayes2(object, data = environment(object),
contrasts.arg = NULL, xlev = NULL, keep.order = FALSE, batch = NULL, ...)model.frame. If
another sort of object, model.frame is called first.contrasts replacement function and
whose names are the names of columns of data containing
model.frame if
data has no "terms" attribute.FALSE the terms are reordered so
that main effects come first, followed by the interactions,
all second-order, all third-order and so on. Effects of model.matrix.bayes is adapted from model.matrix in the stats
pacakge and is designed for the use of bayesglm and bayesglm.hierachical (not yet implemented!).
It is designed to keep baseline levels of all categorical varaibles and keep the
variable names unodered in the output. The design matrices created by
model.matrix.bayes are unidentifiable using classical regression methods,
though; they can be identified using bayesglm and
bayesglm.hierachical.model.frame, model.extract,
terms, terms.formula, bayesglm.ff <- log(Volume) ~ log(Height) + log(Girth)
str(m <- model.frame(ff, trees))
(model.matrix.bayes(ff, m))
(model.matrix.bayes2(ff, m))
(model.matrix(ff, m))Run the code above in your browser using DataLab