Page 1 of 1

a question on business cycle synchronization

Posted: Tue May 14, 2013 3:33 am
by hardmann
Dear Tom:
I study business cycle synchornization between countries. I simply modify the code of Stock and Watson(1991), "A Probability Model of the Coincident Economic Indicators," for two countries.
I get gamma(1)=2.5>1, is it right? I exchange the order of tow series, gamma(1) is still more than 2.
first : i_cn i_xj

Code: Select all

open data gdp_cn_xj.txt
calendar(q) 1997
data(format=free,org=columns) 1997:1 2012:4 gdp_cn gdp_xj
*
set i_cn   = 100.0*log(gdp_cn/gdp_cn{1})
set i_xj   = 100.0*log(gdp_xj/gdp_xj{1})

*
* Parameters for index
*
dec vect phi(2)
compute phi=%zeros(2,1)
dec real sigmac
compute sigmac=1.0
*
* Parameters for the series. sigma is initialized based upon the sample
* means.
*
dec vect beta(2) gamma(2)
dec vect sigma(2)
dec vect[vect] d(2)
ewise d(i)=%zeros(2,1)
*
compute gamma=%const(1.0)
stats(noprint) i_cn
compute beta(1)=%mean,sigma(1)=%variance*.5
stats(noprint) i_xj
compute beta(2)=%mean,sigma(2)=%variance*.5

*
* Construct fixed parts of the A matrix
*
dec rect a(6,6)
compute ar2=||0.0,0.0|1.0,0.0||
compute a=ar2~\ar2~\ar2
*
* Construct the F matrix (always fixed)
*
dec rect f(6,3)
compute f2=||1.0|0.0||
compute f=f2~\f2~\f2
*
* Construct the fixed parts of the C matrix
*
dec rect c(6,2)
compute c=%zeros(2,2)~~(f2~\f2)
*
dec symm sw(3,3)
*
function %%DLMSetup
compute %psubmat(a,1,1,tr(phi))
do i=1,2
   compute %psubmat(a,2*i+1,2*i+1,tr(d(i)))
end do i
compute %psubmat(c,1,1,tr(gamma))
compute sw=%diag(sigmac~~sigma)
end %%DLMSetup
*

*
dec frml[vect] yf
frml yf = ||i_cn-beta(1),i_xj-beta(2) ||
*
* Estimate the parameters by maximum likelihood.
*
nonlin gamma d sigma phi
*
dlm(start=%%DLMSetup(),y=yf,sw=sw,c=c,a=a,f=f,$
   presample=ergodic,type=filter,$
   pmeth=simplex,piters=200,method=bfgs) 1997:2 * xstates


*
* As this is constructed, it somewhat arbitrarily fixes the pre-sample
* value of the indicator at zero.
*
set indicator_f 1997:2 * = xstates(t)(1)
acc indicator_f
graph(footer="Coincident Indicator, Filtered Version")
# indicator_f
*
dlm(start=%%DLMSetup(),y=yf,sw=sw,c=c,a=a,f=f,presample=ergodic,$
   type=smooth,print,title="smooth") 1997:2 * xstates


set indicator_m 1997:2 * = xstates(t)(1)
acc indicator_m
graph(footer="Coincident Indicator, Smoothed Version")
# indicator_m



second : i_xj i_cn

Code: Select all

open data gdp_cn_xj.txt
calendar(q) 1997
data(format=free,org=columns) 1997:1 2012:4 gdp_cn gdp_xj
*
set i_cn   = 100.0*log(gdp_cn/gdp_cn{1})
set i_xj   = 100.0*log(gdp_xj/gdp_xj{1})

*
* Parameters for index
*
dec vect phi(2)
compute phi=%zeros(2,1)
dec real sigmac
compute sigmac=1.0
*
* Parameters for the series. sigma is initialized based upon the sample
* means.
*
dec vect beta(2) gamma(2)
dec vect sigma(2)
dec vect[vect] d(2)
ewise d(i)=%zeros(2,1)
*
compute gamma=%const(1.0)
stats(noprint) i_cn
compute beta(2)=%mean,sigma(2)=%variance*.5
stats(noprint) i_xj
compute beta(1)=%mean,sigma(1)=%variance*.5

*
* Construct fixed parts of the A matrix
*
dec rect a(6,6)
compute ar2=||0.0,0.0|1.0,0.0||
compute a=ar2~\ar2~\ar2
*
* Construct the F matrix (always fixed)
*
dec rect f(6,3)
compute f2=||1.0|0.0||
compute f=f2~\f2~\f2
*
* Construct the fixed parts of the C matrix
*
dec rect c(6,2)
compute c=%zeros(2,2)~~(f2~\f2)
*
dec symm sw(3,3)
*
function %%DLMSetup
compute %psubmat(a,1,1,tr(phi))
do i=1,2
   compute %psubmat(a,2*i+1,2*i+1,tr(d(i)))
end do i
compute %psubmat(c,1,1,tr(gamma))
compute sw=%diag(sigmac~~sigma)
end %%DLMSetup
*
*
dec frml[vect] yf
frml yf = ||i_xj-beta(1),i_cn-beta(2) ||
*
* Estimate the parameters by maximum likelihood.
*
nonlin gamma d sigma phi
*
dlm(start=%%DLMSetup(),y=yf,sw=sw,c=c,a=a,f=f,$
   presample=ergodic,type=filter,$
   pmeth=simplex,piters=10,method=bfgs) 1997:2 * xstates
*

*

*
set indicator_f 1997:2 * = xstates(t)(1)
acc indicator_f
graph(footer="Coincident Indicator, Filtered Version")
# indicator_f
*
dlm(start=%%DLMSetup(),y=yf,sw=sw,c=c,a=a,f=f,presample=ergodic,$
   type=smooth) 1997:2 * xstates
set indicator_m 1997:2 * = xstates(t)(1)
acc indicator_m
graph(footer="Coincident Indicator, Smoothed Version")
# indicator_m

Re: a question on business cycle synchornization

Posted: Tue May 14, 2013 7:09 am
by TomDoan
hardmann wrote:Dear Tom:
I study business cycle synchornization between countries. I simply modify the code of Stock and Watson(1991), "A Probability Model of the Coincident Economic Indicators," for two countries.
I get gamma(1)=2.5>1, is it right? I exchange the order of tow series, gamma(1) is still more than 2.
Why would you think there's a problem? GAMMA's are loadings from the cycles onto the series. Since (for normalization) the variance of the shock to the cycle is standardized to one, the scale of gamma can be anything depending upon the values of your dependent variables.

Re: a question on business cycle synchornization

Posted: Tue May 14, 2013 9:55 am
by hardmann
Dear Tom:
Thanks. I am still confused. We estimate first model with order i_cn, i_xj,gamma(1) of i_cn=2.5>1, gamma(2) of i_xj<1, while second model with order i_xj, i_cn, gamma(1) of i_xj =2.7>1, gamma(2) of i_cn<1, which is right?

Best regard
Hardmann

Re: a question on business cycle synchornization

Posted: Tue May 14, 2013 11:04 am
by TomDoan
Probably neither. This isn't a model which is likely to handle well two series which, at least from graphical inspection don't seem to have any strong common cycle. You have an AR(2) on the unobserved cycle, plus AR(2) noise processes for each series. That's quite a bit of action for two series. If they were more closely linked, it might work, but probably not with the two that you have.