autoreg_matrix
Given a time series (vector) Y, return a matrix with ones in the first column and the first K lagged values of Y in the other columns.
Calling Sequence
autoreg_matrix(Y, K)
Parameters
Y:
Vector
K:
Scalar or Vector
Description
Given a time series (vector) Y, return a matrix with ones in the first column and the first K lagged values of Y in the other columns.
In other words, for T > K, '[1, Y(T-1), ..., Y(T-K)]' is the t-th row of the result.
The resulting matrix may be used as a regressor matrix in autoregressions.
Examples