design {tslars}R Documentation

Function to create a design matrix.

Description

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.

Usage

design(x = NULL, y, p, h, ary = FALSE)

Arguments

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.

Value

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.

Author(s)

Sarah Gelper

Examples


y <- rnorm(100)
x <- matrix(rnorm(300),ncol=3)
designmatrix <- design(x,y,p=2,h=1,ary=FALSE)


[Package tslars version 1.0 Index]