Estimating state space model for GARCH(1,1)
Moderators: EViews Gareth, EViews Moderator
Estimating state space model for GARCH(1,1)
Hello everybody,
I'm trying to run estimate state space model for GARCH(1,1)...can you help me in writing the code?
Thank you,
Mido
Re: Estimating state space model for GARCH(1,1)
I`m tried this code:
@signal rlogot= c(1)+sv1*rlogot(1)+ c(2)*sv2
@state sv2 = c(3) + c(4)*sv2(1) + [var = exp(c(5))]
@state sv1 = sv1(1)
Am I right??
Thank you in advance..
@signal rlogot= c(1)+sv1*rlogot(1)+ c(2)*sv2
@state sv2 = c(3) + c(4)*sv2(1) + [var = exp(c(5))]
@state sv1 = sv1(1)
Am I right??
Thank you in advance..
Re: Estimating state space model for GARCH(1,1)
plz answer me urgently I need to know Am I right in this specification or not???
Re: Estimating state space model for GARCH(1,1)
No, your specification is incorrect. GARCH models are nonlinear, so I am not sure if there is a way to put such a structure into a linear state space form. Unfortunately, EViews currently cannot handle nonlinear or nonGaussian state space models. However, the counterpart of GARCH is called "stochastic volatility" in state space and there is an approximate solution based on a linear model. One way to build such a model in EViews is as follows:
Code: Select all
'Transform the price level series (yt)
series rt = (dlog(yt)@mean(dlog(yt)))
series lrt2 = log(rt*rt)
'Build the state space model
sspace svmod
svmod.append @signal lrt2 = ht + [var=exp(c(1))]
svmod.append @state ht = c(2) + c(3)*ht(1) + [var = exp(c(4))]
svmod.append param c(1) 1.0 c(2) .0 c(3) .9 c(4) 2.0 'you may need to experiment to find feasible starting parameter values!
'Estimate the model
svmod.ml(showopts,m=500,c=1e06)
'Retrieve the smoothed estimation of state variable ht
svmod.makestate(t=smooth) hts
'Compute the smoothed estimated stochastic volatility
series sv = @exp(hts/2)
Re: Estimating state space model for GARCH(1,1)
Thanks Trubador.
Your reply is extremely appreciated.
However, I dont want to estimate a GARCH(1,1) using a state space model. I want to estimate the time varying beta using and AR model while relying on GARCH (1,1) in estimating the volatilities.
In other words, is it possible to use the GARCH (1,1) in the State Space model for estimating time varying betas as per the attached document.
Your swift response will be highly appreciated as I am in real need to understand and implement this.
Your reply is extremely appreciated.
However, I dont want to estimate a GARCH(1,1) using a state space model. I want to estimate the time varying beta using and AR model while relying on GARCH (1,1) in estimating the volatilities.
In other words, is it possible to use the GARCH (1,1) in the State Space model for estimating time varying betas as per the attached document.
Your swift response will be highly appreciated as I am in real need to understand and implement this.
 Attachments

 Time Varying State Space Model (using GARCH).docx
 (83.65 KiB) Downloaded 331 times
Re: Estimating state space model for GARCH(1,1)
The model is nonlinear in state variables, so as I mentioned before, it cannot be estimated via linear state space approach. Nonlinear state space models are quite complicated and therefore are very difficult to estimate. In addition to this technical detail, your model is so flexible that you may experience additional problems during estimation even if you manage to find a way to build it.
Re: Estimating state space model for GARCH(1,1)
hello trubador, thanks for sharing the code for Stochastic volatility using state space. i got few questions, 1) can you recommend the best way to experiment to find feasible starting parameter values for stochastic volatility. 2) (showopts,m=500,c=1e06) why is that c = 1e06? thank you very much and your response is highly appreciated.
Re: Estimating state space model for GARCH(1,1)
@trubador Possibly an elementary question, but why exactly do you take the exponent of hts/2 at the end? Why doesn't hts itself already contain the end result?
Re: Estimating state space model for GARCH(1,1)
student07 wrote:@trubador Possibly an elementary question, but why exactly do you take the exponent of hts/2 at the end? Why doesn't hts itself already contain the end result?
In the beginning, we log transform the return series so we can express the conditional variance in linear form. Otherwise, it would become nonlinear in states and we would not be able to solve it via linear Kalman filter. When the estimation is done, we need to transform the estimated conditional variance back to its original state. Since we want the volatility, we also take the square root: @sqrt(@exp(hts)) = @exp(hts/2)
Re: Estimating state space model for GARCH(1,1)
trubador wrote:In the beginning, we log transform the return series so we can express the conditional variance in linear form. Otherwise, it would become nonlinear in states and we would not be able to solve it via linear Kalman filter. When the estimation is done, we need to transform the estimated conditional variance back to its original state. Since we want the volatility, we also take the square root: @sqrt(@exp(hts)) = @exp(hts/2)
Thanks for your reply. I've read about the linearization so I understand that part. But didn't we take the log of rt^2 i.e. 'y' in the observation/@signal equation? Why would this immediately mean that our outcome for the VARIANCE is also in log? What am I missing?
Re: Estimating state space model for GARCH(1,1)
The variance part you refer to is actually the unobserved state variable and has the same scale as log(rt^2), which is mostly filled with negative values. Return series is defined as the stochastic volatility times the random error (noise). When you log transform, the relationship becomes additive:
We model this relationship as follows:
So the stochastic variance we estimate is actually @exp(ht)
Code: Select all
Rt = √Ht*et
Rt^2 = Ht*et^2
log(Rt^2) = log(Ht) + 2*log(et)
We model this relationship as follows:
Code: Select all
lrt2 = ht + vt
So the stochastic variance we estimate is actually @exp(ht)
Re: Estimating state space model for GARCH(1,1)
Aha, great, thanks a lot !
trubador wrote:The variance part you refer to is actually the unobserved state variable and has the same scale as log(rt^2), which is mostly filled with negative values. Return series is defined as the stochastic volatility times the random error (noise). When you log transform, the relationship becomes additive:Code: Select all
Rt = √Ht*et
Rt^2 = Ht*et^2
log(Rt^2) = log(Ht) + 2*log(et)
We model this relationship as follows:Code: Select all
lrt2 = ht + vt
So the stochastic variance we estimate is actually @exp(ht)
Re: Estimating state space model for GARCH(1,1)
excuse me
and in this problem
How can we underestand measure of coefficients beta0, beta1?????
It is worth noting that to corroborate the weak form efficiency hypothesis, the estimated value of
βi,t(1) should be either equal to ‘zero’ or statistically insignificant.
Plz help me
and in this problem
How can we underestand measure of coefficients beta0, beta1?????
It is worth noting that to corroborate the weak form efficiency hypothesis, the estimated value of
βi,t(1) should be either equal to ‘zero’ or statistically insignificant.
Plz help me
Who is online
Users browsing this forum: No registered users and 4 guests