Hamilton.prg with monthly data
Hamilton.prg with monthly data
Hi,
I tried to run the program with monthly data and the 12-month growth rates. Didn't go that well. Got this error message:
SUBITERATIONS LIMIT EXCEEDED. ESTIMATION POSSIBLY HAS STALLED OR MACHINE ROUNDOFF IS MAKING FURTHER PROGRESS DIFFICULT.
TRY HIGHER SUBITERATIONS LIMIT, TIGHTER CVCRIT, DIFFERENT SETTING FOR EXACTLINE OR ALPHA ON NLPAR.
RESTARTING ESTIMATION FROM LAST ESTIMATES OR DIFFERENT INITIAL GUESSES MIGHT ALSO WORK
Any suggestion where I can make these adjustments.
Thanx
Marcus
I tried to run the program with monthly data and the 12-month growth rates. Didn't go that well. Got this error message:
SUBITERATIONS LIMIT EXCEEDED. ESTIMATION POSSIBLY HAS STALLED OR MACHINE ROUNDOFF IS MAKING FURTHER PROGRESS DIFFICULT.
TRY HIGHER SUBITERATIONS LIMIT, TIGHTER CVCRIT, DIFFERENT SETTING FOR EXACTLINE OR ALPHA ON NLPAR.
RESTARTING ESTIMATION FROM LAST ESTIMATES OR DIFFERENT INITIAL GUESSES MIGHT ALSO WORK
Any suggestion where I can make these adjustments.
Thanx
Marcus
- Attachments
-
- eu27yptc.xls
- data
- (46.5 KiB) Downloaded 865 times
-
- euhamiltonq.PRG
- programme
- (1.19 KiB) Downloaded 1076 times
Re: Hamilton.prg with monthly data
I think the main problem is here:
set g = 100*log(prodtc/prodtc{12})
If you change to the month to month growth, the model seems to work fine, though with the rather uninteresting result that the only real "recession" is the whopper in 2009. (This seems clearly a case where three states are going to be necessary). The year over year growth smooths things so much that both states will have to be very persistent. You can probably get it to work OK if you switch to the logistic parameterization of the transitions, but I think the month to month growth is the proper way to model this.
set g = 100*log(prodtc/prodtc{12})
If you change to the month to month growth, the model seems to work fine, though with the rather uninteresting result that the only real "recession" is the whopper in 2009. (This seems clearly a case where three states are going to be necessary). The year over year growth smooths things so much that both states will have to be very persistent. You can probably get it to work OK if you switch to the logistic parameterization of the transitions, but I think the month to month growth is the proper way to model this.
Re: Hamilton.prg with monthly data
Ok, thanx Tom. Did the one-period growth to begin with but since it missed the downturns in 1992-93 and the millenium I tried the 12-month instead.
Any suggestions of how and where to try to introduce thhree states?
Any suggestions of how and where to try to introduce thhree states?
Re: Hamilton.prg with monthly data
Adjusting your code to allow for three states is quite simple:
Unfortunately, the recession in 2008 is so severe that your three "states" are the crash, the entrance/exit to the crash and the everything else. It's quite possible that that's a local mode, and that you can find a more natural breakdown into crash, ordinary recession, expansion, but that might take a bit of fussing with guess values. (Maybe fix the mu's and estimate everything else first).
Code: Select all
cal(m) 1990:1
open data eu27yptc.xls
data(format=xls,org=columns) 1990:1 2010:5
*
set g = 100*log(prodtc/prodtc{1})
graph(header="EU 27 industrial production growth")
# g
*
* Change this to states=3<<<<<<
*
@msvarsetup(lags=1,switch=m,states=3)
# g
compute gstart=1991:2,gend=2010:5
frml msvarf = log(%MSVARProb(t))
*
* Change this to use the logistic parameterization (theta rather than p) <<<<<
*
nonlin(parmset=msparms) theta
nonlin(parmset=varparms) mu phi sigma
@msvarinitial gstart gend
*
* Add the p=%mslogisticp(theta) to the start=%(..). (Also need the %(...,...)
* around the two calculations in start=.. <<<<<
*
maximize(parmset=varparms+msparms,$
start=%(p=%MSLOGISTICP(theta),pstar=%MSVARInit()),$
reject=%MSVARInitTransition()==0.0,$
pmethod=simplex,piters=5,method=bfgs) msvarf gstart gend
@msvarsmoothed gstart gend psmooth
set pcontract gstart gend = psmooth(t)(1)
set pcrash gstart gend = psmooth(t)(3)
*
* To create the shading marking the recessions, create a dummy series
* which is 1 when the recessq series is 1, and 0 otherwise. (recessq is
* 1 for NBER recessions and -1 for expansions).
*
*set contract = recessq==1
*
spgraph(vfields=2)
graph(header="Quarterly Growth Rate of EU27 Industrial production")
# g %regstart() %regend()
graph(style=polygon,header="Probability of Economy Being in Contraction")
# pcontract %regstart() %regend()
spgraph(done)Re: Hamilton.prg with monthly data
Thanx Tom,
I think the problem is the data in the sense that the recession is soo deep and totally dominates the relatively short (in terms of years) time period. I'll have a look at the mu's
I think the problem is the data in the sense that the recession is soo deep and totally dominates the relatively short (in terms of years) time period. I'll have a look at the mu's