Function Reference
— Function File: autoreg_matrix (y, k)

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. I.e., 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.