RATS 11.1
RATS 11.1

Functions /

Polynomial Functions

Home Page

← Previous Next →

RATS provides a suite of functions for manipulating polynomials. These are represented as a VECTOR of the form

 

\(\left\| {{\kern 1pt} {\kern 1pt} v\left( 1 \right), \ldots ,v\left( {n + 1} \right){\kern 1pt} {\kern 1pt} } \right\|\) ,

 

 which denotes the polynomial:

 

\(v\left( 1 \right) + v\left( 2 \right)x +  \ldots  + v\left( {n + 1} \right){x^n}\)


 

%eqnlagpoly(eqn,s)

Extract lag polynomial from an equation

%polyadd(V1,V2)

Add two polynomials

%polycxroots(V)

Complex roots of a polynomial

%polydiv(V1,V2,d)

Divide two polynomials

%polymult(V1,V2)

Multiply two polynomials

%polyroots(V)

(Real) roots of a polynomial

%polysub(V1,V2)

Subtract two polynomials

%polyvalue(V1,x)

Evaluate a polynomial at a given value for x

 

The most important of these is %EQNLAGPOLY(eqn,series), which pulls a lag polynomial out of an equation or regression (the most recent regression if eqn=0). If series is the dependent variable, it extracts the standard normalization for the autoregression polynomial, that is, 1–lag polynomial from the right side.

 

For example, this implements an ARDL (autoregressive-distributed lag) model and does calculations of the long-run effect of x (LOGY) on y (LOGC) and the first eight terms of the expansion of the y on x.


 

linreg(define=ardl) logc

# logc{1 to 3} logy{0 to 3} seas{0 to -3}

 

compute arpoly = %eqnlagpoly(0,logc)

compute dlpoly = %eqnlagpoly(0,logy)

 

*

* Compute the long run effect

*

compute ardllt=%polyvalue(dlpoly,1)/%polyvalue(arpoly,1)

 

*

* Compute 8 lags of the expansion (degree 7 polynomial)

*

compute ardlest=%polydiv(dlpoly,arpoly,7)

 


Copyright © 2026 Thomas A. Doan