Page 1 of 2

contemporaneous correlation in state equations

Posted: Thu May 18, 2017 7:52 am
by tadejus
Hi all,

I can't find this topic being mentioned and I am stuck with it..
Basically I want to introduce a contemporaneous correlation in state equation and can't find a way to circumnavigate the rule stating that all the dependent variables in state equations need to be lagged..
so my code which aims to estimate an output gap out of inflation and gdp data reading:

Code: Select all

sspace gap genr infla = log(cpi) - log(cpi(-4)) genr infla_lead = infla(1) genr l_gdp = log(gdp) genr gr = l_gdp - l_gdp(-4) scalar crec = 1+@mean(gr) scalar un = @mean(u) gap.append @signal l_gdp = pot + gap gap.append @state growth = c(2)*crec + (1-c(2))*growth(-1) + [var=exp(c(3))] gap.append @state pot = pot(-1) + growth+ [var=exp(c(1))] gap.append @state gap = c(4)*gap(-1) + [var=exp(c(5))] ap.append @signal infla = c(6)*infla_lead + (1-c(6))*infla(-1) + c(7)*gap + [var=exp(c(8))]
gets stuck at the line
gap.append @state pot = pot(-1) + growth+ [var=exp(c(1))]
since growth is not lagged (and by definition it should not be)
so my question is on how to go about this problem?

Re: contemporaneous correlation in state equations

Posted: Thu May 18, 2017 8:08 am
by startz
Maybe the following:

Instead of growth, introduce a variable growth_next_year. In the equation for potential include growth_next_year(-1). Change the variable names in the state equation for growth to growth_next_year.

Re: contemporaneous correlation in state equations

Posted: Thu May 18, 2017 8:11 am
by tadejus
I did try to do this and it does not work, probably because growth is not observable, but instead is estimated as a combination of observable average growth and an unobservable deviation from the average?
my observables are: gdp, u, cpi and potential

Re: contemporaneous correlation in state equations

Posted: Thu May 18, 2017 8:18 am
by startz
What went wrong when you tried it?

Re: contemporaneous correlation in state equations

Posted: Thu May 18, 2017 8:22 am
by tadejus
it gives back an error
Invalid lags or leads for state variables in state equation
"@STATE POT = POT(-1) + GROWTH+ [VAR=EXP(C(1))]" in
"DO_ BLAGRAVE.ML(MAXIT=1000)".
since contemporaneous correlation (i.e. non laged variables in the state equations are prohibited by definition - not that I see why)

Re: contemporaneous correlation in state equations

Posted: Thu May 18, 2017 8:28 am
by startz
it gives back an error
Invalid lags or leads for state variables in state equation
"@STATE POT = POT(-1) + GROWTH+ [VAR=EXP(C(1))]" in
"DO_ BLAGRAVE.ML(MAXIT=1000)".
since contemporaneous correlation (i.e. non laged variables in the state equations are prohibited by definition - not that I see why)
@STATE POT = POT(-1) + GROWTH_NEXT_YEAR(-1)+ [VAR=EXP(C(1))]

Re: contemporaneous correlation in state equations

Posted: Thu May 18, 2017 8:51 am
by tadejus
yes but then you will run into the same problem when you try to define growth_next_year by saying
@state growth_next_year=growth(1) where eviews will not allow for lead variables in state equations
or
@state growth_next_year= c(2)*crec + (1-c(2))*growth + [var=exp(c(3))] '
where again you will run into a problem of contemporaneous variable on the RHS (growth)
if growth was observable then you could just generate it by definition but it is not and therein lies the problem

Re: contemporaneous correlation in state equations

Posted: Thu May 18, 2017 8:52 am
by startz
yes but then you will run into the same problem when you try to define growth_next_year by saying
@state growth_next_year=growth(1) where eviews will not allow for lead variables in state equations
or
@state growth_next_year= c(2)*crec + (1-c(2))*growth + [var=exp(c(3))] '
where again you will run into a problem of contemporaneous variable on the RHS (growth)
if growth was observable then you could just generate it by definition but it is not and therein lies the problem
@state growth_next_year= c(2)*crec + (1-c(2))*growth_next_year(-1)+ [var=exp(c(3))]

