Simulate a VAR process

Questions and discussions on Vector Autoregressions
ac_1
Posts: 495
Joined: Thu Apr 15, 2010 6:30 am

Re: Simulate a VAR process

Unread post by ac_1 »

TomDoan wrote: Thu Apr 18, 2024 7:10 am You need to do a lot more reading on cointegration.
Yes - agreed.


I have attempted to recover the coefficients from the DGP, but I do not understand how the output from JOHMLE relates to those. I'll accept
TomDoan wrote: Thu Apr 18, 2024 7:10 am When the rank is 2 or more, there are an infinite number of possible cointegrating vectors. If (x+y-z) and (x-y) are stationary, then so is any linear combination of (x+y-z) and (x-y).
and presumably when the rank=1 there is only 1 unique cointegrating vector?

JOHMLE correctly identifies from the trace tests 2 ECT's i.e. rank=2, but how via the output are the equilibrium errors (x+y-z) and (x-y) related to the cointegrating vectors, and related to the ECT's?

Why are the coefficients from SYSTEM not similar to those in the DGP?

TomDoan wrote: Thu Apr 18, 2024 7:10 am The procedure gives a full breakdown of the PI matrix. You have to determine the rank and determine what the cointegrating space is from there. For forecasting or any related purposes, it doesn't matter how you normalize multiple cointegrating vectors---whatever you might do to the betas is washed out by the inverse transformation in the alphas.
Please explain further...


Here's the complete code:

Code: Select all

*===============================
seed 1

all 500

clear(zeros) x y z

frml xeq x = x{1}+.1*(x{1}-x{2})-.2*(y{1}-y{2})-.2*(z{1}-z{2})-.05*(x{1}+y{1}-z{1})-.001*(x{1}-y{1})
frml yeq y = y{1}-.2*(x{1}-x{2})+.4*(y{1}-y{2})-.1*(z{1}-z{2})+.001*(x{1}+y{1}-z{1})+.5*(x{1}-y{1})
frml zeq z = z{1}-.1*(x{1}-x{2})+.1*(y{1}-y{2})+.1*(z{1}-z{2})+.01*(x{1}+y{1}-z{1})-.001*(x{1}-y{1})

group xyzcoint xeq>>x yeq>>y zeq>>z


compute [symm] sigma=||1.0|0.5,1.0|0.5,0.5,1.0||
disp sigma

simulate(cv=sigma,model=xyzcoint,from=3,steps=498)

prin / x y z


*===============================
* Dickey-Fuller tests

@dfunit(det=constant) x
@dfunit(det=constant,maxlags=6,method=gtos) x
@dfunit(det=constant,maxlags=6,method=aic) x

@dfunit(det=constant) y
@dfunit(det=constant,maxlags=6,method=gtos) y
@dfunit(det=constant,maxlags=6,method=aic) y

@dfunit(det=constant) z
@dfunit(det=constant,maxlags=6,method=gtos) z
@dfunit(det=constant,maxlags=6,method=aic) z


*===============================
set eqerr = x + y - z

@dfunit(det=constant) eqerr
@dfunit(det=constant,maxlags=6,method=gtos) eqerr
@dfunit(det=constant,maxlags=6,method=aic) eqerr


spgraph(header='',hfields=2,vfields=1)
graph(header="Non Stationary Series",key=upright) 3
# x 101 500
# y 101 500
# z 101 500
graph(header="Equilibrium error: x(t)+y(t)-z(t) ~ I(0)") 1
# eqerr 101 500
spgraph(done)


set eqerr = x - y

@dfunit(det=constant) eqerr
@dfunit(det=constant,maxlags=6,method=gtos) eqerr
@dfunit(det=constant,maxlags=6,method=aic) eqerr


spgraph(header='',hfields=2,vfields=1)
graph(header="Non Stationary Series",key=upright) 3
# x 101 500
# y 101 500
# z 101 500
graph(header="Equilibrium error: x(t)-y(t) ~ I(0)") 1
# eqerr 101 500
spgraph(done)


