VECM representation for different deterministic models

Questions and discussions on Vector Autoregressions
COMI
Posts: 24
Joined: Mon Sep 28, 2015 4:12 am

VECM representation for different deterministic models

Unread post by COMI »

Dear Tom,
suppose we have two variables "X" and "Y". And suppose @Johmle shows that they are cointegrated with DET=Trend. Now, I am not sure how to calculate ECT term in VECM. Is the below code correct?:

Code: Select all

* estimating a VECM model
linreg(define=cointeq) X
# Y
system(model=mvmean)
variables X Y
lags 1 to 6
det constant
ect cointeq
end(system)
and what about this one?:

Code: Select all

@johmle(lags=6,det=trend,vectors=eigenvect)
# X Y
* Normalize first  eigenvectors to be identity in top 1 x 1 corner.
*
compute beta=%xsubmat(eigenvect,1,2,1,1)*inv(%xsubmat(eigenvect,1,1,1,1))
equation(coeffs=%xcol(beta,1)) ecteq *
# X Y
set dX = X-X{1}
set dY = Y-Y{1}
set ect = %eqnprj(ecteq,t)
*
System(model=vecmmodel)
Var dX dY
Lags 1 to 5
Det constant ect{1}
End(system)
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Short-and-long run restrictions with VECM

Unread post by TomDoan »

This is overkill:

Code: Select all

@johmle(lags=6,det=trend,vectors=eigenvect)
# X Y
* Normalize first  eigenvectors to be identity in top 1 x 1 corner.
*
compute beta=%xsubmat(eigenvect,1,2,1,1)*inv(%xsubmat(eigenvect,1,1,1,1))
equation(coeffs=%xcol(beta,1)) ecteq *
There's only one cointegrating vector, so you can use the CV option to fetch it, then normalize by dividing through on the first element:

Code: Select all

@johmle(lags=6,det=trend,cv=cv)
# X Y
*
* Normalize first  eigenvectors to be identity in top 1 x 1 corner.
*
compute cv=cv/cv(1)
equation(coeffs=cv) ecteq *
# x y
COMI
Posts: 24
Joined: Mon Sep 28, 2015 4:12 am

Re: Short-and-long run restrictions with VECM

Unread post by COMI »

Thank you very much.
when we say that X and Y are cointegrated with DET=Trend , shouldn't we include trend in the calculation of ECT?
I mean when we have this equation: x=trend+bY, then ECT should be ECT=trend+bY-X. But in the following code it seems that we don't include trend in calculation of ECT:

Code: Select all

* estimating a VECM model
linreg(define=cointeq) X
# Y
system(model=mvmean)
variables X Y
lags 1 to 6
det constant
ect cointeq
end(system)
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Short-and-long run restrictions with VECM

Unread post by TomDoan »

DET=TREND is almost never the correct model---if forces quadratic behavior into the trends. If you're saying that the series have trends, then use DET=CONSTANT.
John
Posts: 29
Joined: Mon Nov 09, 2015 2:02 pm

Re: Short-and-long run restrictions with VECM

Unread post by John »

Dear Tom,
I wanted to run the below code but I got this error: ## MAT5. Needed Matrix with Dimensions 2 x 1, Got 3 x 1 Instead.
I tried to fix it but unfortunately I couldn't do it.

Code: Select all

* returns
set lx = lx*100.0
set ly = ly*100
set dlx  = lx-lx{1}
set dly  =  ly-ly{1}
@johmle(lags=4,det=rc,cv=cv)
# lx ly
* Normalize first  eigenvectors to be identity in top 1 x 1 corner.
*
compute cv=cv/cv(1)
equation(coeffs=cv) ecteq *
# lx ly
set ect = %eqnprj(ecteq,t)
*
System(model=vecmmodel)
Var dx dy
Lags 1 to 3
Det constant ect{1}
End(system)
garch(model=vecmmodel,mv=dcc,hmatrices=hh,variances=spillover,rvector=r,stdresids=rr,$
  distribt=t,pmethod=simplex,piters=20,method=bfgs,iters=500,CVCRIT=.00001)
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Short-and-long run restrictions with VECM

Unread post by TomDoan »

