rmse: Root mean squared error of a Monte Carlo / MCMC sample of...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Computes the root mean squared error (RMSE) of a Monte Carlo sample of forecasts.

Usage

1
rmse(m1, m2)

Arguments

m1

Forecast sample for model 1

m2

Forecast sample for model 2

Details

User needs to subset the forecasts if necessary.

Value

Forecast RMSE.

Author(s)

Patrick T. Brandt

See Also

mae, forecast

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(IsraelPalestineConflict)
Y.sample1 <- window(IsraelPalestineConflict, end=c(2002, 52))
Y.sample2 <- window(IsraelPalestineConflict, start=c(2003,1))

# Fit a BVAR model
fit.bvar <- szbvar(Y.sample1, p=6, lambda0=0.6, lambda1=0.1, lambda3=2,
                   lambda4=0.25, lambda5=0, mu5=0, mu6=0, prior=0)

# Forecast -- this gives back the sample PLUS the forecasts!

forecasts <- forecast(fit.bvar, nsteps=nrow(Y.sample2))

# Compare forecasts to real data
rmse(forecasts[(nrow(Y.sample1)+1):nrow(forecasts),], Y.sample2)

MSBVAR documentation built on May 30, 2017, 1:23 a.m.

Related to rmse in MSBVAR...