*===============================
@johmle(LAGS=1,DET=constant,NOSEASONAL,ECT=ecteqns,CV=cvectors,VECTORS=evectors,EIGENVALUES=evalues,$
        DUALVECTORS=dualvec,LOADINGS=loadings,TRACETESTS=tracetests,PRINT) 101 500
# x y z

disp "CV:" cvectors; * ML estimator for a single cointegrating vector
disp "VECTORS:" evectors; * beta's
disp "EIGENVALUES:" evalues; * eigenvalues
disp "DUALVECTORS:" dualvec; * dualvec
disp "LOADINGS:" loadings; * alpha's
disp "TRACETESTS:" tracetests; * tracetests


equation(coeffs=%xcol(evectors,1)) ect1 *
# x y z
equation(coeffs=%xcol(evectors,2)) ect2 *
# x y z
equation(coeffs=%xcol(evectors,3)) ect3 *
# x y z

set ect_1 = %eqnprj(ect1,t); * compute projected values of an equation. Returns the projected (fitted) value of equation at time period t
set ect_2 = %eqnprj(ect2,t); * compute projected values of an equation. Returns the projected (fitted) value of equation at time period t
set ect_3 = %eqnprj(ect3,t); * compute projected values of an equation. Returns the projected (fitted) value of equation at time period t


spgraph(header='ECT',hfields=2,vfields=2)
graph(header="ect_1") 1
# ect_1 101 500
graph(header="ect_2") 1
# ect_2 101 500
graph(header="ect_3") 1
# ect_3 101 500
spgraph(done)


system(model=ectmodel)
variables x y z
lags 1 to 2
ect ect1 ect2
end(system)
estimate(residuals=resids,noftests) 101 500
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Simulate a VAR process

Unread post by TomDoan »

Your questions are basically asking me to explain multi-rank cointegration to you. The estimation process produces an (imprecise, due to sampling error) subspace of cointegrating vectors. Trying to determine if any particular vector appears to be part of that is very complicated. In the CATS manual, testing hypotheses takes 15 pages, and that doesn't include any theory. Hamilton has a section on hypothesis testing in ML estimation and has examples of testing both with univariate methods (testing whether a particular linear combination fails a unit root test) and in the context of ML estimates.

Again, however, why does it matter? The space of cointegrating vectors is all that matters for forecasting.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Simulate a VAR process

Unread post by TomDoan »

ac_1 wrote: Sun Apr 21, 2024 1:44 am I have attempted to recover the coefficients from the DGP, but I do not understand how the output from JOHMLE relates to those. I'll accept
TomDoan wrote: Thu Apr 18, 2024 7:10 am When the rank is 2 or more, there are an infinite number of possible cointegrating vectors. If (x+y-z) and (x-y) are stationary, then so is any linear combination of (x+y-z) and (x-y).
and presumably when the rank=1 there is only 1 unique cointegrating vector?
Up to a constant multiple.
ac_1
Posts: 495
Joined: Thu Apr 15, 2010 6:30 am

Re: Simulate a VAR process

Unread post by ac_1 »

The equilibrium errors (x+y-z) and (x-y) are related to the ECT's as in the plots attached, sign flipped on (x-y). They are on different scales and extremely similar, not identical presumably due to the sample size, yet the coeffs in regenerating the DGP are very different!?!

The cointegrating vectors (eigen-vectors or beta's) are related to the ECT's: ECT = evectors' * variables
Attachments
g__(x-y).rgf
(5.07 KiB) Downloaded 487 times
g__(x+y-z).rgf
(5.07 KiB) Downloaded 517 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Simulate a VAR process

Unread post by TomDoan »

Again, @JOHMLE only identifies the subspace of cointegrating vectors. You could just as easily have generated the data using 5(x-y) - 10(x+y-z) and 2(x-y)+6(x+y-z) which are also stationary processes and which look completely different. The fact that your ECT's are even close to the ones you used is pure luck; not math.

The scale has nothing to do with sample size---it's just a different normalization.
Post Reply