Learn R Programming

BMS (version 0.3.4)

plot.pred.density: Predictive Densities for bma Objects

Description

Plots predictive densities for conditional forecasts of class 'pred.density'

Usage

## S3 method for class 'pred.density': "plot"(x, predict_index = NULL, addons = "eslz", realized.y = NULL, addons.lwd = 1.5, ...)

Arguments

x
an object of class pred.density
predict_index
An integer vector detailing which forecasted observations (corresponding to the argument newdata in pred.density) should be plotted. Or the observation names to be plotted (as in rownames(newdata)).
addons
character, defaulting to "eslz". Specifies which additional information should be added to the plot via low-level commands (see 'Details' below).
realized.y
A vector with realized values of the dependent variables to be plotted in addition to the predictive density, must have its length conforming to predict_index (or newdata)
addons.lwd
Line width to be used for the low-level plotting commands specified by addons. Cf. argument lwd in par.
...
arguments to be passed on to plot.density.

Details

The argument addons specifies what additional information should be added to the plot(s) via the low-level commands lines and legend: "e" for the posterior expected value (EV) of the prediction, "s" for 2 times its posterior standard deviation ('standard errors'), "z" for a zero line, "l" for including a legend Any combination of these letters will give the desired result. Use addons="" for not using any of these.

See Also

pred.density for constructing predictive densities, bms for creating bma objects, density.bma for plotting coefficient densities

Check http://bms.zeugner.eu for additional help.

Examples

Run this code
 data(datafls)
 mm=bms(datafls,user.int=FALSE)
 
 #predictive density for two 'new' data points
 pd=pred.density(mm,newdata=datafls[1:2,]) 
 
 
 #plot the density for the second forecast observation
 plot(pd,2)  
 
 #plot the density with realized dep. variable, and no standard errors
 plot(pd, 1, realized.y=0,addons="lzeg") 
 
 
 

Run the code above in your browser using DataLab