RATS 11
RATS 11

Instructions /

FMATRIX Instruction

Home Page

← Previous Next →

FMATRIX( options )  array startrow startcolumn endrow

# list of lags in filter

# list of corresponding filter coefficients

 

FMATRIX creates matrices which, as linear operators, are like a FILTER or DIFFERENCE instruction. Such matrices occur frequently in advanced regression techniques with time series data. FMATRIX also is the simplest way to generate banded matrices.

 

FMATRIX forms the lag polynomial for the filter and sets the coefficients for the polynomial into the rows of the new matrix.

Parameters

array

RECTANGULAR to set (must be DIMENSIONed prior to instruction)

startrow, startcolumn

starting row, column to set. By default, 1,1.

newstart

ending row (last row to set). By default, the last row of the array.

Options

DIFFERENCES=number of differences [unused]

SDIFFERENCES=number of seasonal differences [unused]

SPAN=seasonal span [CALENDAR seasonal]

These set the differencing filters that would be created by DIFFERENCE with the same options.

 

EQUATION=equation which supplies filter form [unused]

This supplies the filter as described for the same option in FILTER. For a general filter (something that isn't just differences), either use this, or input the filter form using the supplementary cards (again, those are as they would be for FILTER).

 

SCALE=real scaling factor for filter coefficients [1.0]

 

[ZEROS]/NOZEROS

Set all other entries of matrix to zero

Description

You set the form of the filter using the options and (if needed) supplementary cards.

 

FMATRIX puts the zero lag of the filter into startcolumn of startrow. The coefficient for lag m is m columns to the right of startcolumn. Leads (negative lags) are to the left. In the next row, the coefficients are laid out beginning one column further to the right. This continues until endrow.

 

FMATRIX skips filter coefficients if they would end up outside the bounds of the array. Thus, you have to be careful about your choice of dimensions so the filter doesn’t get truncated unintentionally.

Example

dec rect amatrix(4,7)

fmatrix(diffs=3) amat

 

creates the matrix

      

1.0  -3.0   3.0  -1.0   0.0   0.0   0.0

0.0   1.0  -3.0   3.0  -1.0   0.0   0.0

0.0   0.0   1.0  -3.0   3.0  -1.0   0.0

0.0   0.0   0.0   1.0  -3.0   3.0  -1.0

 

The 1, -3, 3, -1 entries are the coefficients of a third order differencing operator. With each new row, these coefficients move over one column.


 

declare rect dummy(22,26)

declare symm priorh(26,26)

fmatrix(diff=2) dummy 1 3

compute priorh=hb*(tr(dummy)*dummy)


creates a 22 x 26 matrix with a second difference operator, starting in column 3 of row 1. So row 1 will start with 0,0, then 1,-2,1, and the rest zeros.


 


Copyright © 2025 Thomas A. Doan