Learn R Programming

BMS (version 0.3.4)

lps.bma: Log Predictive Score

Description

Computes the Log Predictive Score to evaluate a forecast based on a bma object

Usage

lps.bma(object, realized.y, newdata = NULL)

Arguments

object
an object of class pred.density, or class bma (cf. bms), or class zlm
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 newdata
newdata
Needs to be provided if object is not of class pred.density: a data.frame, matrix or vector containing variables with which to predict.

Value

A scalar denoting the log predictive score

Details

The log predictive score is an indicator for the likelihood of several forecasts. It is defined as minus the arithmethic mean of the logarithms of the point densities for realized.y given newdata. Note that in most cases is more efficient to first compute the predictive density object via a call to pred.density and only then pass the result on to lps.bma.

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,nmodel=100)
 
 #LPS for actual values under the used data (static forecast)
 lps.bma(mm, realized.y=datafls[,1] , newdata=datafls[,-1])
 
 #the same result via predicitve.density
 pd=pred.density(mm, newdata=datafls[,-1])
 lps.bma(pd,realized.y=datafls[,1])
 
 # similarly for a linear model (not BMA)
 zz = zlm(datafls)
 lps.bma(zz, realized.y=datafls[,1] , newdata=datafls[,-1])
 

Run the code above in your browser using DataLab