*
* @ARMASpectrum eqn
* produces a graph of the spectral density for an input ARMA model
* where the model is in the form of an equation. This could be an
* equation defined by BOXJENK or LINREG, or it could be a test equation
* created using EQUATION.
*
* Options:
* ORDS=# of frequency ordinates used [512]
* HEADER=Header for high-resolution graph
*
* Revision Schedule:
* 09/2004 Written by Tom Doan, Estima.
* 06/2005 Altered to scale by the residual variance
*
procedure ARMASpectrum eqn
type equation eqn
*
option integer ords 512
option string header
*
local series armasp freqs
local real scale
*
* Figure out the variance scaling factor
*
compute scale=%eqnvariance(eqn)
if .not.%valid(scale)
compute scale=1.0
*
freq 1 ords
*
* Compute the transfer function of the ARMA part
* of the equation.
*
trfunc(equation=eqn) 1
*
* Square it and divide through the variance
*
cmult(scale=2*%pi/scale) 1 1
*
* Take the reciprocal and send half of the resulting
* series back to the time domain.
*
cset 1 = 1.0/%z(t,1)
ctor 1 ords/2
# 1
# armasp
set freqs 1 ords/2 = (t-1)*2.0/ords
scatter(style=lines,header=header,hlabel='Frequency as fraction of pi')
# freqs armasp
end ARMASpectrum