Morley, Nelson and Zivot(2003)
Morley, Nelson and Zivot(2003)
This is a replication file for Morley, Nelson & Zivot(2003), "Why Are the Beveridge-Nelson and Unobserved-Components Decompositions of GDP So Different?," The Review of Economics and Statistics, vol. 85(2), 235-243. This examines the implications of allowing for correlation in the shocks in a standard unobserved components model. (UC models generally assume uncorrelated shocks). Related work is Perron and Wada(2009), which allows for a break in the trend rate in the UC model.
Morley Nelson Zivot (2003) Why Are the
Dear Tom:
I always study winrats by replicating examples, so I encounter lots problem.
Morley Nelson Zivot (2003) considered that BN and UC are identical if relaxing the correlation between trend and cycle innovations for U.S. real GDP 1947Q1--1998Q2. Of course, the results of the UC-0(zero correlation) and UC-UR ( correlation ) are different.
Perron & Wada(2009) re-examined MNZ works, and argued that there is a break around 1973Q1 of GDP, once account for it, all methods yield the same results.
I still want to prove which is the best model among UC-0, UC-UR and BN models without break. For avoid break, I split that sample into two subsample 1947Q1-1973Q1 and 1973Q1-1998Q2. However, with first subsample, the series follows ARMA(2,2) process, but UC-0 and UC-UR cannot converge, BN is ok. With second subsample, the series follows AR(1), UC-0 and UC-UR can converge but both their sn and sne are zero.
Why do subsample go wrong due to smaller sample?
Best regard
Hardmann
I always study winrats by replicating examples, so I encounter lots problem.
Morley Nelson Zivot (2003) considered that BN and UC are identical if relaxing the correlation between trend and cycle innovations for U.S. real GDP 1947Q1--1998Q2. Of course, the results of the UC-0(zero correlation) and UC-UR ( correlation ) are different.
Perron & Wada(2009) re-examined MNZ works, and argued that there is a break around 1973Q1 of GDP, once account for it, all methods yield the same results.
I still want to prove which is the best model among UC-0, UC-UR and BN models without break. For avoid break, I split that sample into two subsample 1947Q1-1973Q1 and 1973Q1-1998Q2. However, with first subsample, the series follows ARMA(2,2) process, but UC-0 and UC-UR cannot converge, BN is ok. With second subsample, the series follows AR(1), UC-0 and UC-UR can converge but both their sn and sne are zero.
Why do subsample go wrong due to smaller sample?
Best regard
Hardmann
Re: Morley Nelson Zivot (2003) Why Are the
Models don't always work. It is quite possible that even the Perron and Wada "fix" doesn't really adequately describe the difference between the data pre- and post-1973.
Re: Morley Nelson Zivot (2003) Why Are the
IF I use UC-0 and UC-UR models to estimate the U.S. GDP 1947Q1-1973Q1. How I can deal wuth disconverge problem. I had tried pmothod=simple or genetic.
Code: Select all
open data lgdp.txt
calendar(q) 1947
data(format=free,org=columns) 1947:01 1973:01 lgdp
*
* Everything is run on 100*log data
*
set lgdp = 100.0*lgdp
*
@NBERCycles(down=recession)
*
* UC-0 decomposition with AR(2) cycle, fixed trend rate.
*
nonlin mu sn ph1 ph2 se
*
dec frml[rect] af
dec frml[vect] zf
dec frml[symm] swf
*
frml af = ||1.0,0.0,0.0|$
0.0,ph1,ph2|$
0.0,1.0,0.0||
frml zf = ||mu,0.0,0.0||
frml swf = %diag(||sn^2,se^2||)
*
compute [vect] c=||1.0,1.0,0.0||
compute [rect] f=%identity(2)~~%zeros(1,2)
*
* Get initial guess values
*
filter(type=hp) lgdp / gdp_hp
set gap_hp = lgdp - gdp_hp
linreg gap_hp
# gap_hp{1 2}
compute ph1=%beta(1),ph2=%beta(2),se=sqrt(%seesq)
set trend = t
linreg gdp_hp
# constant trend
compute mu=%beta(2)
compute sn=sqrt(.1*%seesq)
*
* In order to be comparable with the BN decomposition (which is a
* "filtered" calculation), this uses filtered rather than smoothed
* estimates of the components.
*
dlm(presample=ergodic,a=af,z=zf,sw=swf,c=c,f=f,y=lgdp,pmethod=simplex,piter=5,method=bfgs,type=filter) / states0
*
set cycle0 = states0(t)(2)
set trend0 = states0(t)(1)
*
graph(footer="Figure 1 UC-0 Cycle, US Real GDP. Percent Deviation from Trend",$
shaded=recession)
# cycle0
*
* Estimation of unrestricted ARIMA(2,1,2) model
*
boxjenk(maxl,ar=2,diffs=1,ma=2,const) lgdp
*
* Generation of BN trend implied by that. Compute the persistence
* measure of the ARMA model (sum of MAR coefficients).
*
summarize (1+%beta(4)+%beta(5))/(1-%beta(2)-%beta(3))
*
* Compute accumulation of psi(1)*residuals + trend rate
*
set incrbn = %sumlc*%resids+%beta(1)
acc incrbn / trendbn
*
* Normalize value of trend based upon starting value of data. Compute
* cycle as residual.
*
set trendbn = trendbn+lgdp(1947:1)
set cyclebn = lgdp-trendbn
graph(footer="Figure 2 Beveridge-Nelson Cycle, US Real GDP",$
shaded=recession)
# cyclebn
*
* Unrestricted UC model, allowing for correlation between the shocks
*
compute rhone=0.0
nonlin(parmset=fullset) mu sn ph1 ph2 se rhone
*
frml zf = ||mu,0.0,0.0||
frml swf = ||sn^2|rhone*sn*se,se^2||
dlm(a=af,z=zf,sw=swf,c=c,f=f,y=lgdp,$
presample=ergodic,parmset=fullset,method=bfgs,type=filter) / statesur
set cycleur = statesur(t)(2)
set trendur = statesur(t)(1)
*
* Save the log likelihood and estimated coefficients for future use
*
compute baselogl=%logl,baseparms=%parmspeek(fullset)
*
graph(footer="Figure 3 UC-UR Cycle, US Real GDP",$
shaded=recession)
# cycleur
Re: Morley Nelson Zivot (2003) Why Are the
Add the option CONDITION=2 to the DLM instructions. The AR(2) cycle can be near unit root at which there is a discontinuity in the likelihood function. By conditioning on the first 2 data points (one comes with the forced unit root, the other for the possibility of the second one), you eliminate the term that causes the discontinuity.
Re: Morley Nelson Zivot (2003) Why Are the
problem resolved with added condition=2 option
MZN(2003)
Dear Tom;
Recently,Dungey et al.(2014) "Trend in cycle or cycle in trend? new structural identifications for unobserved-components models of u.s. real gdp"macroeconomic dynamics. Thier mode is based on MZN(2003), which extend variance-cpvariance matrix of the innovations,
R= ||sn,r12|
r21,se||
They estimate the r12 and r12, respectively. I wonder whether the r is symmetry. If not, how to specify r12,
dec frml[rect] wf
wf= ||sn^2,r12*sn*se|0,se^2||
Best Regard
Hardmann
Recently,Dungey et al.(2014) "Trend in cycle or cycle in trend? new structural identifications for unobserved-components models of u.s. real gdp"macroeconomic dynamics. Thier mode is based on MZN(2003), which extend variance-cpvariance matrix of the innovations,
R= ||sn,r12|
r21,se||
They estimate the r12 and r12, respectively. I wonder whether the r is symmetry. If not, how to specify r12,
dec frml[rect] wf
wf= ||sn^2,r12*sn*se|0,se^2||
Best Regard
Hardmann
Re: MZN(2003)
You're misreading their formula (I assume you're talking about (7)). They are modeling the state-space shock as (in RATS terminology) F x w, where F is the 3 x 2 matrix and w is a two-variable N(0,I). So with RATS, that would have
nonlin phi1 phi2 sigmaeta sigmanu r12 r21
*
dec frml[rect] af
frml af = ||1.0,0.0,0.0|0.0,phi1,phi2|0.0,1.0,0.0||
dec frml[rect] ff
frml ff = ||sigmaeta,r12|r21,sigmanu|0.0,0.0||
*
compute ... (guess values for parameters)
*
dlm(c=||1.0,1.0,0.0||,a=af,f=ff,sw=%identity(2),other options)
nonlin phi1 phi2 sigmaeta sigmanu r12 r21
*
dec frml[rect] af
frml af = ||1.0,0.0,0.0|0.0,phi1,phi2|0.0,1.0,0.0||
dec frml[rect] ff
frml ff = ||sigmaeta,r12|r21,sigmanu|0.0,0.0||
*
compute ... (guess values for parameters)
*
dlm(c=||1.0,1.0,0.0||,a=af,f=ff,sw=%identity(2),other options)
Re: Morley, Nelson and Zivot(2003)
Dear Tom;
I sepcify it accroding to your advice. The result is same of UCUR of MZN. However, I confused much. Dungey et al.(2014) say that the four elements in R are not identified. But, WinRats estimated these fully. Is it meaningful that thire specified R?
I have a little about state space mothed, can not understand complicted ones. Please Tom explains further or recommends reference.
Best regard
hardmann
I sepcify it accroding to your advice. The result is same of UCUR of MZN. However, I confused much. Dungey et al.(2014) say that the four elements in R are not identified. But, WinRats estimated these fully. Is it meaningful that thire specified R?
I have a little about state space mothed, can not understand complicted ones. Please Tom explains further or recommends reference.
Best regard
hardmann
Re: Morley, Nelson and Zivot(2003)
They aren't identified. You have to add restrictions to make them identified. However, not being identified in this case means that there are many combinations of the four parameters in the F formula that give the same log likelihood. DLM ends up picking one. A different set of guess values would probably result in a different set of values. Isn't the point of the paper that there is one model which encompasses several other models, just with different restrictions?hardmann wrote:Dear Tom;
I sepcify it accroding to your advice. The result is same of UCUR of MZN. However, I confused much. Dungey et al.(2014) say that the four elements in R are not identified. But, WinRats estimated these fully. Is it meaningful that thire specified R?
I have a little about state space mothed, can not understand complicted ones. Please Tom explains further or recommends reference.
Best regard
hardmann
Re: Morley, Nelson and Zivot(2003)
Dear Tom:
I have two question again. I found the estimated result is dependent on the initial guess value, when I change the initial variance from 0.1 to 0.5,
eg. compute sn=sqrt(.5*%seesq), the estimation is not convergence. If we estimation other data, how to specify the initial guess value?
When I take the UC0 model as benchmark, we add the correlation between the inovations of trend and cycle, the estimation is better off, or add the break of level of trend, alike perron and wanda(2009), the estimation better off. Surprisily, when adding the correlation and the break, We get same the trend and cycle with UC0, I cannot explaine it.
Best Regard
Hardmann
I have two question again. I found the estimated result is dependent on the initial guess value, when I change the initial variance from 0.1 to 0.5,
When I take the UC0 model as benchmark, we add the correlation between the inovations of trend and cycle, the estimation is better off, or add the break of level of trend, alike perron and wanda(2009), the estimation better off. Surprisily, when adding the correlation and the break, We get same the trend and cycle with UC0, I cannot explaine it.
Code: Select all
***************** UCUC with Break
*UCUR adding a break
nonlin mu d2 ph1 ph2 sn se rhone
set d1973 = t>1973:1
frml zf = ||mu+d2*d1973,0.0,0.0||
frml swf = ||sn^2|rhone*sn*se,se^2||
dlm(a=af,z=zf,sw=swf,c=c,f=f,y=lgdp,$
presample=ergodic,method=bfgs,type=filter) / statesur
Disp "UCUR with Break"
@regcrits
set cycleur = statesur(t)(2)
set trendur = statesur(t)(1)
*
set cycleur_bk = states0(t)(2)Hardmann
Re: Morley, Nelson and Zivot(2003)
Could you post a whole program? This is missing so many pieces that it's not clear what's going on with it.
Re: Morley, Nelson and Zivot(2003)
Code: Select all
* Replication file for Morley, Nelson & Zivot(2003), "Why Are the
* Beveridge-Nelson and Unobserved-Components Decompositions of GDP So
* Different?," The Review of Economics and Statistics, vol. 85(2), pages
* 235-243.
*
open data lgdp.txt
calendar(q) 1947
data(format=free,org=columns) 1947:01 1998:02 lgdp
*
* Everything is run on 100*log data
*
set lgdp = 100.0*lgdp
*
@NBERCycles(down=recession)
************ UC-0 decomposition with AR(2) cycle, fixed trend rate.
*
nonlin mu ph1 ph2 sn se
*
dec frml[rect] af
dec frml[vect] zf
dec frml[symm] swf
*
frml af = ||1.0,0.0,0.0|$
0.0,ph1,ph2|$
0.0,1.0,0.0||
frml zf = ||mu,0.0,0.0||
frml swf = %diag(||sn^2,se^2||)
*
compute [vect] c=||1.0,1.0,0.0||
compute [rect] f=%identity(2)~~%zeros(1,2)
*
* Get initial guess values
*
filter(type=hp) lgdp / gdp_hp
set gap_hp = lgdp - gdp_hp
linreg gap_hp
# gap_hp{1 2}
compute ph1=%beta(1),ph2=%beta(2),se=sqrt(%seesq)
set trend = t
linreg gdp_hp
# constant trend
compute mu=%beta(2)
compute sn=sqrt(.1*%seesq)
*
* In order to be comparable with the BN decomposition (which is a
* "filtered" calculation), this uses filtered rather than smoothed
* estimates of the components.
*
dlm(presample=ergodic,a=af,z=zf,sw=swf,c=c,f=f,y=lgdp,method=bfgs,type=filter) / states0
Disp "UC0 "
@regcrits
set cycle0 = states0(t)(2)
set trend0 = states0(t)(1)
*
graph(footer="Figure 1 UC-0 Cycle, US Real GDP. Percent Deviation from Trend",$
shaded=recession)
# cycle0
*
**** UCUR
* Unrestricted UC model, allowing for correlation between the shocks
*
compute rhone=0.0
nonlin(parmset=fullset) mu ph1 ph2 sn se rhone
*
frml zf = ||mu,0.0,0.0||
frml swf = ||sn^2|rhone*sn*se,se^2||
dlm(a=af,z=zf,sw=swf,c=c,f=f,y=lgdp,$
presample=ergodic,parmset=fullset,method=bfgs,type=filter) / statesur
Disp "UCUR "
@regcrits
set cycleur = statesur(t)(2)
set trendur = statesur(t)(1)
*
* Save the log likelihood and estimated coefficients for future use
*
compute baselogl=%logl,baseparms=%parmspeek(fullset)
*
graph(footer="Figure 3 UC-UR Cycle, US Real GDP",$
shaded=recession)
# cycleur
*
***************** UCUC with Break
*UCUR add break
nonlin mu d2 ph1 ph2 sn se rhone
set d1973 = t>1973:1
frml zf = ||mu+d2*d1973,0.0,0.0||
frml swf = ||sn^2|rhone*sn*se,se^2||
dlm(a=af,z=zf,sw=swf,c=c,f=f,y=lgdp,$
presample=ergodic,method=bfgs,type=filter) / statesur
Disp "UCUR with Break"
@regcrits
set cycleur = statesur(t)(2)
set trendur = statesur(t)(1)
*
set cycleur_bk = states0(t)(2)
***************** UC0 with Break
*UC0 add break
nonlin mu d ph1 ph2 sn se
set d1973 = t>1973:1
frml zf = ||mu+d*d1973,0.0,0.0||
dlm(presample=ergodic,a=af,z=zf,sw=swf,c=c,f=f,y=lgdp,method=bfgs,type=filter) / states0
Disp "UC0 with Break"
@regcrits
set cycle0_bk = states0(t)(2)
set trend0_bk = states0(t)(1)
graph(key=below) 4
# cycle0
# cycleur
# cycle0_bk
# cycleur_bk
Re: Morley, Nelson and Zivot(2003)
dear Tom:
When I use the code of MNZ to estimate the newly data of US quaterly real gdp (from https://fred.stlouisfed.org/data/GDPC1.txt). I found the reslut is up to the guess initial value of sn. eg, compute sn=sqrt(0.1*%seesq). I try different value, 1, 0.1, 0.5,0.01,and so on, then get different results, all of them is wrong.
how can i guess it. I think there is robust method.
Best Regard
Hardmann
When I use the code of MNZ to estimate the newly data of US quaterly real gdp (from https://fred.stlouisfed.org/data/GDPC1.txt). I found the reslut is up to the guess initial value of sn. eg, compute sn=sqrt(0.1*%seesq). I try different value, 1, 0.1, 0.5,0.01,and so on, then get different results, all of them is wrong.
how can i guess it. I think there is robust method.
Best Regard
Hardmann
Code: Select all
open data us_gdp.xls
calendar(q) 1947:1
data(format=xls,org=columns) 1947:01 2019:03 gdp
*
* Everything is run on 100*log data
*
set lgdp = 100.0* log(gdp)
*
@NBERCycles(down=recession)
************ UC-0 decomposition with AR(2) cycle, fixed trend rate.
*
nonlin mu ph1 ph2 sn se
*
dec frml[rect] af
dec frml[vect] zf
dec frml[symm] swf
*
frml af = ||1.0,0.0,0.0|$
0.0,ph1,ph2|$
0.0,1.0,0.0||
frml zf = ||mu,0.0,0.0||
frml swf = %diag(||sn^2,se^2||)
*
compute [vect] c=||1.0,1.0,0.0||
compute [rect] f=%identity(2)~~%zeros(1,2)
*
* Get initial guess values
*
filter(type=hp) lgdp / gdp_hp
set gap_hp = lgdp - gdp_hp
linreg gap_hp
# gap_hp{1 2}
compute ph1=%beta(1),ph2=%beta(2),se=sqrt(%seesq)
set trend = t
linreg gdp_hp
# constant trend
compute mu=%beta(2)
compute sn=sqrt(0.01*%seesq)
*
*
dlm(presample=ergodic,a=af,z=zf,sw=swf,c=c,f=f,y=lgdp,method=bfgs,type=smooth) / states0
Disp "UC0 logl= " %logl
@regcrits
set cycle0 = states0(t)(2)
set trend0 = states0(t)(1)
*
dlm(presample=ergodic,a=af,z=zf,sw=swf,c=c,f=f,y=lgdp,method=bfgs,type=filter) / states0
Disp "UC0 logl= " %logl
@regcrits
set cycle0 = states0(t)(2)
set trend0 = states0(t)(1)
graph(footer="Fig1 UC-0 Cycle, US Real GDP. Percent Deviation from Trend",$
shaded=recession)
# cycle0- Attachments
-
- us_gdp.xls
- (45.5 KiB) Downloaded 708 times