linpred {Eplot} | R Documentation |
Provides linear regression based predictions from a y~x
type model
using recursive or rolling regression.
linpred(y, x, h = 1, wind = NULL, rr = c("Rec"))
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
|
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
.
vector of prediction values with the same dimension as the original
series. The first wind
values are NA's
x = rnorm(100)
lx <- lagmat(x,2)
tail(lx)
tail(x)
out <- linpred(x,lx)
plott(x, return.to.default=FALSE)
plott(out,add=TRUE,col=2)