trend plus stationary cycle model

Discussion of State Space and Dynamic Stochastic General Equilibrium Models
joanm
Posts: 8
Joined: Mon Dec 15, 2014 3:04 am

trend plus stationary cycle model

Unread post by joanm »

Dear Tom,

I am trying to fit several state-space models to Catalan GDP (a Spanish autonomous community) to evaluate its cyclical position. To start with, I am trying to estimate Watson (1986) model, which is provided in Perron and Wada replication example (1999):

y(t)=trend(t)+cycle(t)
trend(t)=trend(t-1)+mu+n(t)
cycle(t)=alfa1*cycle(t-1)+alfa2*cycle(t-2)+w(t)
where n(t) and w(t) are the shocks.

I have tried different ways to deal with the hyperparameters (n(t) and w(t)), but so far the results are not reasonable. Maybe the initial guess values are not working for my sample. The main difference with Perron and Wada example is that I’m working with annual data (1955-2013).

I would really appreciate if someone could have a look at the results and the code.

Thanks,
Joan Mª
watson (1986).RPF
watson (1986) model
(2.35 KiB) Downloaded 1239 times
gdp_cat55.txt
gdp data 1955-2013
(1.16 KiB) Downloaded 1223 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: trend plus stationary cycle model

Unread post by TomDoan »

The main difference is that you're working with Catalan data which doesn't have the behavior of the US data. The trend in your data is much more variable, so the relatively fixed trend rate across the data range doesn't fit well. With the trend part of the model not really matching the trend in the data, the AR(2) cycle has to have a (near) unit root in order to give a good fit for the data.

Note, also, that there is nothing wrong with SN being negative. You're squaring the parameter, so the sign isn't identified. The parameters are "fine", but the trend-cycle decomposition isn't useful.
hardmann
Posts: 252
Joined: Sat Feb 26, 2011 9:49 pm

Re: trend plus stationary cycle model

Unread post by hardmann »

You can try Clark model, eg local trend model, varing trend rate.
joanm
Posts: 8
Joined: Mon Dec 15, 2014 3:04 am

Re: trend plus stationary cycle model

Unread post by joanm »

Thanks for both insightfuls comments. In fact, estimates with Clark (1987) model are much better for catalan economy.

y(t)=trend(t)+cycle(t)
trend(t)=trend(t-1)+mu(t)+n(t)
mu(t)= mu(t-1)+z(t)
cycle(t)=alfa1*cycle(t-1)+alfa2*cycle(t-2)+e(t)
where n(t), z(t) and e(t) are the shocks.

Nevertheless, it worked by accident :)

As an initial guess for z(t) variance I had a look at Fabiani and Mestre replication paper (2004), and I assigned -20 to the standard error in the shock z(t). I guess that this assumption makes sense when variances are specified in logs (exp(-20) is a very small number), but it’s not the case. In fact, when I assign a very small value (e.g. exp(-20)) the model does not work. If possible, I would like to know which is logic that makes the model work when my initial guess is -20.
Best regards
clark (1987).rpf
clark model 1987
(2 KiB) Downloaded 1214 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: trend plus stationary cycle model

Unread post by TomDoan »

Fabiani-Mestre uses log(variance) specification while you're using a standard deviations, so their -20 is a very small variance and your -20 is huge.

You wouldn't expect the variance of z(t) to be zero---if that were the case, then the original model would have worked (that gives a fixed trend rate). It's the variance of n(t) in the local trend model that quite often is (effectively) zero which is what you end up with here.

You might want to get the State-Space Course. It discusses estimation of local trend models, and also includes the Perron-Wada model.
joanm
Posts: 8
Joined: Mon Dec 15, 2014 3:04 am

Re: trend plus stationary cycle model

Unread post by joanm »

Thanks Tom. I got the State-Space Course last week. So I'm still assimilating the contents.

Regarding my initial guess on the variance of z(t) I finally took advantatge of @LocalDLMInit procedure, and results look pretty much the same.

@LocalDLMInit(trend=var_trend_rate) y 1955:01 2013:01
set var_sz = sqrt(var_trend_rate)
compute sz= 0.038392811212

best regards
hardmann
Posts: 252
Joined: Sat Feb 26, 2011 9:49 pm

Re: trend plus stationary cycle model

Unread post by hardmann »

