linpred: linpred

Description Usage Arguments Details Value Examples

Description

Provides linear regression based predictions from a y~x type model using recursive or rolling regression.

Usage

1
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")

Details

The training is done using the direct method: y_{1 : (t+h-1)} = β x_{1:(t-1)} + \varepsilon_{1:(t+h-1)} and the forecast is made at time (t+h) as \widehat{y}_{t+h} = \widehat{β} x_t.

Value

vector of prediction values with the same dimension as the original series. The first wind values are NA's

Examples

1
2
3
4
5
6
7
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)

Eplot documentation built on May 2, 2019, 2:42 a.m.