lps.bma {BMS} | R Documentation |
Computes the Log Predictive Score to evaluate a forecast based on a bma object
lps.bma(object, realized.y, newdata = NULL)
object |
an object of class |
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 |
Needs to be provided if |
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
.
A scalar denoting the log predictive score
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.
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])