Page 1 of 1

Stochastic volatility with MA(1) errors in sspace

Posted: Tue May 17, 2016 6:48 pm
by Acrobat
Hi, everyone.

I think I have read all posts regarding stochastic volatility, but I am still unsure, so here I am.

I want ot estimate an SV model with MA(1) errors to forecast inflation.

Starting from the model:

Rt=sigma_t*ut with Rt=dlog(CPI)- mu and mu=@mean(dlog(CPI))
log(Rt*Rt)=log(sigma-t^2)+log(ut^2)
y=ht + vt

I want vt to follow vt=et+theta*et(-1).

As a start, I have modified tha svol.prg on the sspace example files. See code below. (This is just to see if it works, it does not use my data).

My questions are:

1- Is this way to set up the MA errors in the sspace correct? Do you see any conceptual errors?

2- Now, in the original SV model by Taylor, ut---N(0,1). In the code, I didn't make any assumption or impose any constraint related to that, but estimated the variance freely. The program runs OK, although the estimates might not be very good. Do you think I should try to incorpórate in the specification the fact that ut---N(0,1) and that vt=log(ut^2) (whose distribution I ignore)?

3- I would like to model mu as time varying, for example as an unobserved component model. Or to include an AR(p) for y in the signal equation. Is this possible in the context of sspace estimation of SV models? I think it isn't, but please let me know if I am mistaken.

I appreciate greatly any comment on this.

Thanks!

Code: Select all

'basic stochastic volatility model (12/14/2000) 'QML estimation by state space 'revised 3/7/2007 wfcreate u 1 1000 'get data %datafile = @runpath + "svpdx.dat" read(skiprow=1) %datafile rt 'estimate GARCH(1,1) model equation eq1.arch(1,1,m=500,c=1e-5,showopts) rt c show eq1.output 'and get conditional variance series smpl 945 1000 eq1.forecast rhat rhat_se gt smpl 1 944 'transformation for QML estimation series y = log(rt*rt) 'variance of log chi-square distribution !pi = @acos(-1) scalar s2 = 0.5*!pi*!pi 'STOCHASTIC VOLATILITY WITH MA(1) ERRORS? 'specify quasi-likelihood state-space sspace sv sv.append @signal y =sv1 +c(1)*sv2 +ht sv.append @state sv1=[var=c(4)] sv.append @state sv2=sv1(-1) sv.append @state ht = c(2) + c(3)*ht(-1) + [var=exp(c(5))] 'set starting values c(1) = 0.1 c(2) = 0.1 c(3) = 0.9 c(4)=0.01 c(5)=0.01 'estimate show sv.ml(showopts,m=500,c=1e-7) 'and retrieve state series sv.makestate(t=pred) *f sv.makestate(t=predse) *f_se sv.makestate(t=filt) *t sv.makestate(t=filtse) *t_se sv.makestate(t=smooth) *s sv.makestate(t=smoothse) *s_se 'plot to compare log variance from GARCH and stochastic volatility graph graph1.line log(gt) htf hts graph1.options size(8,2) graph1.addtext(0.1,-0.3) Log volatility graph1.setelem(1) legend(GARCH(1,1)) graph1.setelem(2) legend(One-step ahead) graph1.setelem(3) legend(Smoothed) graph1.legend columns(1) position(0,0) show graph1

Re: Stochastic volatility with MA(1) errors in sspace

Posted: Fri May 27, 2016 7:11 am
by trubador
1) Yes, your specification is correct. Yes, how do you justify the MA behavior in such a heavily transformed dependent variable from a theoretical/practical standpoint? Have you tried using simpler models to find any evidence in favor?

2) Yes, c(4) should equal to 1 in this case. However, you cannot ignore the distribution, so may relax the assumption. Keep in mind that this is just an "approximate" and "linear" solution to the stochastic volatility problem.

3) No, it is not possible within the context of linear state space approach as the model becomes nonlinear in state variables.

Re: Stochastic volatility with MA(1) errors in sspace

Posted: Mon May 30, 2016 9:50 am
by Acrobat
Thanks for your answer, Trubador.

I am indeed using simpler models, but was recently asked to consider including MA(1) errors. I will incorporate your input.

Thanks again.

Cheers.