state space model (unobserved components) -> seasonality

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

Mr.Bratwurst
Posts: 3
Joined: Tue Apr 27, 2010 8:45 am

state space model (unobserved components) -> seasonality

Postby Mr.Bratwurst » Tue May 18, 2010 6:50 am

Hello,
i am trying to specify a state space (unobserved components) model in EViews 7 for energy consumption on a quarterly basis. I use (or at least i try to do so :) ) the same specification as Koopman and Ooms (2002), http://www.econometricsociety.org/meetings/esem02/cdrom/papers/1267/KoopmanOoms2002.pdf (see Chapter 2).
Energy consumption y: y=trend+season+irregular
trend=trend(-1)+beta(-1)+var...
beta=beta(-1)+var...

I am not sure how to code/specify the trigonometric form of the seasonal component correctly. Do you have any tipps or suggestions?
Thanks in advance!

Cheers, Mr.Bratwurst.

Mr.Bratwurst
Posts: 3
Joined: Tue Apr 27, 2010 8:45 am

Re: state space model (unobserved components) -> seasonality

Postby Mr.Bratwurst » Wed May 19, 2010 2:24 pm

Hello, now here is my code for the seasonal state space model. The forecasting performance is okay, but the p-values of the coefficients are not as expected.
Any suggestions?
series y=m+g+e
m=trend, g=seasonality, e=irregular
seasonality is modeled by using trigonometric terms. I think the starting values might be a problem. But i am not sure. If i log the series, i get the "coefficients are not unique"-Warning and p-values are not available.....
Thanks in advance!

Code: Select all

'Variables
!s=4

'create lambdas
for !j=1 to !s/2
 scalar lambda!j=@acos(-1)*2*!j/!s
next

'state space model
sspace ss_{%0}
ss_{%0}.append @signal {%0}=sv1+(sv3+sv5)+[var=exp(c(1))]
'trend
ss_{%0}.append @state sv1=sv1(-1)+sv2(-1)+[var=exp(c(2))]
ss_{%0}.append @state sv2=sv2(-1)+[var=exp(c(3))]
'seasonality
ss_{%0}.append @state sv3=@cos(lambda1)*sv3(-1)+@sin(lambda1)*sv4(-1)+[var=exp(c(4))]
ss_{%0}.append @state sv4=(-1)*@sin(lambda1)*sv3(-1)+@cos(lambda1)*sv4(-1)+[var=exp(c(5))]
ss_{%0}.append @state sv5=@cos(lambda2)*sv5(-1)+[var=exp(c(6))]

'initial values
c(1)=@var(log({%0}))
c(2)=0
c(3)=0
c(4)=0
c(5)=0
c(6)=0

'Estimation
smpl @first 2007q4
ss_{%0}.ml(showopts,c=1e-1,m=1000)
show ss_{%0}.output

'Forecasting
smpl @all
series {%0}_ss

for !i = 0 to 7
 smpl 2008q1+!i 2009q4
 ss_{%0}.forecast @SIGNAL ss_temp
 {%0}_ss= ss_temp
next
smpl @all


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 58 guests