Learn R Programming

BMS (version 0.3.4)

predict.zlm: Predict Method for zlm Linear Model

Description

Expected value (And standard errors) of predictions based on 'zlm' linear Bayesian model under Zellner's g prior

Usage

## S3 method for class 'zlm':
 ## S3 method for class 'zlm':
predict(object, newdata = NULL, se.fit = FALSE, ...)

Arguments

object
a zlm linear model object - see zlm
newdata
An optional data.frame, matrix or vector containing variables with which to predict. If omitted, then (the expected values of) the fitted values are returned.
se.fit
A switch indicating if the standard deviations for the predicted varaibles are required.
...
further arguments passed to or from other methods.

Value

  • A vector with (expected values of) fitted values. If se.fit is TRUE, then the output is a list with the following elements:
  • fita vector with the expected values of fitted values
  • std.erra vector with the standard deviations of fitted values
  • se.fita vector with the standard errors without the residual scale akin to se.fit in predict.lm
  • residual.scaleThe part from the standard deviations that involves the identity matrix. Note that sqrt(se.fit^2+residual.scale^2) yields std.err.

See Also

bms for creating zlm objects, predict.lm for a comparable function, predict.bma for predicting with bma objects Check http://bms.zeugner.eu for additional help.

Examples

Run this code
data(datafls)
 mm=zlm(datafls,g="EBL")
 
 predict(mm) #fitted values 
 predict(mm, newdata=1:41) #prediction based on a 'new data point' 
 
 #prediction based on a 'new data point', with 'standard errors'
 predict(mm, newdata=datafls[1,], se.fit=TRUE)

Run the code above in your browser using DataLab