DET=RC has a constant in the cointegrating vector (that's the whole point). I thought you said the data had a trend. If the data have a trend, then you need DET=CONSTANT. Please take the time to understand what you're doing.
John
Posts: 29
Joined: Mon Nov 09, 2015 2:02 pm

Re: Short-and-long run restrictions with VECM

Unread post by John »

I am working with different data sets. In the new data set, variables don't have a clear trend (sustained tendency for the variables to increase or decrease). Therefore, I should use DET=RC in the @johmle. But I got that error when I run the model.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Short-and-long run restrictions with VECM

Unread post by TomDoan »

DET=RC is a completely different model. There's no CONSTANT in the VAR, and there *is* a CONSTANT in the cointegrating vector. You would have to make both changes. However, for what you're doing DET=CONSTANT is probably fine.

By the way, if this is spot-futures, isn't there only one cointegrating vector that makes sense. If it's not (1,-1), shouldn't you quit school and become a trader?
John
Posts: 29
Joined: Mon Nov 09, 2015 2:02 pm

Re: Short-and-long run restrictions with VECM

Unread post by John »

Tom,
To tell the truth, I am REALLY confused about my project. Here is the data. I am not sure if I should a USE CONSTANT or TREND or RC IN THE @JOHMLE. I would be grateful if you could have a look at my data. I edited the code, I hope it is correct this time:

Code: Select all

@johmle(lags=8,det=rc,cv=cv)
# lx ly
* Normalize first  eigenvectors to be identity in top 1 x 1 corner.
*
compute cv=cv/cv(1)
equation(coeffs=cv) ecteq *
# lx ly constant
set dx = lx-lx{1}
set dy = ly-ly{1}
set ect = %eqnprj(ecteq,t)
*
System(model=vecmmodel)
Var dlx dly
Lags 1 to 7
Det   ect{1}
End(system)
Attachments
rats.xlsx
(26 KiB) Downloaded 755 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: VECM representation for different deterministic models

Unread post by TomDoan »

Again, doesn't the economics tell you exactly what the cointegrating vector has to be? LX has a unit root, LY has a unit root, LX-LY doesn't. Really, really doesn't. (A Dickey-Fuller statistic is like -9). Don't use complicated set of estimates subject to sampling error when you know what the true cointegrating vector has to be---verify that it's correct and use it.

Now your LY series has a couple of truly monster outliers which aren't seen in LX. Entry 140 almost looks like a typo. At 335-341, there is a big jump followed by a dead flat period. Those might have an effect on the ability of the data to be explained by a GARCH model---the latter, particularly, since it's 7 very unnatural-looking data points. You might want to look into why those spots are the way they are.
John
Posts: 29
Joined: Mon Nov 09, 2015 2:02 pm

Re: VECM representation for different deterministic models

Unread post by John »

Dear Tom,
I apologize for making many questions about a simple project. @johmle with DET=CONSTANT shows variables aren't cointegrated. But, @johmle with DET=RC shows variables are cointerated (and @johmle with DET=Trend gives the same results). Now I use economic theory for determining cointegrating vector which is something like: lx-constant-a*ly (according to arbitrage theory). Therefore, I should impose a restriction on cointegrating vector, i.e, coefficient of ly should equal to one: a=1.
But I don't know hose to test this restriction and and how to impose it on the cointegrating vector. If restriction is binding dosn't it has any effect on constant?

If I define z=x-y as ETC term it will imply that cointegratiing vector has been driving from @johmle with DET=CONSTANT while, as I said, results of this form of test show variables aren't cointegrated. I mean by defining z=x-y as ECT term we will omit "constnat" from cointegrating vector.
I don,t how to write a code for doing this.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: VECM representation for different deterministic models

Unread post by TomDoan »

You're becoming a slave to the statistics. @JOHMLE isn't the only way to test for cointegration. If the (presumed) cointegrating vector is known, there are simpler ways as I've described above. The Johansen procedure is a likelihood ratio test based upon Gaussian residuals. You don't have Gaussian residuals---you have two truly massive outliers. Have you looked into why those are there? If you run the Johansen test starting at entry 150 (which avoids the early outlier), you easily accept cointegration, so the test has clearly been thrown off by the one bad data point. Note, BTW, that even when you run the two tests (DET=RC and DET=CONSTANT) on the full data range, the test statistic itself is quite a bit smaller for DET=CONSTANT---you're only accepting the unit root with DET=RC because it that has a much higher critical value (because it's estimating three coefficients rather than two).
John
Posts: 29
Joined: Mon Nov 09, 2015 2:02 pm

Re: VECM representation for different deterministic models

Unread post by John »

Thank you very much for your insightful help. I really appreciate it.
Unlike spot market that is not controlled and prices can fluctuate freely, futures market is controlled and futures prices can increase (decreae) just 5(-5) percent each trading day.In some time periods, spot market has experienced large volatility (huge outliers) while because of the price ceiling in futures market, we cannot see the same volatility in this market .So, I think I should exclude those volatile periods from my data (?). I,m not sure if I'm doing a correct project at all.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: VECM representation for different deterministic models

Unread post by TomDoan »

That's way outside the bounds of what we do. You need to discuss this with your advisor.
John
Posts: 29
Joined: Mon Nov 09, 2015 2:02 pm

Re: VECM representation for different deterministic models

Unread post by John »

Dear Tom,
I dropped early observation from data set and now it starts from entry 150 (which avoids the early outlier). According to ACI criterion, I estimated VECM model with 14 lags (cointegraing vector is (1,-1)). But the loading on ETC terms show that only one of them is (marginally) significant ( at 10%). When I restimate model with robusterrors (linreg), both of them will be insignificant. Do I use extra lags? If I use BIC criterion, I should estimate model with 3 lags but here there are significant correlation among individual residuals.
If in a bekk model one of the A(1,1), A(2,2), B(1,1) or B(2,2) is negative but insignificant, dose it violate bekk restrictions?
Post Reply