as.zlm {BMS} | R Documentation |
Extract a Model from a bma Object
Description
Extracts a model out of a bma
object's saved models and converts it
to a zlm
linear model
Usage
as.zlm(bmao, model = 1)
Arguments
bmao |
A |
model |
The model index, in one of the following forms: |
Details
A bma object stores several 'best' models it encounters (cf. argument
nmodel
in bms
). as.zlm
extracts a single model
and converts it to an object of class zlm
, which represents a
linear model estimated under Zellner's g prior.
The utility
model.frame
allows to transfrom a zlm
model into an OLS
model of class lm
.
Value
a list of class zlm
Author(s)
Stefan Zeugner
See Also
bms
for creating bma
objects,
zlm
for creating zlm
objects,
pmp.bma
for displaying the
topmodels in a bma
object
Check http://bms.zeugner.eu for additional help.
Examples
data(datafls)
mm=bms(datafls[,1:6],mcmc="enumeration") # do a small BMA chain
topmodels.bma(mm)[,1:5] #display the best 5 models
m2a=as.zlm(mm,4) #extract the fourth best model
summary(m2a)
# Bayesian Model Selection:
# transform the best model into an OLS model:
lm(model.frame(as.zlm(mm)))
# extract the model only containing the 5th regressor
m2b=as.zlm(mm,c(0,0,0,0,1))
# extract the model only containing the 5th regressor in hexcode
print(bin2hex(c(0,0,0,0,1)))
m2c=as.zlm(mm,"01")