State Space model

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

rodneyleshaba
Posts: 5
Joined: Tue Nov 01, 2011 5:09 am

Re: State Space model

Postby rodneyleshaba » Fri Nov 18, 2011 6:42 am

Thanks, the above assisted but now I get another error if I just take data (yields) for one day....The error says "Insufficient Number of Observations" that this have to do with the data itself? Is it a requirement to have more data and if thats the case how will one get a daily yield curve using nelson siegel in a state space model? please help

rodneyleshaba
Posts: 5
Joined: Tue Nov 01, 2011 5:09 am

Re: State Space model

Postby rodneyleshaba » Wed Nov 23, 2011 11:14 pm

Thank you startz, that did give me their final values, but it also gave me large standard errors. Do you have any advice?
rodneyleshaba, try to estimate the model without c(1) next to sv1 in your signal equation and then make state series.
To better understand the output I suggest you to read original Diebold, Rudebusch and Arouba (2006) paper and Eviews manual.
Do u mean the make state series output then gives me the zero coupon yields, meaning the data gives me the yield curve? Should I only move to trusting the output if the SV1, SV2 and SV3 are significant?

tobi_mueller
Posts: 9
Joined: Mon Sep 17, 2012 2:37 am

Re: State Space model

Postby tobi_mueller » Thu Sep 27, 2012 1:33 am

Hi everyone,

My current project is to estimate a Dynamic Factor Model (DFM) in order to nowcast quarterly GDP growth. So far I've gathered 16 indicators (PMI manufacturing, services, IP etc.) that are available on a monthly basis and that are correlated to economic activity. Having these indicators how would you guys implement a DFM in EViews respectively how to extract the common unknown factor(s)? How to determine the optimal number of common factors in a DFM? How to determine the lag structure of the unobserved factors and/or of the idiosyncratic error?

Thanks for your help in advance :D

drap
Posts: 1
Joined: Sat Sep 28, 2013 10:35 pm

Re: State Space model

Postby drap » Sat Sep 28, 2013 10:56 pm

hi,

I am trying to develop and state space model based on diebold li VAR model. Eviews is delivering the message below:

Unmatched Parenthesis.

Below there is my specification. There something wrong?

@signal fed3m=sv1+((1-exp(-3*c(1)))/(3*c(1)))*sv2+(((1-exp(-3*c(1)))/(3*c(1)))-exp(-3*c(1)))*sv3+[var=exp(c(2))]
@signal fed6m=sv1+((1-exp(-6*c(1)))/(6*c(1)))*sv2+(((1-exp(-6*c(1)))/(6*c(1)))-exp(-6*c(1)))*sv3+[var=exp(c(3))]
@signal fed9m=sv1+((1-exp(-9*c(1)))/(9*c(1)))*sv2+(((1-exp(-9*c(1)))/(9*c(1)))-exp(-9*c(1)))*sv3+[var=exp(c(4))]
@signal fed1y=sv1+((1-exp(-12*c(1)))/(12*c(1)))*sv2+(((1-exp(-12*c(1)))/(12*c(1)))-exp(-12*c(1)))*sv3+[var=exp(c(5))]
@signal fed15m=sv1+((1-exp(-15*c(1)))/(15*c(1)))*sv2+(((1-exp(-15*c(1)))/(15*c(1)))-exp(-15*c(1)))*sv3+[var=exp(c(6))]
@signal fed18m=sv1+((1-exp(-18*c(1)))/(18*c(1)))*sv2+(((1-exp(-18*c(1)))/(18*c(1)))-exp(-18*c(1)))*sv3+[var=exp(c(7))]
@signal fed21m=sv1+((1-exp(-21*c(1)))/(21*c(1)))*sv2+(((1-exp(-21*c(1)))/(21*c(1)))-exp(-21*c(1)))*sv3+[var=exp(c(8))]
@signal fed2y=sv1+((1-exp(-24*c(1)))/(24*c(1)))*sv2+(((1-exp(-24*c(1)))/(24*c(1)))-exp(-24*c(1)))*sv3+[var=exp(c(9))]
@signal fed30m=sv1+((1-exp(-30*c(1)))/(30*c(1)))*sv2+(((1-exp(-30*c(1)))/(30*c(1)))-exp(-30*c(1)))*sv3+[var=exp(c(10))]
@signal fed3y=sv1+((1-exp(-36*c(1)))/(36*c(1)))*sv2+(((1-exp(-36*c(1)))/(36*c(1)))-exp(-36*c(1)))*sv3+[var=exp(c(11))]
@signal fed4y=sv1+((1-exp(-48*c(1)))/(48*c(1)))*sv2+(((1-exp(-48*c(1)))/(48*c(1)))-exp(-48*c(1)))*sv3+[var=exp(c(12))]
@signal fed5y=sv1+((1-exp(-60*c(1)))/(60*c(1)))*sv2+(((1-exp(-60*c(1)))/(60*c(1)))-exp(-60*c(1)))*sv3+[var=exp(c(13))]
@signal fed6y=sv1+((1-exp(-72*c(1)))/(72*c(1)))*sv2+(((1-exp(-72*c(1)))/(72*c(1)))-exp(-72*c(1)))*sv3+[var=exp(c(14))]
@signal fed7y=sv1+((1-exp(-84*c(1)))/(84*c(1)))*sv2+(((1-exp(-84*c(1)))/(84*c(1)))-exp(-84*c(1)))*sv3+[var=exp(c(15))]
@signal fed8y=sv1+((1-exp(-96*c(1)))/(96*c(1)))*sv2+(((1-exp(-96*c(1)))/(96*c(1)))-exp(-96*c(1)))*sv3+[var=exp(c(16))]
@signal fed9y=sv1+((1-exp(-108*c(1)))/(108*c(1)))*sv2+(((1-exp(-108*c(1)))/(108*c(1)))-exp(-108*c(1)))*sv3+[var=exp(c(17))]
@signal fed10y=sv1+((1-exp(-120*c(1)))/(120*c(1)))*sv2+(((1-exp(-120*c(1)))/(120*c(1)))-exp(-120*c(1)))*sv3+[var=exp(c(18))]

