*
*  PERSIST  series  start  end
*
*  Uses frequency domain techniques to estimate the sum of the
*  coefficients of the moving average representation for a series.
*
*  Revision Schedule:
*    05/92 Written, T. Doan
*    10/00 Tested with Version 5
*
procedure  persist  series  start  end
type  series  series
type  integer start end
*
local integer startl endl ordinate nobs
local series  demean
*
inquire(series=series) startl>>start endl>>end
compute nobs=endl-startl+1
compute ordinate=%freqsize(nobs)
diff(center) series / demean
*
freq 4 ordinate
rtoc startl endl
# demean
#    1
fft 1
cmult 1 1 / 2
window 2 / 3                      ;* 3 = spectral density estimate
*
cln  3
ift  3                            ;* 3 = "Z-transform of log spectrum "
cset 3 = %z(t,3)*(t<=ordinate/2)  ;* transform to one-sided
fft  3
cexp 3
ift  3                            ;* 3 = MAR * sigma
cset(scratch) 3 = %z(t,3)/%z(1,3) ;* 3 = MAR (normalized)

fft  3                            ;* 3 = FR of MAR
display 'Estimate of C(1) for MAR of ' %label(series) 'is' %real(%z(1,3))
end



