Page 1 of 1
State space representation
Posted: Mon May 24, 2010 2:42 am
by asemota omos
Hello,
I am using state space techniques for the 1st time.. could somebody tell me the components of A, C, Y, when you have a model of this form where only one of the parameter is time variate
Y = B0+B1X1+B2X2+B3Yt-1+ et
B1t = B1,t-1 + Vt.
Thanks
Re: State space representation
Posted: Mon May 24, 2010 11:16 am
by TomDoan
The quickest way to handle this is to shift the time-invariant coefficients into the observable, so you would have
Y=Y-(B0+B2*X2+B3*Y{1})
You would then just have one state (B1) with A=1.0. Since that's the default, you can even skip it. C would be X1. Then you would have the two variances, for the observation equation and the change in B1.
An alternative would be to have all the coefficients in the state equation but to have zero transition variances for all but the one. The advantage there is that you could more easily change the model to allow for time variation on other coefficients. (For instance, if X1 doesn't have mean zero, it's unlikely that the intercept can be fixed).
With that, Y would just be Y, C would be ||1.0,X1,X2,Y{1}||, A would be the 4x4 identity (again, the default), you would want an F matrix which is ||0.0|1.0|0.0|0.0||, and again, the one variance for the transition and one for the observation.
Re: State space representation
Posted: Mon May 24, 2010 9:20 pm
by asemota omos
Hello Tom,
Big thanks to you.. pls, i have two questions concerning the two specifications you gave..
first, using the quickest type as u said, where Y=Y-(B0+B2*X2+B3*Y{1}).. how would i handle the unknown parameters B0, B2 and B3 that have been included in the observable Y ? will they be included in the NOnlin parameter or what will happen to the parameters?
secondly, the alternative methods seems to be more advantageous due to its flexibility.. You said, "With that, Y would just be Y, C would be ||1.0,X1,X2,Y{1}||, A would be the 4x4 identity (again, the default), you would want an F matrix which is ||0.0|1.0|0.0|0.0||, and again, the one variance for the transition and one for the observation" . How will i specify the Nonlin.. ( Nonlin sigmaepsilon sigmaeta) or Nonlin sigmaepsilon sigmaeta sigmapsi sigmazeta ? Also, if i decided to allow each coeff to be time variate, how would i extract each of the state vector from the kalman filter and smoother output?
set B0 = %SCALAR(xstates(1)), set B1 = %scalar(xstates(2)) and so on.. will this be ok??
Re: State space representation
Posted: Tue May 25, 2010 8:18 am
by TomDoan
asemota omos wrote:Hello Tom,
Big thanks to you.. pls, i have two questions concerning the two specifications you gave..
first, using the quickest type as u said, where Y=Y-(B0+B2*X2+B3*Y{1}).. how would i handle the unknown parameters B0, B2 and B3 that have been included in the observable Y ? will they be included in the NOnlin parameter or what will happen to the parameters?
Yes. With that setup, B0, B2 and B3 are included in the NONLIN.
asemota omos wrote:
secondly, the alternative methods seems to be more advantageous due to its flexibility.. You said, "With that, Y would just be Y, C would be ||1.0,X1,X2,Y{1}||, A would be the 4x4 identity (again, the default), you would want an F matrix which is ||0.0|1.0|0.0|0.0||, and again, the one variance for the transition and one for the observation" . How will i specify the Nonlin.. ( Nonlin sigmaepsilon sigmaeta) or Nonlin sigmaepsilon sigmaeta sigmapsi sigmazeta ?
You would just have two variances, so the NONLIN would have two, and you would use the options SV=sigmaepsilon and SW=sigmaeta.
asemota omos wrote:
Also, if i decided to allow each coeff to be time variate, how would i extract each of the state vector from the kalman filter and smoother output?
set B0 = %SCALAR(xstates(1)), set B1 = %scalar(xstates(2)) and so on.. will this be ok??
No. xstates(t) is the state vector at time t and you want to extract the 1st, 2nd, etc. components from those. It would be
set b0 = xstates(t)(1)
set b1 = xstates(t)(2)
...
The %SCALAR takes the first element, so you can use
set b0 = %scalar(xstates)
to get the first element, but %scalar won't help with any of the others.
Re: State space representation
Posted: Thu May 27, 2010 5:09 am
by asemota omos
Hi Tom,
Thanks alot..
You have really been of great help to me.. meanwhile, i just wanna clarify these from you.
first, you said [Yes. With that setup, B0, B2 and B3 are included in the NONLIN].. how do i specify the initial guess values for these parameters? is it ok to use linreg to first get their initial values?
secondly. you said, "you would want an F matrix which is ||0.0|1.0|0.0|0.0||" so,its not always N by N?
Thank you very much
Re: State space representation
Posted: Thu May 27, 2010 8:43 am
by TomDoan
asemota omos wrote:Hi Tom,
Thanks alot..
You have really been of great help to me.. meanwhile, i just wanna clarify these from you.
first, you said [Yes. With that setup, B0, B2 and B3 are included in the NONLIN].. how do i specify the initial guess values for these parameters? is it ok to use linreg to first get their initial values?
Yes. Those should work fine.
asemota omos wrote:
secondly. you said, "you would want an F matrix which is ||0.0|1.0|0.0|0.0||" so,its not always N by N?
Thank you very much
That's correct. The state disturbance takes the form F(t)w(t) where F can have fewer than N columns and w can have fewer than N components. It's a more convenient way to deal with the shocks than using a full size w(t) with a lot of zeros in its covariance matrix.
Re: State space representation
Posted: Thu May 27, 2010 8:29 pm
by asemota omos
Hi Tom,
what could i have done without you? Thanks alot..
I will let you know the outcome of my estimation when i finish.
cheers
State space representation help
Posted: Fri Jan 06, 2012 1:33 pm
by Henrique Andrade
Dear RATS Community,
I'm trying to learn state-space modelling and I don't know how to represent my model in the state-space representation. The aim of my model is to decompose the government balance into two components: rule and discretion.
Please take a look at my model:
FP(t) = dR(t) + w1(t)
dR(t) = b(t)dgap(t)+ w2(t)
b(t) = b(t-1)+ w3(t)
Where:
FP represents the fiscal policy (measured as changes in the government balance)
R represents the automatic component of the fiscal policy that responds to changes in the output gap (dgap)
w1, w2, and w3 represent the errors
Any help will be appreciated.
Best regards,
Re: State space representation help
Posted: Sat Jan 07, 2012 8:22 am
by TomDoan
Henrique Andrade wrote:Dear RATS Community,
I'm trying to learn state-space modelling and I don't know how to represent my model in the state-space representation. The aim of my model is to decompose the government balance into two components: rule and discretion.
Please take a look at my model:
FP(t) = dR(t) + w1(t)
dR(t) = b(t)dgap(t)+ w2(t)
b(t) = b(t-1)+ w3(t)
Where:
FP represents the fiscal policy (measured as changes in the government balance)
R represents the automatic component of the fiscal policy that responds to changes in the output gap (dgap)
w1, w2, and w3 represent the errors
Any help will be appreciated.
Best regards,
You can't separate the error in DR from the one in the FP equation. Combine the first two equations to make the measurement equation:
FP(t)=b(t)dgap(t)+w1(t)
Your state equation is
b(t)=b(t-1)+w3(t)
So your state "vector" is just X(t)=b(t), the loading c(t) is dgap(t); then you have the two variances for w1 (which is the SV variance) and w3 (which is the SW variance).
Re: State space representation
Posted: Sat Jan 14, 2012 2:30 pm
by Henrique Andrade
Dear Tom,
So I think it would be better to represent my problem as:
FP(t) = dR(t) + w1(t)
dR(t) = b(t)dgap(t))
b(t) = b(t-1)+ w3(t)
Why one would like to take off the w2 term?
If I simply combine w1 and w2, I will have this:
1st step: replace dR(t)
FP(t) = [b(t)dgap(t) + w2(t)] + w1(t)
2nd step: combine w1 and w2
FP(t) = b(t)dgap(t) + [w2(t)] + w1(t)]
So, by definition, b(t)dgap won't be my fiscal component (the "rule"). It will be my fiscal component subtracted by w2.
What do you think?
Best regards,
Henrique Andrade
Re: State space representation
Posted: Sun Jan 15, 2012 8:59 am
by TomDoan
Unless w1 and w2 have different dynamics, or unless you're willing to restrict their variances to have a fixed ratio, you can't separate one from the other with the information that you have.
Re: State space representation
Posted: Sun Jan 15, 2012 11:51 am
by Henrique Andrade
Thanks Tom!
Just one more question: Could I represent my problem as follows?
FP(t) = dR(t) + w1(t)
dR(t) = b(t)dgap(t))
b(t) = b(t-1)+ w2(t)
In that way I could combine my equations to get this:
FP(t) = b(t)dgap(t)) + w1(t)
b(t) = b(t-1)+ w2(t)
Um abraço,
Re: State space representation
Posted: Mon Jan 16, 2012 10:06 am
by TomDoan
Yes. You just can't attempt to extract a noisy dR given the one observable.