<< aryule | FOSSEE_Signal_Processing_Toolbox | barthannwin >>

FOSSEE_Signal_Processing_Toolbox >> FOSSEE_Signal_Processing_Toolbox > autoreg_matrix

# autoreg_matrix

Generate a regressor matrix for autoregressions from a time series.

### Syntax

    x = autoreg_matrix(y, k)

### Parameters

y:

  Vector. Input time series.

k:

  Scalar. Number of lagged values to include.

### Description

Given a time series (vector) `y`, this function returns a matrix with ones in the first column and the first `k` lagged values of `y` in the other columns. For T > k, `[1, y(T-1), ..., y(T-k)]` is the t-th row of the result. The resulting matrix can be used as a regressor matrix in autoregressions.

### Examples

    autoreg_matrix([1, 2, 3], 2)

Report an issue
<< aryule | FOSSEE_Signal_Processing_Toolbox | barthannwin >>