Dear Staff,

I am trying to run a cointegration analysis using 4 variables. I want to know if there is a way to call @Cats without giving it all the details like the options, sample period and lags? I am asking this because i want to run the test after determining the best lag length selected by BIC or AIC.

Furthermore, once i have run a command for example:

source c:\cats2\cats.src

@CATS(LAGS=2,DETTREND=DRIFT) 2003:07 2018:09

# LOGCPI LOGDEBT LOGM1 LOGTAX

I cannot go back until i exit cats to modify my variables or lags (once i have found the best lag), can you please help?

Finally, if i allow for 12 lags for example the effective sample starts from 2004:07 to 2018:09, i have already allowed for 12 lags from 2002:06 to 2003:06 and one difference for augmented dickey fuller test so my sample for estimation starts from 2003:07 ... so how to take care of this?

Regards,

Ateeb

I am trying to run a cointegration analysis using 4 variables. I want to know if there is a way to call @Cats without giving it all the details like the options, sample period and lags? I am asking this because i want to run the test after determining the best lag length selected by BIC or AIC.

Furthermore, once i have run a command for example:

source c:\cats2\cats.src

@CATS(LAGS=2,DETTREND=DRIFT) 2003:07 2018:09

# LOGCPI LOGDEBT LOGM1 LOGTAX

I cannot go back until i exit cats to modify my variables or lags (once i have found the best lag), can you please help?

Finally, if i allow for 12 lags for example the effective sample starts from 2004:07 to 2018:09, i have already allowed for 12 lags from 2002:06 to 2003:06 and one difference for augmented dickey fuller test so my sample for estimation starts from 2003:07 ... so how to take care of this?

Regards,

Ateeb

- ateeb
**Posts:**66**Joined:**Sat Mar 16, 2019 11:15 am**Location:**Kalamazoo, MI, USA

You can change the lags and the deterministic setting using the CATS menu-Model... operation. You cannot change the set of variables (or dummies or exogenous variables) without re-running CATS.

- TomDoan
**Posts:**7156**Joined:**Wed Nov 01, 2006 5:36 pm

Dear Tom,

When i go to change sample while i am in CATs the RATs crashes. So is there a specific RAM and processor requirements to be able to handle processing? Also like R is there a command that can put 3 cores of a PC working on RATs only and 1 processor working on other things (parallel computing?)!

I have core i7-7th Gen 2.8 GHz and turbo upto 3.8 GHz, 8 GB RAM. I am thinking to upgrade to 16 GB RAM, would that help or something else is the issue?

Regards,

When i go to change sample while i am in CATs the RATs crashes. So is there a specific RAM and processor requirements to be able to handle processing? Also like R is there a command that can put 3 cores of a PC working on RATs only and 1 processor working on other things (parallel computing?)!

I have core i7-7th Gen 2.8 GHz and turbo upto 3.8 GHz, 8 GB RAM. I am thinking to upgrade to 16 GB RAM, would that help or something else is the issue?

Regards,

- ateeb
**Posts:**66**Joined:**Sat Mar 16, 2019 11:15 am**Location:**Kalamazoo, MI, USA

There appears to be a problem with the CATS---Sample operation, which we're working on fixing. (It's actually a RATS problem that creates that). However, there is generally little reason to change the range as part of the analysis---figure out which range you want first.

We use two threads, one for the interface and one for the statistical engine. So far, attempts to use additional processors have not given us confidence that we can actually make things better by using them---the overhead to set up multiple threads can take more time than multithreading saves. There's also the problem that a lot of time series methods don't lend themselves well to multithreading because the calculations are often recursive.

We use two threads, one for the interface and one for the statistical engine. So far, attempts to use additional processors have not given us confidence that we can actually make things better by using them---the overhead to set up multiple threads can take more time than multithreading saves. There's also the problem that a lot of time series methods don't lend themselves well to multithreading because the calculations are often recursive.

- TomDoan
**Posts:**7156**Joined:**Wed Nov 01, 2006 5:36 pm

Hello,

I ran the following commands to run my VECM model:

linreg(define=ec11) Logdebt / resid 2003:07 2018:09

# constant logM1 LogCPI

set lagresid = resid(t-1)

@varlagselect(crit=AIC,lags=12) 2003:07 2018:09

# logdebt logcpi logm1 logLSM r

SYSTEM(MODEL=PK1MODEL)