comp sz = 0.01 * sn
joanm
Posts: 8
Joined: Mon Dec 15, 2014 3:04 am

Re: trend plus stationary cycle model

Unread post by joanm »

Hi!
I am trying to add more structure to the Clark model. In particular, I added and equation that relates employment cycle with output cycle, allowing for autocorrelation. The specification for the employment equations is quite similar to a work by Rafael Domenech (2013).

Observation equations
(1) GDP (t)=GDPtrend(t)+GDPcycle(t)
(2) Employment (t)=Employment trend(t)+Employment cycle(t)
(3) Employment (t) – beta* GDP (t) – delta*( Employment (t-1)-beta*GDP (t-1)) = -beta*GDPtrend(t)+delta*beta *GDPtrend(t-1)+ Employment trend(t)-delta* Employment trend(t-1)+e_ok (t)

This last equation reorders the following expression (on the left hand side we have observed components whereas on the right we have unobserved components):
(3) Employment cycle (t) = delta* Employment cycle (t-1)+beta*GDP cycle(t)-delta*beta* GDP cycle(t-1)

State equations
(4) GDPtrend(t)=GDPtrend(t-1)+alfa(t)+e_yp(t)
(5) alfa(t)= alfa(t-1)+e_alfa(t)
(6) GDPcycle(t)=ph1*GDPcycle(t-1)+ph2*GDPcycle(t-2)+e_yc(t)
(7) Employment trend(t)=Employment trend(t-1)+e_op (t)

In this state space representation GDPcycle (t), Employment cycle (t), e_ok (t), e_yp (t), e_alfa (t) , e_yc(t), e_op (t) are working as shocks.

I have tried different specifications, but I do not get reasonable results. For instance,
I would expect that beta and delta would move around the estimates obtained with the hodrick and Prescott filter (beta=0.56 and delta=0.76). In fact, I would also expect that delta < 1. The results do not fit with this expectations. Beta is 0.00 and delta 1.05. In addition, the parameters for AR(2) GDP cycle do not look appropriate (ph1=0.82 and ph2=0.03). And I have some autocorrelation problems, according to Ljung-Box Q-Test.

I would appreciate, if possible, some comments to improve my approach. I don’t know if I am proposing a too ambitious model for my data (1955-2013, annual) or if there are some parts which should be improved (initial values, model structure …).

Best regards,
data_cat55.txt
(1.73 KiB) Downloaded 1197 times
clark extended model.rpf
(2.82 KiB) Downloaded 1171 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: trend plus stationary cycle model

Unread post by TomDoan »

I'm a bit confused by your observation equations. Don't you have only two observables?
joanm
Posts: 8
Joined: Mon Dec 15, 2014 3:04 am

Re: trend plus stationary cycle model

Unread post by joanm »

You are right, I have only two observables (GDP and Employment). However, it seems to be equivalent to include equation (3) in the observation equations (as I do) or to include it in the state equations, although that would entail some changes in the state space representation.

I don’t know if this specification may generate some trouble for RATS. That is, adding a state equation as an observation equation. As I commented above, the empirical strategy for equation (3) is to reorder the observed components on the left hand side and the unobserved components on the right.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: trend plus stationary cycle model

Unread post by TomDoan »

joanm wrote:You are right, I have only two observables (GDP and Employment). However, it seems to be equivalent to include equation (3) in the observation equations (as I do) or to include it in the state equations, although that would entail some changes in the state space representation.

I don’t know if this specification may generate some trouble for RATS. That is, adding a state equation as an observation equation. As I commented above, the empirical strategy for equation (3) is to reorder the observed components on the left hand side and the unobserved components on the right.
If you have two observables, you can have (at most) two observation equations. Otherwise, your model has an unmodeled singularity among the shocks. Basically, as written, you're doing a complicated version of

x=ex
y=ey
x-y=ez

with ex, ey, ez independent. That, of course, is impossible since ez=ex-ey. By putting the definition of employment_cycle into the states (which requires substituting in the definition of current gdp_cycle), you're putting that relationship explicitly into the model.
joanm
Posts: 8
Joined: Mon Dec 15, 2014 3:04 am

Re: trend plus stationary cycle model

Unread post by joanm »

Thanks for your comment Tom! That makes sense.

