design {tslars} | R Documentation |
Given the lag length and the forecast horizon, the design-function will build the appropriate design matrix, which can then be used in a regression analysis.
design(x = NULL, y, p, h, ary = FALSE)
x |
the matrix of predictors |
y |
the vector of the response |
p |
the lag length |
h |
the forecast horizon |
ary |
logical, in ary=T , the design matrix corresponds to that of an autoregressive model. |
The design-function returns an appropriate matrix that can be used to fit a time series regression model. It includes laggen values of the response y and of all predictors in x up to lag p.
Sarah Gelper
y <- rnorm(100) x <- matrix(rnorm(300),ncol=3) designmatrix <- design(x,y,p=2,h=1,ary=FALSE)