I estimate a bivariate VARFIMA using the gaussian semi-parametric estimator of Shimotsu (2007, Journal of Econometrics). The source code I use is reported below.
Is there a convenient method to save the vector of residuals from a multivariate estimation that use the maximize instruction (a multivariate version of %resids)?
Thanks for you help.
Code: Select all
********
*Gaussian semiparametric estimation of multivariate fractionally integrated processes
*K. Shimotsu (2007), Journal of Econometrics, No 137
*(Valid for covariance stationary processes...
*...See, F. Nielsen (2011), JTSA, No 32, for an extension to non-stationary processes)
********
procedure mWnb y x start end
type series y x
type integer start end
option real bandwidth
option switch print 1
option vect idelta ||0.4,0.2||
local vect delta
local symm sigma
local real wei
local int n
local int m
local cseries ftcy ftcx
local series pyy pxx pyx pxy
local cseries csyy csxx csyx csxy
local frml[rect] ilam
local frml[symm] iper itrf
local frml[complex] ipyy ipxx ipyx
***************************** Init
comp n = end - start + 1
stat(noprint) y start end
set y start end = y - %mean
stat(noprint) x start end
set x start end = x - %mean
dim sigma(2,2) delta(2)
comp delta = idelta, sigma = %identity(2)
if %defined(bandwidth)
{
comp m = fix(n^bandwidth)
}
else
{
comp m = fix(n^0.8)
}
frequency 3 m
***************************** Spectral analysis
*************************************************************************************
**** (La commande RtoC semble bugger lorsque l'option est sur pad et que la série
**** de sortie est renommée. Solution: utiliser une référence numérique en sortie)
*************************************************************************************
rtoc(pad) start end
# y
# 1
fft 1 / ftcy
rtoc(pad) start end
# x
# 2
fft 2 / ftcx
comp wei = 1.0/sqrt(2*%pi*float(n))
cmul(scale=wei) ftcy ftcy / csyy
cmul(scale=wei) ftcx ftcx / csxx
cmul(scale=wei) ftcy ftcx / csyx
cmul(scale=wei) ftcx ftcy / csxy
nonlin(parmset=fi) delta
nonlin(parmset=sd) sigma
frml ipxx = csxx
frml ipyy = csyy
frml ipyx = csyx
frml iper = ||%real(ipyy)|%real(ipyx),%real(ipxx)||
frml ilam = %diag(||%cabs((1.0-%zlag(t,1))^delta(1))|%cabs((1.0-%zlag(t,1)))^delta(2)||)
frml itrf = %ginv(ilam)*sigma*tr(%ginv(ilam))
frml logl = %logdensitycv(itrf,iper,(float(n)/m))
maximize(parmset=fi+sd,method=bfgs,iter=150,pmethod=simplex,piters=5, $
print=print,title="Local Whittle Approx. of Fractionally Integrated processes") logl 1 m
comp %dvec = delta, %G = sigma
end procedure