Estimating state space model for GARCH(1,1)

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

mido21
Posts: 5
Joined: Sun Aug 26, 2012 3:41 am

Estimating state space model for GARCH(1,1)

Postby mido21 » Mon Sep 10, 2012 11:30 am

ot final.wf1
(173.86 KiB) Downloaded 717 times


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

mido21
Posts: 5
Joined: Sun Aug 26, 2012 3:41 am

Re: Estimating state space model for GARCH(1,1)

Postby mido21 » Tue Sep 11, 2012 3:58 pm

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..

mido21
Posts: 5
Joined: Sun Aug 26, 2012 3:41 am

Re: Estimating state space model for GARCH(1,1)

Postby mido21 » Thu Sep 13, 2012 3:42 pm

plz answer me urgently I need to know Am I right in this specification or not???

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: Estimating state space model for GARCH(1,1)

Postby trubador » Fri Sep 14, 2012 12:33 am

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 non-Gaussian 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=1e-06)

'Retrieve the smoothed estimation of state variable ht
svmod.makestate(t=smooth) hts

'Compute the smoothed estimated stochastic volatility
series sv = @exp(hts/2)

mido21
Posts: 5
Joined: Sun Aug 26, 2012 3:41 am

Re: Estimating state space model for GARCH(1,1)

Postby mido21 » Sat Sep 15, 2012 6:44 am

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.
Attachments
Time Varying State Space Model (using GARCH).docx
(83.65 KiB) Downloaded 783 times

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: Estimating state space model for GARCH(1,1)

Postby trubador » Sat Sep 15, 2012 12:03 pm

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.

saizal87
Posts: 4
Joined: Tue Mar 24, 2015 10:47 pm

Re: Estimating state space model for GARCH(1,1)

Postby saizal87 » Mon Apr 06, 2015 7:25 pm

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=1e-06) why is that c = 1e-06? thank you very much and your response is highly appreciated.

student07
Posts: 18
Joined: Tue Jun 03, 2014 5:58 am

Re: Estimating state space model for GARCH(1,1)

Postby student07 » Mon May 04, 2015 2:11 am

@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?

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: Estimating state space model for GARCH(1,1)

Postby trubador » Mon May 04, 2015 6:31 am

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)

student07
Posts: 18
Joined: Tue Jun 03, 2014 5:58 am

Re: Estimating state space model for GARCH(1,1)

Postby student07 » Tue May 05, 2015 5:40 am

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?

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: Estimating state space model for GARCH(1,1)

Postby trubador » Tue May 05, 2015 6:28 am

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)

student07
Posts: 18
Joined: Tue Jun 03, 2014 5:58 am

Re: Estimating state space model for GARCH(1,1)

Postby student07 » Thu May 07, 2015 3:59 am

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)

Amir_hghi
Posts: 1
Joined: Mon Oct 03, 2016 5:16 am

Re: Estimating state space model for GARCH(1,1)

Postby Amir_hghi » Mon Oct 03, 2016 5:25 am

excuse me
and in this problem
1.jpg
1.jpg (24.31 KiB) Viewed 20337 times


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

femimathew_1
Posts: 2
Joined: Mon Oct 14, 2019 1:55 am

Re: Estimating state space model for GARCH(1,1)

Postby femimathew_1 » Thu Oct 24, 2019 3:55 am

I am trying to generate inflation uncertainty series from inflation series using a stochastic volatility model. I tried using the code you gave below and it generated the sv series along with the estimated model.
However, I dont know how to interprete the model. I saw C1, C2, C3, C4 each with coefficient, standard error, probability values and so on. I also saw H with its own coefficient, standard error, prob. values etc.
My question is this: What do the C's stand for? Is h the stochastic volatility variance?





trubador wrote: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 non-Gaussian 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=1e-06)

'Retrieve the smoothed estimation of state variable ht
svmod.makestate(t=smooth) hts

'Compute the smoothed estimated stochastic volatility
series sv = @exp(hts/2)

arianbhm
Posts: 1
Joined: Wed Oct 14, 2020 8:28 am

Re: Estimating state space model for GARCH(1,1)

Postby arianbhm » Wed Oct 14, 2020 10:06 am

Hi,

I am new to EVIEWS. Is it possible to model nonlinear state space in EVIEWS or not? Not sure if the option is now available or not since I was checking the previous comments. Are there any software like Stata, SPSS, or.... capable of dealing with nonlinear state space model (Extended Kalman Filter) or not?


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 65 guests