Polynomial Functions |
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}\)
|
Extract lag polynomial from an equation |
|
|
Add two polynomials |
|
|
Complex roots of a polynomial |
|
|
Divide two polynomials |
|
|
Multiply two polynomials |
|
|
(Real) roots of a polynomial |
|
|
Subtract two polynomials |
|
|
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 © 2025 Thomas A. Doan