VARIABLES Diffdebt DiffM1 DiffCPI logLSM r

LAGS 1 2

DET Constant lagresid du

END(SYSTEM)

ESTIMATE 2003:07 2018:09

But i am told by my advisor that @varlagselect is a procedure for selecting lags for VAR not VECM model. However, what i understand is that VECM model has that extra term in their which is capturing the short-run deviations from the long-run relationship and otherwise this system is correct as all are stationary variables. So can you let me know is this ok or is there another way to determine the lags to be used in a VECM model?

I ran the following commands to run my VECM model:

linreg(define=ec11) Logdebt / resid 2003:07 2018:09

# constant logM1 LogCPI

set lagresid = resid(t-1)

@varlagselect(crit=AIC,lags=12) 2003:07 2018:09

# logdebt logcpi logm1 logLSM r

SYSTEM(MODEL=PK1MODEL)

VARIABLES Diffdebt DiffM1 DiffCPI logLSM r

LAGS 1 2

DET Constant lagresid du

END(SYSTEM)

ESTIMATE 2003:07 2018:09

But i am told by my advisor that @varlagselect is a procedure for selecting lags for VAR not VECM model. However, what i understand is that VECM model has that extra term in their which is capturing the short-run deviations from the long-run relationship and otherwise this system is correct as all are stationary variables. So can you let me know is this ok or is there another way to determine the lags to be used in a VECM model?

- ateeb
**Posts:**66**Joined:**Sat Mar 16, 2019 11:15 am**Location:**Kalamazoo, MI, USA

The Sims-Stock-Watson result means that you get effectively identical results for tests of lag length for a VECM whether in VAR form or VECM form:

https://estima.com/ratshelp/simsstockwatsonresult.html

