Stock Watson Example

Discussion of State Space and Dynamic Stochastic General Equilibrium Models
timduy
Posts: 50
Joined: Sun Jan 15, 2012 12:24 am

Stock Watson Example

Unread post by timduy »

Working through he Stock Watson state space example. The final chart:
SW2.pdf
(14.55 KiB) Downloaded 1065 times
does not match the original paper:
SW1.pdf
(92.07 KiB) Downloaded 1007 times
So I am wondering what I am missing? I typically see this indexes reported as nonstationary, which I thought the ACC code would accomplish.

Thanks!
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Stock Watson Example

Unread post by TomDoan »

Sorry. Which Stock-Watson state space example?
timduy
Posts: 50
Joined: Sun Jan 15, 2012 12:24 am

Re: Stock Watson Example

Unread post by timduy »

Yeah, I guess there are more than one.

Example 6.1 from the Handbook for State-Space models.
timduy
Posts: 50
Joined: Sun Jan 15, 2012 12:24 am

Re: Stock Watson Example

Unread post by timduy »

I think the answer is that Stock and Watson (91) impose the identity Ct-1 = delta(Ct-1) + Ct-2, which alters the transition equation. Example 6.1 in the state space manual does not include the same identity. At least I think that is what is going on.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Stock Watson Example

Unread post by TomDoan »

No. That's just incorporating into the model the accumulation of the changes which is done with the

set indicator 1959:2 * = xstates(t)(1)
acc indicator
graph(footer="Coincident Indicator, Filtered Version")
# indicator

in the RATS program. (Basically, they just build that into the state recursion).

Our program actually estimates the model as described in the paper. However, it appears that they then insert a drift (calculated from the means of the four input data series) into the accumulation of the C, which is why theirs trends and ours doesn't. (The first graph is non-stationary, just not drifting non-stationary). You can't freely estimate the drift in the indicator since that's unidentified when combined with the means of the four series, so they add what's a fairly arbitrary drift calculation. The non-drifting "cycle" is probably closer to what is done in most state-space models of the kind nowadays.
timduy
Posts: 50
Joined: Sun Jan 15, 2012 12:24 am

Re: Stock Watson Example

Unread post by timduy »

Now I see that - it is kind of buried in the paper.

Also, do you happen to know if you glue the transition equation together different from the paper? It looks like the error process in the paper are made independent of each other and the common growth rate by assuming the D(L) lag polynomial is a diagonal matrix, but in the program it looks like the same assumption is achieved by a different ordering of the variables. This appears to make it easier to set up the a matrix with:

compute %psubmat(1,2*i+1,2*i+1,t(d(i)))

Thanks!
timduy
Posts: 50
Joined: Sun Jan 15, 2012 12:24 am

Re: Stock Watson Example

Unread post by timduy »

One last question on this code - how does RATS know which parameters of the matrices are fixed and which are free? In other words, the phi's are initially set at 0 but change, whereas fixed components set at zero or one remain fixed. I am just not sure what is the different in the DECLARE functions that distinguishes the fixed from free parameters.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Stock Watson Example

Unread post by TomDoan »

timduy wrote:One last question on this code - how does RATS know which parameters of the matrices are fixed and which are free? In other words, the phi's are initially set at 0 but change, whereas fixed components set at zero or one remain fixed. I am just not sure what is the different in the DECLARE functions that distinguishes the fixed from free parameters.
Ordinarily, the ones that vary are distinguished by being FRML's rather than fixed matrices. In this case, because the formulas are complicated (because of the dependence upon the number of variables), it's determined by which matrices are adjusted as part of the %%DLMSETUP function:

Code: Select all

function %%DLMSetup
compute %psubmat(a,1,1,tr(phi))
do i=1,4
   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
Y is still done as a FRML[VECT] since it's time-varying. The other matrices are time-invariant, so can be computed just once per function evaluation.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Stock Watson Example

Unread post by TomDoan »

timduy wrote:Now I see that - it is kind of buried in the paper.

Also, do you happen to know if you glue the transition equation together different from the paper? It looks like the error process in the paper are made independent of each other and the common growth rate by assuming the D(L) lag polynomial is a diagonal matrix, but in the program it looks like the same assumption is achieved by a different ordering of the variables. This appears to make it easier to set up the a matrix with:

compute %psubmat(1,2*i+1,2*i+1,t(d(i)))

Thanks!
No. Their T matrix is the same as ours (other than the added rows/columns in theirs to handle the integration of the deltaC).
timduy
Posts: 50
Joined: Sun Jan 15, 2012 12:24 am

Re: Stock Watson Example

Unread post by timduy »

OK - so now I am bit confused. The transition equation is:
sw1.jpg
sw1.jpg (34.38 KiB) Viewed 15390 times
we ignore the last low and column of the transition matrix. Definitions of PHI* and D*:
sw2.jpg
sw2.jpg (44.05 KiB) Viewed 15390 times
k=2,p=2,n=4

The Di's are each a 4x4 diagonal matrix:
sw3.jpg
sw3.jpg (35.15 KiB) Viewed 15390 times
Note that D1 sits on top of a 4x4 identity matrix. So if I expand this out I get the 10x10 matrix:
sw4.jpg
sw4.jpg (31.34 KiB) Viewed 15390 times
which makes sense given the vectors C*t and U*t, which looks like [Ct Ct-1 U1t U2t U3t U4t U1t-1 U2t-1 U3t-1 U4t-1]. The transition matrix from example 6.1 is:
sw5.jpg
sw5.jpg (97.48 KiB) Viewed 15390 times
I am just not seeing that identity matrix or the diagonals matrices. But if I look at this example:
sw6.jpg
sw6.jpg (51.69 KiB) Viewed 15390 times
starts to make sense if I reorder the C*t and U*t vector as [Ct Ct-1 U1t U1t-1 U2t U2t-1 U3t U3t-1 U4t U4t-1]. I think other matrices are re-ordered accordingly.

So any idea of what where I am getting lost?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Stock Watson Example

Unread post by TomDoan »

Sorry. You're correct. They blocked the D's differently. RATS does a block diagonal with separate 2x2 matrices for each of the U components, so they're blocked by component. S&W blocks by lag. While the two are equivalent, the former is, I think, much easier. For instance, it's quite a bit simpler to vary the lag length of the components. In the S&W setup you would probably need to extend all polynomials out to the maximum lag (with zeros if necessary), or you would lose the structure.
timduy
Posts: 50
Joined: Sun Jan 15, 2012 12:24 am

Re: Stock Watson Example

Unread post by timduy »

Thank you - yes, your blocking makes the programming easier. Just making sure I can connect the example to the paper.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Stock Watson Example

Unread post by TomDoan »

I think you'll have better luck than I have trying to connect the Gauss code to the paper. It looks like what's posted is from a somewhat different approach.
Post Reply