Re: contemporaneous correlation in state equations

Posted: Thu May 18, 2017 9:06 am
by tadejus
yes but then you will run into the same problem when you try to define growth_next_year by saying
@state growth_next_year=growth(1) where eviews will not allow for lead variables in state equations
or
@state growth_next_year= c(2)*crec + (1-c(2))*growth + [var=exp(c(3))] '
where again you will run into a problem of contemporaneous variable on the RHS (growth)
if growth was observable then you could just generate it by definition but it is not and therein lies the problem
@state growth_next_year= c(2)*crec + (1-c(2))*growth_next_year(-1)+ [var=exp(c(3))]
but now you are just back to the old code only replacing the variable growth with variable growth_next_year and still there is no contemporaneous correlation in state equation..

Re: contemporaneous correlation in state equations

Posted: Thu May 18, 2017 9:11 am
by startz
Sorry. You're right of course.

Re: contemporaneous correlation in state equations

Posted: Thu May 18, 2017 9:19 am
by startz
Which variables do you want to be contemporaneously correlated?

Re: contemporaneous correlation in state equations

Posted: Fri May 19, 2017 1:29 am
by tadejus
Which variables do you want to be contemporaneously correlated?
growth and pot in line:
@state pot = pot(-1) + growth+ [var=exp(c(1))]

so this line is telling us that the potential output (pot) is linked to the previous period potential output and with current period (!contemporaneous correlation!) growth..
this is a replication of the IMF paper on using kalman filter to separate the output gap and potential output out of GDP series and using only data on gdp, inflation and unemployment..
this can definitely be done in other software packages and I can't see why eviews would not support it..

Re: contemporaneous correlation in state equations

Posted: Fri May 19, 2017 5:52 am
by startz
Why doesn't using growth_next_year lagged accomplish the same thing? (I may well be jet lagged and missing something)

Re: contemporaneous correlation in state equations

Posted: Fri May 19, 2017 7:15 am
by tadejus
Why doesn't using growth_next_year lagged accomplish the same thing? (I may well be jet lagged and missing something)
because growth is not observable but also estimated (bear in mind it is a potential growth) and as such must be declared in state and not sygnal equation..
once you declare it in state equation you will run into a problem of having to declare the growth_next_year as being given as a lead variable (growth(+1) which eviews again will not allow..
if you define it as a simple AR process (growth_next_year=growth_next_year(-1)+error) like you did with growth then you are basically just changing the name of the variable but not it's substance..
or did you have some other way of declaring it in mind?

Re: contemporaneous correlation in state equations

Posted: Fri May 19, 2017 10:19 am
by EViews Glenn
I'll admit upfront that I'm not following this thread carefully, and I'm not familiar with the application at hand, so I may be missing nuance in the way you want to construct the model. With those caveats, I'll note that if all you want is contemporaneous correlation between states, you can use the @ecov to allow for the errors to be correlated.

In my cursory decoding of the model, you have

Code: Select all

gap.append @state growth = c(2)*crec + (1-c(2))*growth(-1) + [var=exp(c(3))] gap.append @state pot = pot(-1) + growth+ [var=exp(c(1))]
I think that this can be reparameterized as

Code: Select all

gap.append @state growth = c(2)*crec + (1-c(2))*growth(-1) + e1 gap.append @state pot = pot(-1) + c(2)*crec + (1-c(2))*growth(-1) + e2 gap.append @ename e1 gap.append @ename e2 gap.append @evar e1 = exp(c(3)) gap.append @evar e2 = exp(c(1)) gap.append @ecov(e1, e2) = c(4)
where the POT equation is derived by substituting in the contemporaneous growth equation and collecting error terms. If you are assuming the original state errors are uncorrelated, var(e2) corresponds to the sum of the original error variances, and the covariance between e1 and e2 is the variance of the original error in the growth equation.