Page 1 of 1

Setting an SVAR in State Space Form

Posted: Fri Apr 08, 2016 9:50 am
by caromartinez
Dear all,
I have defined a SVAR model in Eviews.
The SVAR has 9 variables in this order:
FFED, LOG(BAA_T10Y), L_CPI, L_GDP, L_COMMP, L_WGDP, L_REER, YIELD_C, D_HOUSING

3 lags, and one specific structure for the variance-covariance matrix as below:
@e1=c(1)*@u1
@e2=c(6)*@u2
@e3=c(9)*@u3+c(10)*@e4+c(11)*@e5
@e4=c(12)*@u4+c(13)*@e5
@e5=c(14)*@u5
@e6=c(15)*@e5+c(16)*@u6
@e7=c(17)*@e1+c(18)*@e2+c(19)*@e3+c(20)*@e4+c(21)*@e5+c(22)*@e6+c(23)*@u7+c(29)*@e8
@e8=c(24)*@e1+c(26)*@e2+c(28)*@u8
@e9=c(30)*@e1+c(31)*@e4+c(32)*@u9

I have Eviews 8, I want to convert this SVAR in Sspace form to use the Kalman Filter and its forecasting options as indicated in the attached file (Conditional Forecasts on SVAR models using the Kalman Filter, Gonzalo Camba-Mendez).

I have general knowledge of state space models as studied in the context of Real Business Cycle Models and Intertemporal Consumption Decission Models.
However, I have not used them before in Eviews and I am struggling with converting my SVAR into the Sspace form.

Would it be possible to have your guidance on this? Any good starting point, or any related example I can look?

Thanks very much in advance.

Kind regards,
Carolina M

Re: Setting an SVAR in State Space Form

Posted: Mon Apr 11, 2016 7:03 am
by trubador
You are dealing with a rather complex model. So, I suggest you to start with a small and a simple model in order to understand how EViews handle state space models. Below you find an example of SVAR(1) modeling within state space framework:

Code: Select all

wfcreate m 1960 2015 'generate artificial series series y1 = nrnd series y2 = nrnd series y3 = nrnd 'initialize parameter vector c=.5 'estimate VAR model with state space sspace ssvar ssvar.append @signal y1 = c(1) + c(2)*y1(-1) + c(3)*y2(-1) + c(4)*y3(-1) + c(5)*e1 ssvar.append @signal y2 = c(8) + c(9)*y1(-1) + c(10)*y2(-1) + c(11)*y3(-1) + c(12)*e1 + c(13)*e2 ssvar.append @signal y3 = c(15) + c(16)*y1(-1) + c(17)*y2(-1) + c(18)*y3(-1) + c(19)*e1 + c(20)*e2 + c(21)*e3 ssvar.append @state e1 = [ename =en1,var=1] ssvar.append @state e2 = [ename =en2,var=1] ssvar.append @state e3 = [ename =en3,var=1] 'This part is actually redundant unless you would like to assume correlated errors. 'ssvar.append @evar cov(en1,en2)=0 'ssvar.append @evar cov(en1,en3)=0 'ssvar.append @evar cov(en2,en3)=0 ssvar.ml 'estimate VAR model with OLS var olsvar.ls 1 1 y1 y2 y3 'create pattern matrices matrix mata = @identity(3,3) matrix(3,3) matb matb.fill NA,0,0,NA,NA,0,NA,NA,NA 'run the structural factorization olsvar.svar(rtype=patsr, aname=mata, bname=matb)