predict.bas | R Documentation |
Predictions under model averaging or other estimators from a BMA object of class inheriting from 'bas'.
## S3 method for class 'bas'
predict(
object,
newdata,
se.fit = FALSE,
type = "link",
top = NULL,
estimator = "BMA",
na.action = na.pass,
...
)
object |
An object of class BAS, created by |
newdata |
dataframe for predictions. If missing, then use the dataframe used for fitting for obtaining fitted and predicted values. |
se.fit |
indicator for whether to compute se of fitted and predicted values |
type |
Type of predictions required. "link" which is on the scale of the linear predictor is the only option currently for linear models, which for the normal model is equivalent to type='response'. |
top |
a scalar integer M. If supplied, subset the top M models, based on posterior probabilities for model predictions and BMA. |
estimator |
estimator used for predictions. Currently supported
options include: |
na.action |
function determining what should be done with missing values in newdata. The default is to predict NA. |
... |
optional extra arguments |
Use BMA and/or model selection to form predictions using the top highest probability models.
a list of
fit |
fitted values based on the selected estimator |
Ybma |
predictions using BMA, the same as fit for non-BMA methods for compatibility; will be deprecated |
Ypred |
matrix of predictions under each model for BMA |
se.fit |
se of fitted values; in the case of BMA this will be a matrix |
se.pred |
se for predicted values; in the case of BMA this will be a matrix |
se.bma.fit |
vector of posterior sd under BMA for posterior mean of the regression function. This will be NULL if estimator is not 'BMA' |
se.bma.pred |
vector of posterior sd under BMA for posterior predictive values. this will be NULL if estimator is not 'BMA' |
best |
index of top models included |
bestmodels |
subset of bestmodels used for fitting or prediction |
best.vars |
names of variables in the top model; NULL if estimator='BMA' |
df |
scalar or vector of degrees of freedom for models |
estimator |
estimator upon which 'fit' is based. |
Merlise Clyde
bas
, fitted.bas
,
confint.pred.bas
, variable.names.pred.bas
Other predict methods:
fitted.bas()
,
predict.basglm()
,
variable.names.pred.bas()
Other bas methods:
BAS
,
bas.lm()
,
coef.bas()
,
confint.coef.bas()
,
confint.pred.bas()
,
diagnostics()
,
fitted.bas()
,
force.heredity.bas()
,
image.bas()
,
plot.confint.bas()
,
predict.basglm()
,
summary.bas()
,
update.bas()
,
variable.names.pred.bas()
data("Hald")
hald.gprior = bas.lm(Y ~ ., data=Hald, alpha=13, prior="g-prior")
predict(hald.gprior, newdata=Hald, estimator="BPM", se.fit=TRUE)
# same as fitted
fitted(hald.gprior,estimator="BPM")
# default is BMA and estimation of mean vector
hald.bma = predict(hald.gprior, top=5, se.fit=TRUE)
confint(hald.bma)
hald.bpm = predict(hald.gprior, newdata=Hald[1,],
se.fit=TRUE,
estimator="BPM")
confint(hald.bpm)
# extract variables
variable.names(hald.bpm)
hald.hpm = predict(hald.gprior, newdata=Hald[1,],
se.fit=TRUE,
estimator="HPM")
confint(hald.hpm)
variable.names(hald.hpm)
hald.mpm = predict(hald.gprior, newdata=Hald[1,],
se.fit=TRUE,
estimator="MPM")
confint(hald.mpm)
variable.names(hald.mpm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.