Provides linear regression based predictions from a y~x type model
using recursive or rolling regression.
Usage
linpred(y, x, h = 1, wind = NULL, rr = c("Rec"))
Arguments
y
a series to be predicted
x
a numeric or matrix of explanatory variables
h
The horizon for which you would like to have the prediction for
(see details)
wind
the size of the rolling window or the initial training period if
recursive is used
rr
recursive or rolling window? Possible values are
c("Rec","Rol")
Value
vector of prediction values with the same dimension as the original
series. The first wind values are NA's
Details
The training is done using the direct method: $y_{1 : (t+h-1)} = \beta
x_{1:(t-1)} + \varepsilon_{1:(t+h-1)} $ and the forecast is made at time
(t+h) as $\widehat{y}_{t+h} = \widehat{\beta} x_t$.