@state sv1=c(31)+c(19)*sv1(-1) + c(20)*sv2(-1) + c(21)*sv3(-1) + [ename = e1, var = exp(c(22)]
@state sv2=c(32)+c(23)*sv1(-1) + c(24)*sv2(-1) + c(25)*sv3(-1) + [ename = e2, var = exp(c(26)]
@state sv3=c(33)+c(27)*sv1(-1) + c(28)*sv2(-1) + c(29)*sv3(-1) + [ename = e3, var = exp(c(30)]
@evar cov(e1,e2)=c(34)
@evar cov(e1,e3)=c(35)
@evar cov(e2,e3)=c(36)

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13585
Joined: Tue Sep 16, 2008 5:38 pm

Re: State Space model

Postby EViews Gareth » Sat Sep 28, 2013 10:59 pm

Your state equations have mismatched parens at the end.

sunny
Posts: 12
Joined: Wed Oct 23, 2013 2:03 am

Re: State Space model

Postby sunny » Wed Oct 23, 2013 9:01 pm

I am trying to see work Phillip curve using state space modelling .. the model seems to work fine when i do not include c(2)* inf (-1)... but i want to include it .... i do not se any reason why it should be included...I have attached a wok sheet for your reference.. please help me in this regard..

@signal inf = c(1) + c(3)*gdp_gap + [var = exp(c(4))] + c(2)* inf (-1)
@signal gdp = gdp_gap + gdp_pot
@state gdp_pot = gdp_pot (-1) + [var = exp(c(5))]
@state gdp_gap = gdp_gap(-1) + gdp_gap1 (-1) + [var = exp(c(6))]
@state gdp_gap1 = gdp_gap(-1)

Thanks a lot
Sunny
Attachments
eveiws upload.wf1
(11.44 KiB) Downloaded 673 times

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

Re: State Space model

Postby trubador » Thu Oct 24, 2013 5:06 am

There might be a bug.

Just change the name of your series and use the new one instead:

Code: Select all

series enf = inf @signal enf = c(1) + c(2)*enf(-1) + c(3)*gdp_gap + [var = exp(c(4))] @signal gdp = gdp_gap + gdp_pot @state gdp_pot = gdp_pot (-1) + [var = exp(c(5))] @state gdp_gap = gdp_gap(-1) + gdp_gap1 (-1) + [var = exp(c(6))] @state gdp_gap1 = gdp_gap(-1) param c(1) .0 c(2) .0 c(3) .0 c(4) .0 c(5) .0 c(6) .0

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: State Space model

Postby EViews Glenn » Thu Oct 24, 2013 9:13 am

The error spec in brackets has to go at the end of the equation.

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

Re: State Space model

Postby trubador » Fri Oct 25, 2013 1:52 am

Hi Glenn,

There are also spaces between the characters in the last term of first equation, which I think are due to copy-paste procedure. The problem with this model appears to be more than the use of incorrect syntax. Please run the code I have posted and see if using the variable name "inf" is causing the trouble.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: State Space model

Postby EViews Glenn » Fri Oct 25, 2013 7:16 am

Thanks, I just ran a quick test but with your latter example, which really doesn't help, does it? :)

I'll look into this more carefully when I get into the office, both with regards to INF and with regards to the brackets placement. I have a suspicion that INF may be causing problems for our math expression parser which is getting confused between the series and a numeric INF, but I'll double-check and let you know.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: State Space model

Postby EViews Glenn » Fri Oct 25, 2013 11:32 am

As Trubador pointed out, the parser has an issue discriminating between the series name INF and the numeric INF. As the original poster noted, this is not an issue for INF as the dependent variable (which doesn't go through the analytic function engine), and only shows up when the lags of INF appear on the right-hand side.

We're looking into seeing whether we can get the parser to understand the difference between the two concepts. For now, Trubador's suggestion of using a different dependent variable name will work.

I will also note that I was correct that the error specification must be at the end of the signal or state equation.

casdia
Posts: 2
Joined: Sat Feb 22, 2014 6:16 pm

Re: State Space model

Postby casdia » Fri May 23, 2014 10:06 am

I'm doing this model, the Nelson Siegel model with ten maturity, when I run the progran appears a message, "Near to singular matrix"

thanks for help

t.batmunkh
Posts: 1
Joined: Thu Jul 07, 2016 5:00 pm

Re: State Space model

Postby t.batmunkh » Thu Jul 07, 2016 5:06 pm

Dear ALL

I am doing DieBold and Li and putting my sspace modelling, but showing NEAR SINGULAR MATRIX error, could anyone suggest me anything? am I making any mistakes on my equations?

PLS PLS help. Many tnx

@signal _3_month =sv1+( ( 1-exp(-c(26)*3) ) / (c(26)*3) )*sv2+( ( ( 1-exp(-c(26)*3) ) / (c(26)*3) ) - ( exp(-c(26)*3) ) )*sv3+[ename=e_3_month]
@signal _2_year =sv1+( ( 1-exp(-c(26)*24) ) / (c(26)*24) )*sv2+( ( ( 1-exp(-c(26)*24) ) / (c(26)*24) ) - ( exp(-c(26)*24) ) )*sv3+[ename=e_2_year]
@signal _5_year =sv1+( ( 1-exp(-c(26)*60) ) / (c(26)*60) )*sv2+( ( ( 1-exp(-c(26)*60) ) / (c(26)*60) ) - ( exp(-c(26)*60) ) )*sv3+[ename=e_5_year]
@signal _10_year=sv1+( ( 1-exp(-c(26)*120) ) / (c(26)*120) )*sv2+( ( ( 1-exp(-c(26)*120) ) / (c(26)*120) ) - ( exp(-c(26)*120) ) )*sv3+[ename=e_10_year]
@signal _20_year=sv1+( ( 1-exp(-c(26)*240) ) / (c(26)*240) )*sv2+( ( ( 1-exp(-c(26)*240) ) / (c(26)*240) ) - ( exp(-c(26)*240) ) )*sv3+[ename=e_20_year]
@signal _30_year=sv1+( ( 1-exp(-c(26)*360) ) / (c(26)*360) )*sv2+( ( ( 1-exp(-c(26)*360) ) / (c(26)*360) ) - ( exp(-c(26)*360) ) )*sv3+[ename=e_30_year]
@signal _40_year=sv1+( ( 1-exp(-c(26)*480) ) / (c(26)*480) )*sv2+( ( ( 1-exp(-c(26)*480) ) / (c(26)*480) ) - ( exp(-c(26)*480) ) )*sv3+[ename=e_40_year]

@state sv1 = c(10) + c(1)*( sv1(-1) - c(10) ) + c(2)*( sv2(-1) - c(11) ) + c(3)*( sv3(-1) - c(12) ) + [ename=ni_l]
@state sv2 = c(11) + c(4)*( sv1(-1) - c(10) ) + c(5)*( sv2(-1) - c(11) ) + c(6)*( sv3(-1) - c(12) ) + [ename=ni_s]
@state sv3 = c(12) + c(7)*( sv1(-1) - c(10) ) + c(8)*( sv2(-1) - c(11) ) + c(9)*( sv3(-1) - c(12) ) + [ename=ni_c]

@evar var(ni_l)=exp(c(13))
@evar var(ni_s)=exp(c(14))
@evar var(ni_c)=exp(c(15))
@evar cov(ni_l,ni_c)=c(16)
@evar cov(ni_s,ni_c)=c(17)
@evar cov(ni_l,ni_s)=c(18)

@evar var(e_3_month)=exp(c(19))
@evar var(e_2_year)=exp(c(20))
@evar var(e_5_year)=exp(c(21))
@evar var(e_10_year)=exp(c(22))
@evar var(e_20_year)=exp(c(23))
@evar var(e_30_year)=exp(c(24))
@evar var(e_40_year)=exp(c(25))

@param c(26) 0.0609


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests