Hello
I am trying to learn to use state space models and do not understand how the coefficient numbers are specified or how you get them in your examples
eg. when specifying an equation (page 493/4 of user manual)
The following two state equations define an unobserved error with an AR(2) process:
@state sv1 = c(2)*sv1(-1) + c(3)*sv2(-1) + [var = exp(c(5))]
@state sv2 = sv1(-1)
The first equation parameterizes the AR(2) for SV1 in terms of an AR(1) coefficient, C(2),
and an AR(2) coefficient, C(3).
Why is c(5) used in the variance expression in square brackets? I am a bit lost as to how the coefficient numbers are used and not used, meaning how the c( ) numbers are determined and used (or not) Eg. Why not [var = exp(c(4))]
Would appreciate some help.
thanks
State Space Models coefficients
Moderators: EViews Gareth, EViews Moderator
Re: State Space Models coefficients
It does not have to be in any order, the way of putting the coefficents in the model is up to you. The following is an identical specification with different coefficent names:
If you have 8 parameters to be estimated, then labelling your coefficents from c(1) to c(8) will be the easiest (but not the only) way to do that.
Code: Select all
@state sv1 = c(102)*sv1(-1) + c(14)*sv2(-1) + [var = exp(c(23))]
@state sv2 = sv1(-1)-
johnvaz@gmail.com
- Posts: 8
- Joined: Thu Mar 11, 2010 6:31 am
Re: State Space Models coefficients
Thank you but I still don't understand where each c() is defined or specified - sorry to be so dumb
If I use 1-8 or any number to acess the c() values then each of these coefficient is estimated based on something specified so eviews will store values swhen estimated but where is this specified or how is it specified ? If I don't use certain values,
The [ var = exp(c(5))] term suggests the variance is determined on the basis of c(5) but where is the content of c(5) specified
Sorry I am really confused as c(5) just appears out of nowhere from my perspective
Thanks again
If I use 1-8 or any number to acess the c() values then each of these coefficient is estimated based on something specified so eviews will store values swhen estimated but where is this specified or how is it specified ? If I don't use certain values,
The [ var = exp(c(5))] term suggests the variance is determined on the basis of c(5) but where is the content of c(5) specified
Sorry I am really confused as c(5) just appears out of nowhere from my perspective
Thanks again
Re: State Space Models coefficients
There is a pre-defined object in the workfile called "c", which is the default coefficient vector where EViews stores estimated parameter values.
-
johnvaz@gmail.com
- Posts: 8
- Joined: Thu Mar 11, 2010 6:31 am
Re: State Space Models coefficients
I am aware of c being a predefined object - the question is - in the example how does eviews know what goes into each cell in c() which is used in the var statement
to clarify: when you specify/estimate any other equation other than state space, you say
y = c(1)X1 + c(9)x9 + c(27)x27 I get that the parameters are placed into c(1), C(9) and C(27) and can use these in later equations in a system.
However in the case of the sspace example the last term appears with a c(5) but where is c(5) specified in the equation or is that automatically mean the variance is stored in c(5)? what is futher confusing is that the exp(c(5)) is used implying it is taking a value that is already defined but where is this as it is the first time c(5) appears.
to clarify: when you specify/estimate any other equation other than state space, you say
y = c(1)X1 + c(9)x9 + c(27)x27 I get that the parameters are placed into c(1), C(9) and C(27) and can use these in later equations in a system.
However in the case of the sspace example the last term appears with a c(5) but where is c(5) specified in the equation or is that automatically mean the variance is stored in c(5)? what is futher confusing is that the exp(c(5)) is used implying it is taking a value that is already defined but where is this as it is the first time c(5) appears.
-
stellar_acrobat
- Posts: 1
- Joined: Sun Jan 13, 2013 11:08 pm
Re: State Space Models coefficients
Can anyone help with this?
Re: State Space Models coefficients
c(5) is also a parameter like c(2) and c(3) in your equation and is estimated along with the model. The initial values of coefficients (parameters) to be estimated are assumed to be zero unless otherwise specified.what is futher confusing is that the exp(c(5)) is used implying it is taking a value that is already defined but where is this as it is the first time c(5) appears.
Although there is nothing specific going on here, it is more complicated to explain within the state space modeling context. Suppose we are trying to estimate the coefficients of a simple linear system: y = a + b*x. And "assume" that error terms are normally distributed with zero mean and constant variance. If we use the least squares approach, then we do not deal with variance directly. However, there is another approach called maximum likelihood, which explicitly defines the distributional parameters. The same is also true for state space estimation. The following code does all these estimations for comparison purposes (copy and paste it to a new program window and hit run).
Code: Select all
'create an undated workfile
wfcreate u 250
'create a table for coefficents
table(4,4) coeftab
coeftab(2,1) = "Constant"
coeftab(3,1) = "Slope"
coeftab(4,1) = "Res. Variance"
coeftab(1,2) = "OLS"
coeftab(1,3) = "LOGL"
coeftab(1,4) = "SSPACE"
'generate fictitious data
series x = nrnd
series y = 5 + 2*x + nrnd/2
'do the estimation with ols and store parameter results
equation ols.ls y = c(1) + c(2)*x
coeftab(2,2) = c(1)
coeftab(3,2) = c(2)
coeftab(4,2) = (ols.@se)^2
'do the estimation with maximum likelihood
logl mylogl
mylogl.append @logl maxlik
mylogl.append res = y-c(1)-c(2)*x
mylogl.append var = c(3)^2
mylogl.append maxlik = log(@dnorm(res/@sqrt(var))) - log(var)/2
'unless you reset the coefficent vector, results of previous estimation is used
mylogl.append param c(1) .0 c(2) .0 c(3) 1
mylogl.ml
'store the parameter results
coeftab(2,3) = c(1)
coeftab(3,3) = c(2)
coeftab(4,3) = c(3)^2
'do the estimation with state space (there is more than one way to do that)
sspace myss
myss.append @signal y = c(1) + c(2)*x + error
myss.append @state error = [var = exp(c(3))]
myss.append param c(1) .0 c(2) .0 c(3) .0
myss.ml
'store the parameter results
coeftab(2,4) = c(1)
coeftab(3,4) = c(2)
coeftab(4,4) = exp(c(3))-
johnvaz@gmail.com
- Posts: 8
- Joined: Thu Mar 11, 2010 6:31 am
Re: State Space Models coefficients
Thanks very much
Who is online
Users browsing this forum: No registered users and 2 guests
