Camacho JEL 2011

Use this forum for posting example programs or short bits of sample code.
TomDoan
Posts: 7732
Joined: Wed Nov 01, 2006 4:36 pm

Camacho JEL 2011

Unread post by TomDoan »

camacho_jel2011.zip is a set of replication files for M. Camacho(2011), Markov-switching models and the unit root hypothesis in real U.S. GDP", Economics Letters, vol. 112, 161-164. This does a unit root test allowing for an alternative of a trend-stationary process with MS intercept.

The simulations in the paper appear to have simulated the data under the alternative rather than the null, thus resulting in rather strong rejection of the unit root. These do the simulations (properly, I believe) under the null of a unit root.

This uses the @MSRegression procedures with the NFIX option to fix two parameters (on the trend and lagged dependent variable) while allowing the intercept to switch. The model requires some rather careful choices of guess values because the coefficients on the intercept and trend are subject to rather considerable uncertainty because of the near-unit root behavior of the process.
Tsaritsa
Posts: 15
Joined: Wed Feb 14, 2024 12:33 pm

Re: Camacho JEL 2011

Unread post by Tsaritsa »

Dear Mr. Doan,

I tried to execute this procedure however I got this message:

"## CP18. MSREGPARMSET is not the Name of a PROCEDURE. (Did you forget to SOURCE?)
>>>>@MSRegParmset(1947.<<<<"

there is no procedure called "MSREGPARMSET".

Please could you help me?
TomDoan
Posts: 7732
Joined: Wed Nov 01, 2006 4:36 pm

Re: Camacho JEL 2011

Unread post by TomDoan »

First, note that, as described above, the paper is basically wrong, so you might want to rethink your interest in it.

However, the @MSRegParmset gets pulled in by the @MSRegression procedure call, so you need to make sure that you execute this all the way through, and don't jump into the middle.
Tsaritsa
Posts: 15
Joined: Wed Feb 14, 2024 12:33 pm

Re: Camacho JEL 2011

Unread post by Tsaritsa »

Dear Mr. Doan,

I try to learn this procedure for 2 switching regressor (trend and constant) and 0 non switch regressor. But I got this error:

"## SR10. Missing Values And/Or SMPL Options Leave No Usable Data Points"


Please could you help me?

Code is following.

Code: Select all

open data gdp.txt
calendar(q) 1947:1
data(format=prn,nolabels,org=columns) 1947:01 2009:04 date gdp
*
set loggdp = 100.0*log(gdp)
set dlog   = loggdp-loggdp{1}
*
* This uses a non-standard trend
*
set trend = 1+.1*(t-1)
*
@MSRegression(switch=c,nfix=0,regimes=2) loggdp
# trend constant
*
@MSRegParmSet(parmset=regparms)
nonlin(parmset=msparms)  p 
*
compute gstart=1947:1,gend=2009:4
*
linreg loggdp
# trend  constant
*
compute sigsq=%seesq
compute betas(1)(1)=%beta(1)-.5*%stderrs(1)
compute betas(1)(2)=%beta(1)+.5*%stderrs(1)
compute betas(2)(1)=%beta(2)-.5*%stderrs(2)
compute betas(2)(2)=%beta(2)+.5*%stderrs(2)
compute p=||.75,.10||
*
frml logl = f=%MSRegFVec(t),fpt=%MSProb(t,f),log(fpt)
@MSFilterInit
maximize(start=%(%MSRegInitVariances(),pstar=%msinit()),$
  parmset=regparms+msparms,$
  method=bfgs,pmethod=simplex,piters=2) logl gstart gend
[b]## SR10. Missing Values And/Or SMPL Options Leave No Usable Data Points[/b]
TomDoan
Posts: 7732
Joined: Wed Nov 01, 2006 4:36 pm

Re: Camacho JEL 2011

Unread post by TomDoan »

Your GSTART can't be 1947:1 since you are losing an entry to differencing. Change it to 1947:2.
Tsaritsa
Posts: 15
Joined: Wed Feb 14, 2024 12:33 pm

Re: Camacho JEL 2011

Unread post by Tsaritsa »

Thanks for response Mr. Doan but I got same error. Also how can I get residuals in @MSRegression procedure? @MSRegStdResiduals is for one-step standardized residuals. But I couldnt see residuals code.

Code: Select all

open data gdp.txt
calendar(q) 1947:1
data(format=prn,nolabels,org=columns) 1947:01 2009:04 date gdp
*
set loggdp = 100.0*log(gdp)
set dlog = loggdp-loggdp{1}
*
* This uses a non-standard trend
*
set trend = 1+.1*(t-1)
*
@MSRegression(switch=c,nfix=0,regimes=2) loggdp
# trend constant
*
@MSRegParmSet(parmset=regparms)
nonlin(parmset=msparms) p
*
compute gstart=1947:2,gend=2009:4
*
linreg loggdp
# trend constant

Linear Regression - Estimation by Least Squares
Dependent Variable LOGGDP
Quarterly Data From 1947:01 To 2009:04
Usable Observations                       252
Degrees of Freedom                        250
Centered R^2                        0.9944321
R-Bar^2                             0.9944099
Uncentered R^2                      0.9999729
Mean of Dependent Variable       857.82820353
Std Error of Dependent Variable   60.09996862
Standard Error of Estimate         4.49350764
Sum of Squared Residuals         5047.9027340
Regression F(1,250)                44650.5068
Significance Level of F             0.0000000
Log Likelihood                      -735.2322
Durbin-Watson Statistic                0.0491

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  TREND                          8.22227337   0.03891157    211.30667  0.00000000
2.  Constant                     746.41639930   0.59843114   1247.28871  0.00000000

*
compute sigsq=%seesq
compute betas(1)(1)=%beta(1)-.5*%stderrs(1)
compute betas(1)(2)=%beta(1)+.5*%stderrs(1)
compute betas(2)(1)=%beta(2)-.5*%stderrs(2)
compute betas(2)(2)=%beta(2)+.5*%stderrs(2)
compute p=||.75,.10||
*
frml logl = f=%MSRegFVec(t),fpt=%MSProb(t,f),log(fpt)
@MSFilterInit
maximize(start=%(%MSRegInitVariances(),pstar=%msinit()),$
parmset=regparms+msparms,$
method=bfgs,pmethod=simplex,piters=2) logl gstart gend
[b]## SR10. Missing Values And/Or SMPL Options Leave No Usable Data Points[/quote][/b]
Problem could be with data?
TomDoan
Posts: 7732
Joined: Wed Nov 01, 2006 4:36 pm

Re: Camacho JEL 2011

Unread post by TomDoan »

The initial guesses are scrambled:

compute betas(1)(1)=%beta(1)-.5*%stderrs(1)
compute betas(2)(1)=%beta(1)+.5*%stderrs(1)
compute betas(1)(2)=%beta(2)-.5*%stderrs(2)
compute betas(2)(2)=%beta(2)+.5*%stderrs(2)
Tsaritsa
Posts: 15
Joined: Wed Feb 14, 2024 12:33 pm

Re: Camacho JEL 2011

Unread post by Tsaritsa »

It's working thank you Mr. Doan.
Post Reply