rmse.bvar | R Documentation |
Functions to compute the root mean squared error and log predictive scores.
## 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, ...)
x |
A |
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. |
Returns a matrix with measures of model fit.
# 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)), ])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.