Skip to contents

Computes 6 models: linear regression, piecewise regression (with linear regression and local regression), local regression (with tvLM), piecewise regression with some fixed coefficients and tvlm with fixed coefficients. Computes 6 rmse on their residuals and 6 others on the residuals of the predictions of these models.

Usage

rmse_prev(x, data, fixed_var = NULL, fixed_bw = FALSE, ...)

# S3 method for class 'formula'
rmse_prev(x, data, fixed_var = NULL, fixed_bw = FALSE, ...)

# S3 method for class 'lm'
rmse_prev(x, data, fixed_var = NULL, fixed_bw = FALSE, ...)

Arguments

x

an object of class formula or lm, that is the description of the model to be fitted, or the model itself.

data

a ts object containing the variables in the model. Necessary only when x is a formula.

fixed_var

which variables of the model should have their coefficients fixed for the models with fixed coefficients. Obtained thanks to the hansen test.

fixed_bw

logical, by default set to FALSE. Indicates if the bandwidth has to be computed again in the forecast model, or if it takes the value of the bandwidth of the tvlm model.

...

additional arguments

Value

Returns an object of class prev which is a list containing the following elements:

model

a list of the 6 explanatory models

forecast

a list of the 6 predictions of the 6 previous models

rmse

a list of the 2 computed rmse, in sample and out of sample

Details

In additional arguments, parameters as date and period can be informed. As in oos_prev they are by default respectively set to 28 and 1.

To estimate forecast models, the function oos_prev is used.

For the forecasts of the two models with fixed coefficients, fixed coefficients are re-estimated at each date, before bp_lm or tvLM are run on moving variables.