Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Define the lag operator *L* such that *L ^{i}y_{t}* =

$$A(L)=({A}_{0}+{A}_{1}{L}^{1}+\dots +{A}_{m}{L}^{m}).$$

To specify a coefficient lag operator polynomial in Econometrics
Toolbox™,
use `LagOp`

. Specify the (nonzero) coefficients *A*_{0},...,*A _{m}* as
a cell array, and the lags of the nonzero coefficients as a vector.

The coefficients of lag operator polynomial objects are designed
to look and feel like traditional MATLAB^{®} cell arrays. There is,
however, an important difference: elements of cell arrays are accessible
by positive integer sequential indexing, i.e., 1, 2, 3,.... The coefficients
of lag operator polynomial objects are accessible by lag-based indexing.
That is, you can specify any nonnegative integer lags, including lag
0.

For example, consider specifying the polynomial $$A(L)=(1-0.3L+0.6{L}^{4}).$$ This polynomial has coefficient 1 at lag 0, coefficient –0.3 at lag 1, and coefficient 0.6 at lag 4. Enter:

`A = LagOp({1,-0.3,0.6},'Lags',[0,1,4])`

A = 1-D Lag Operator Polynomial: ----------------------------- Coefficients: [1 -0.3 0.6] Lags: [0 1 4] Degree: 4 Dimension: 1

The created lag operator object `A`

corresponds
to a lag operator polynomial of degree 4. A `LagOp`

object
has a number of properties describing it:

`Coefficients`

, a cell array of coefficients.`Lags`

, a vector indicating the lags of nonzero coefficients.`Degree`

, the degree of the polynomial.`Dimension`

, the dimension of the polynomial (relevant for multivariate time series).

To access properties of the model, use dot notation. That is,
enter the variable name and then the property name, separated by a
period. To access specific coefficients, use dot notation along with
cell array syntax (consistent with the `Coefficients`

data
type).

To illustrate, returns the coefficient at lag 4:

A.Coefficients{4}

ans = 0.6000

Return the coefficient at lag 0:

A.Coefficients{0}

ans = 1

This last command illustrates lag indexing. The index 0 is valid, and corresponds to the lag 0 coefficient.

Notice what happens if you index a lag larger than the degree of the polynomial:

A.Coefficients{6}

ans = 0

This does not return an error. Rather, it returns `O`

,
the coefficient at lag 6 (and all other lags with coefficient zero).

Use similar syntax to add new nonzero coefficients. For example, to add the coefficient 0.4 at lag 6,

A.Coefficients{6} = 0.4

A = 1-D Lag Operator Polynomial: ----------------------------- Coefficients: [1 -0.3 0.6 0.4] Lags: [0 1 4 6] Degree: 6 Dimension: 1

The lag operator polynomial object `A`

now
has nonzero coefficients at lags 0, 1, 4, and 6, and is degree 6.

When lag indices are placed inside of parentheses the result is another lag-based cell array that represent a subset of the original polynomial.

A0 = A.Coefficients(0)

A0 = 1-D Lag-Indexed Cell Array Created at Lags [0] with Non-Zero Coefficients at Lags [0].

`A0`

is a new object that preserves lag-based
indexing and is suitable for assignment to and from lag operator polynomial.

class(A0)

ans = 'internal.econ.LagIndexedArray'

In contrast, when lag indices are placed inside curly braces, the result is the same data type as the indices themselves:

class(A.Coefficients{0})

ans = 'double'

You can express the differencing operator, Δ, in lag operator polynomial notation as

$$\Delta =(1-L).$$

$${\Delta}^{D}={(1-L)}^{D}.$$

To specify a first differencing operator polynomial using `LagOp`

,
specify coefficients 1 and –1 at lags 0 and 1:

`D1 = LagOp({1,-1},'Lags',[0,1])`

D1 = 1-D Lag Operator Polynomial: ----------------------------- Coefficients: [1 -1] Lags: [0 1] Degree: 1 Dimension: 1

Similarly, the seasonal differencing operator in lag polynomial notation is

$${\Delta}_{s}=(1-{L}^{s}).$$

`D12 = LagOp({1,-1},'Lags',[0,12])`

D12 = 1-D Lag Operator Polynomial: ----------------------------- Coefficients: [1 -1] Lags: [0 12] Degree: 12 Dimension: 1

This results in a polynomial object with degree 12.

When a difference lag operator polynomial is applied to a time
series *y _{t}*, $${(1-L)}^{D}{y}_{t}$$, this is equivalent to filtering
the time series. Note that filtering a time series using a polynomial
of degree

Consider taking second differences of a time series *y _{t}*, $${(1-L)}^{2}{y}_{t}.$$ You can write this differencing
polynomial as $${(1-L)}^{2}=(1-L)(1-L).$$

Create the second differencing polynomial by multiplying the
polynomial `D1`

to itself to get the second-degree
differencing polynomial:

D2 = D1*D1

D2 = 1-D Lag Operator Polynomial: ----------------------------- Coefficients: [1 -2 1] Lags: [0 1 2] Degree: 2 Dimension: 1

The coefficients in the second-degree differencing polynomial correspond to the coefficients in the difference equation

$${(1-L)}^{2}{y}_{t}={y}_{t}-2{y}_{t-1}+{y}_{t-2}.$$

To see the effect of filtering (differencing) on the length of a time series, simulate a data set with 10 observations to filter:

```
rng('default')
Y = randn(10,1);
```

Filter the time series `Y`

using `D2`

:

Yf = filter(D2,Y); length(Yf)

ans = 8

The filtered series has two observations less than the original series. The time indices for the new series can be optionally returned:

Note that the time indices are given relative to time 0. That is, the original series corresponds to times 0,...,9. The filtered series loses the observations at the first two times (times 0 and 1), resulting in a series corresponding to times 2,...,9.

You can also filter a time series, say `Y`

,
with a lag operator polynomial, say `D2`

, using this
shorthand syntax:

Yf = D2(Y);

Was this topic helpful?