rmse.bvar {BVAR}R Documentation

Model fit in- and out-of-sample

Description

Functions to compute the root mean squared error and log predictive scores.

Usage

## S3 method for class 'bvar'
rmse(x, holdout, ...)

## S3 method for class 'bvar'
lps(x, holdout, n_thin = 1L, ...)

rmse(x, ...)

## Default S3 method:
rmse(x, ...)

lps(x, ...)

## Default S3 method:
lps(x, ...)

Arguments

x

A bvar object, obtained from bvar.

holdout

Optional numeric matrix or dataframe. Used for the out-of-sample fit.

...

Not used.

n_thin

Integer scalar. Every n_thin'th draw in x is used to calculate, others are dropped.

Value

Returns a matrix with measures of model fit.

Examples


# Access a subset of the fred_qd dataset
data <- fred_qd[, c("CPIAUCSL", "UNRATE", "FEDFUNDS")]
# Transform it to be stationary
data <- fred_transform(data, codes = c(5, 5, 1), lag = 4)

# Estimate a BVAR using one lag, default settings and very few draws
x <- bvar(data[seq(1, nrow(data) - 5), ], lags = 1,
  n_draw = 600L, n_burn = 100L, verbose = FALSE)

# Compute RMSE
rmse(x)
lps(x, holdout = data[seq(nrow(data) - 4, nrow(data)), ])


[Package BVAR version 1.0.5 Index]