Save %xx

Questions and discussions on Vector Autoregressions
than

Save %xx

Unread post by than »

Dear Aall,

I need to help the corect save for %xx in our program.I used montesur.prg to estimate for equation by equation OLS. My total number coefficeints is 245, so I have to have 245 by 245 matrix for %xx ( in SUR case, I have the correct %xx). But in OLS case, I have 17 by 17 matrix for %xx which comes from my first equation even though I used the GROUP command. Sombody can help me for saving %xx. The part of my program is following;

Code: Select all

compute nvar=13
compute nlag=3
compue nstep=20
compute ndraws=2500

cal(q) 1957
all 2*nvar 2008:2
compute firstobs=1960:1
compute lastobs=2002:4
open data f:\documents\data\finaldata.rat
data(format=rats) 1957:1 2008:2 psccom rius48 cpiu tb ffr hpdum rinewengland rimideast rigreatlakes riplains risoutheast risouthwest $
rirockymountain rifarwest
set lcop 1959:2 2002:4 = log(psccom)
set lrius / = log(rius48)
set lcpi / = log(cpiu)
set lrine / = log(rinewengland)
set lrime / = log(rimideast)
set lrigl / = log(rigreatlakes)
set lripl / = log(riplains)
set lrise / = log(risoutheast)
set lrisw / = log(risouthwest)
set lrirm / = log(rirockymountain)
set lrifw / = log(rifarwest)
*** **** ****** ****** *******
equation ynateq1 lrius
# constant hpdum lrius{1 to nlag} lcpi{1 to nlag} ffr{1 to nlag} lcop{1 to nlag} tb{1 to nlag}
equation ynateq2 lcpi
# constant hpdum lrius{1 to nlag} lcpi{1 to nlag} ffr{1 to nlag} lcop{1 to nlag} tb{1 to nlag}
equation ynateq3 ffr
# constant hpdum lrius{1 to nlag} lcpi{1 to nlag} ffr{1 to nlag} lcop{1 to nlag} tb{1 to nlag}
equation ynateq4 lcop
# constant hpdum lrius{1 to nlag} lcpi{1 to nlag} ffr{1 to nlag} lcop{1 to nlag} tb{1 to nlag}
equation ynateq5 tb
# constant hpdum lrius{1 to nlag} lcpi{1 to nlag} ffr{1 to nlag} lcop{1 to nlag} tb{1 to nlag}
equation yregeq1 lrine
# constant hpdum lrius{1 to nlag} lcpi{1 to nlag} ffr{1 to nlag} lcop{1 to nlag} tb{1 to nlag} lrine{1 to nlag}
equation yregeq2 lrime
# constant hpdum lrius{1 to nlag} lcpi{1 to nlag} ffr{1 to nlag} lcop{1 to nlag} tb{1 to nlag} lrime{1 to nlag}
equation yregeq3 lrigl
# constant hpdum lrius{1 to nlag} lcpi{1 to nlag} ffr{1 to nlag} lcop{1 to nlag} tb{1 to nlag} lrigl{1 to nlag}
equation yregeq4 lripl
# constant hpdum lrius{1 to nlag} lcpi{1 to nlag} ffr{1 to nlag} lcop{1 to nlag} tb{1 to nlag} lripl{1 to nlag}
equation yregeq5 lrise
# constant hpdum lrius{1 to nlag} lcpi{1 to nlag} ffr{1 to nlag} lcop{1 to nlag} tb{1 to nlag} lrise{1 to nlag}
equation yregeq6 lrisw
# constant hpdum lrius{1 to nlag} lcpi{1 to nlag} ffr{1 to nlag} lcop{1 to nlag} tb{1 to nlag} lrisw{1 to nlag}
equation yregeq7 lrirm
# constant hpdum lrius{1 to nlag} lcpi{1 to nlag} ffr{1 to nlag} lcop{1 to nlag} tb{1 to nlag} lrirm{1 to nlag}
equation yregeq8 lrifw
# constant hpdum lrius{1 to nlag} lcpi{1 to nlag} ffr{1 to nlag} lcop{1 to nlag} tb{1 to nlag} lrifw{1 to nlag}
group surmodel ynateq1 ynateq2 ynateq3 ynateq4 ynateq5 yregeq1 yregeq2 yregeq3 yregeq4 yregeq5 yregeq6 yregeq7 yregeq8
estimate(model=surmodel,outsigma=sigmahat) firstobs lastobs


*
* Compute the parameters for drawing from the inverse Wishart distribution based
* upon the ML estimate of sigma. The degrees of freedom correction is the average
* number of parameters per equation
*
compute svt    =%decomp(inv(%nobs*sigmahat))
write svt
compute wishdof=%nobs-float(%nregsystem)/nvar
write wishdof
write %nregsystem
*
* This is to provide a rough approximation to the log constant of integration in
* the actual marginal posterior.
*
compute logfx  =.5*%logdetxx(%xx)-%logdetxx(sigmahat)*.5*%nregsystem/nvar
write logfx
write %xx
Sincerely,
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Save %xx

Unread post by TomDoan »

You can't get the "grand" covariance matrix using ESTIMATE, since it only estimates one equation at a time. Instead, use SUR(MODEL=SURMODEL).
than

Re: Save %xx

Unread post by than »

Dear Tom,

Thank you for the quick response, but Lastrapes(04) proved equation by equation OLS is efficient even though we have the Near-VAR which have the same number of RHS equation. He believes there is no gain using SUR. Is there any way or any command to get the Grand covariance matrix using eqation by equation OLS?

Sincerely,
than
Post Reply