These days I rearranged the state space representation but I keep having big troubles, in particular with employment equations. I would not expect both variances of these error terms (equations 6 and 7 below)to be non significant. At this point, I would appreciate some guide to progress in my research (initial values, model structure, ...). I tried different specifications and different estimation samples but I had no luck :(

Best regards,
Pd: I attach the results and the new state space representation, as well as the data and the program to replicate the results.

The new state space representations is …

Observation equations
(1) GDP (t)=GDPtrend(t)+GDPcycle(t)
(2) Employment (t)=Employment trend(t)+Employment cycle(t)

State equations
(3) GDPtrend(t)=GDPtrend(t-1)+alfa(t)+e_yp(t)
(4) alfa(t)= alfa(t-1)+e_alfa(t)
(5) GDPcycle(t)=ph1*GDPcycle(t-1)+ph2*GDPcycle(t-2)+e_yc(t)
(6) Employment trend(t)=Employment trend(t-1)+e_ep (t)
(7) Employment cycle (t) = delta* Employment cycle (t-1)+beta*GDP cycle(t)-delta*beta* GDP cycle(t-1)+e_ec (t) ;

then, if we substitute (5) in (7) we can re-express (7) as
(7) Employment cycle (t)= delta* Employment cycle (t-1)+beta*ph1* GDP cycle(t-1)+ beta*ph2* GDP cycle(t-2) -delta*beta* GDP cycle(t-1)+e_ec (t)+beta*e_yc(t)

In this state space representation e_yp (t), e_alfa (t) , e_yc(t), e_ep (t) and e_ec (t) are working as shocks.

Results of the Kalman filter estimation are:

DLM - Estimation by BFGS
Convergence in 40 Iterations. Final criterion was 0.0000000 <= 0.0000100
Annual Data From 1955:01 To 2013:01
Usable Observations 59
Rank of Observables 85
Log Likelihood 224.1293

Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. BETA 1.247387495 0.167029877 7.46805 0.00000000
2. DELTA 0.973831435 0.000847993 1148.39592 0.00000000
3. PH1 1.800501628 0.104092010 17.29721 0.00000000
4. PH2 -0.811257221 0.107199705 -7.56772 0.00000000
5. SYP 0.008835354 0.002252105 3.92315 0.00008740
6. SALFA 0.005255696 0.001816051 2.89403 0.00380338
7. SYC 0.015550926 0.002222166 6.99810 0.00000000
8. SEP 0.004613138 0.006500955 0.70961 0.47794648
9. SEC 0.000749936 0.024545474 0.03055 0.97562608
Attachments
data_cat55.txt
(1.73 KiB) Downloaded 1194 times
clark extended model 2.rpf
(3.24 KiB) Downloaded 1228 times
Last edited by joanm on Mon Feb 09, 2015 12:38 pm, edited 1 time in total.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: trend plus stationary cycle model

Unread post by TomDoan »

That looks perfectly reasonable to me. You have three shocks to the GDP equation, and one (somewhat given the t-stat) to employment, but the GDP cycle shock also hits the employment. Just from looking at the data, employment does seem to cycle similarly to GDP, but the changes are more exaggerated, which is reflected in the beta>1. Note that because it's a joint estimation, the GDP cycle will end up getting chosen to help fit both series. The only change which suggests itself is to put some restrictions on the trend (such as pegging relative variances) to prevent some of the short-term wobbles which can allow the one cycle to fit both series.
joanm
Posts: 8
Joined: Mon Dec 15, 2014 3:04 am

Re: trend plus stationary cycle model

Unread post by joanm »

Thanks a lot Tom. I'll think how to implement this restriction. I guess that one way would be to concentrate out the variance.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: trend plus stationary cycle model

Unread post by TomDoan »

No. That doesn't fundamentally change the model; it just can improve the properties of the optimizer. If you think about how an H-P filter works, it doesn't have the eyp shock, and the ratio between ealpha and eyc is fixed, so instead of three freely estimated variances for the GDP trend, there is really just one. Now that's far too restrictive for the GDP trend in your case, and it's also rather hard to make that final ratio work when you have an AR(2) cycle rather than "white noise" in the H-P model. (The variance of an AR(2) cycle depends upon the phi coefficients). I'm not really sure what an appropriate fix is in your case, but it seems clear that three completely free parameters in the GDP equations is probably one too many.
Post Reply