(other than for testing 0 vs 1 in the VAR form, but there is no chance that you're going to have 0 chosen when the series are I(1)).

https://estima.com/ratshelp/simsstockwatsonresult.html

(other than for testing 0 vs 1 in the VAR form, but there is no chance that you're going to have 0 chosen when the series are I(1)).

- TomDoan
**Posts:**7156**Joined:**Wed Nov 01, 2006 5:36 pm

So what i wrote is the following:

do i = 1,12

SYSTEM(MODEL=PK1MODEL)

VARIABLES Diffdebt DiffM1 DiffCPI logLSM r

LAGS 1 to i

DET Constant lagresid du

END(SYSTEM)

ESTIMATE 2003:07 2018:09

com aic = %nobs*log(%rss) + 2*(%nreg)

com sbc = %nobs*log(%rss) + (%nreg)*log(%nobs)

dis "Lags: " i "T-stat" %tstats(1) aic sbc

end do i

So my questions is usually when we do such a loop it will run a single regression and apply the AIC and BIC criterion, but with this everytime it is running 5 regressions, so this loop would apply the AIC and BIC to the last of the regressions that is for variable "r" right?

But with that said in every equation there are same number of regressors and deterministric terms so would this be the right way of selecting the lag lengths?

Thanks for your help in advance.

do i = 1,12

SYSTEM(MODEL=PK1MODEL)

VARIABLES Diffdebt DiffM1 DiffCPI logLSM r

LAGS 1 to i

DET Constant lagresid du

END(SYSTEM)

ESTIMATE 2003:07 2018:09

com aic = %nobs*log(%rss) + 2*(%nreg)

com sbc = %nobs*log(%rss) + (%nreg)*log(%nobs)

dis "Lags: " i "T-stat" %tstats(1) aic sbc

end do i

So my questions is usually when we do such a loop it will run a single regression and apply the AIC and BIC criterion, but with this everytime it is running 5 regressions, so this loop would apply the AIC and BIC to the last of the regressions that is for variable "r" right?

But with that said in every equation there are same number of regressors and deterministric terms so would this be the right way of selecting the lag lengths?

Thanks for your help in advance.

- ateeb
**Posts:**66**Joined:**Sat Mar 16, 2019 11:15 am**Location:**Kalamazoo, MI, USA

There are different (specific) forms for AIC and SBC for single equation regressions, but the general form using the log likelihood will apply to both univariate and multivariate regressions. See the VARLAG.RPF program which shows (at the end) the inner workings of what @VARLAGSELECT does.

Is DU supposed to be lagged?

Is DU supposed to be lagged?

- TomDoan
**Posts:**7156**Joined:**Wed Nov 01, 2006 5:36 pm

DU is a dummy due to a spike in all the series at the same point in the analysis, so to control for that this dummy has been added to the analysis.

let me see the procedure you told me, but given my loop is it written correctly?

Thanks for responding fast.

let me see the procedure you told me, but given my loop is it written correctly?

Thanks for responding fast.

- ateeb
**Posts:**66**Joined:**Sat Mar 16, 2019 11:15 am**Location:**Kalamazoo, MI, USA

The structure is fine; the calculation of the AIC and SBC aren't.

- TomDoan
**Posts:**7156**Joined:**Wed Nov 01, 2006 5:36 pm

ok thanks, let me check that and write appropriately for VECM model.

- ateeb
**Posts:**66**Joined:**Sat Mar 16, 2019 11:15 am**Location:**Kalamazoo, MI, USA

Dear Tom,

Forgot to write in last msg, but if you can help me to write it the correct way, i would be thankful.

Forgot to write in last msg, but if you can help me to write it the correct way, i would be thankful.

- ateeb
**Posts:**66**Joined:**Sat Mar 16, 2019 11:15 am**Location:**Kalamazoo, MI, USA

Did you look at the end of the VARLAG.RPF example? That's how you do the calculations after an ESTIMATE. The fact that you have a few extra deterministics doesn't change that.

- TomDoan
**Posts:**7156**Joined:**Wed Nov 01, 2006 5:36 pm

So i wrote the following code:

report(action=define,$

hlabel=||"Lags","AIC","SBC","LR Test","P-Value"||)

dec real lastll

do lags=1,12

system(model=pk1model)

variables Diffdebt DiffM1 DiffCPI logLSM r

lags 1 to lags

det Constant lagresid du

end(system)

estimate(noprint) 2003:07 2018:09

compute ll =%logl

compute sbc=-2.0*ll/%nobs+%nregsystem*log(%nobs)/%nobs

compute aic=-2.0*ll/%nobs+$

%nregsystem*2.0*%nvar/(%nvar*%nobs-%nregsystem-1)

report(row=new,atcol=1,align=decimal) lags aic sbc

if lags>1

report(row=current,atcol=4) 2*(ll-lastll) $

%chisqr(2*(ll-lastll),%nvar*%nvar)

compute lastll=ll

end do lags

report(action=format,atcol=2,tocol=2,special=onestar,$

tag=min,align=decimal)

report(action=format,atcol=3,tocol=3,special=onestar,$

tag=min,align=decimal)

report(action=format,atcol=2,tocol=3,width=8)

report(action=format,atcol=4,tocol=5,picture="*.####")

report(action=show)

Output

Where LogDebt, LogM1 and LogCPI are cointegrated of order 1 and therefore I took first difference. r and LogLsm are stationary in levels and log-levels respectively.

So is this correct?

Regards

report(action=define,$

hlabel=||"Lags","AIC","SBC","LR Test","P-Value"||)

dec real lastll

do lags=1,12

system(model=pk1model)

variables Diffdebt DiffM1 DiffCPI logLSM r

lags 1 to lags

det Constant lagresid du

end(system)

estimate(noprint) 2003:07 2018:09

compute ll =%logl

compute sbc=-2.0*ll/%nobs+%nregsystem*log(%nobs)/%nobs

compute aic=-2.0*ll/%nobs+$

%nregsystem*2.0*%nvar/(%nvar*%nobs-%nregsystem-1)

report(row=new,atcol=1,align=decimal) lags aic sbc

if lags>1

report(row=current,atcol=4) 2*(ll-lastll) $

%chisqr(2*(ll-lastll),%nvar*%nvar)

compute lastll=ll

end do lags

report(action=format,atcol=2,tocol=2,special=onestar,$

tag=min,align=decimal)

report(action=format,atcol=3,tocol=3,special=onestar,$

tag=min,align=decimal)

report(action=format,atcol=2,tocol=3,width=8)

report(action=format,atcol=4,tocol=5,picture="*.####")

report(action=show)

Output

Where LogDebt, LogM1 and LogCPI are cointegrated of order 1 and therefore I took first difference. r and LogLsm are stationary in levels and log-levels respectively.

So is this correct?

Regards

- ateeb
**Posts:**66**Joined:**Sat Mar 16, 2019 11:15 am**Location:**Kalamazoo, MI, USA

22 posts
• Page **1** of **2** • **1**, 2

Users browsing this forum: No registered users and 1 guest