Page 1 of 1

How does EViews determine prior mean and prior covariance?

Posted: Tue Mar 29, 2016 12:56 pm
by JethroArm
I'm estimating a state-space model in EViews (8), and I'm wondering how EViews determines the mean and covariance at time t=1 (and relatedly, at t=0).

I've uploaded an example workfile. I've kept it all very simple: an observation series that takes a value of 1,000 each period 1900 to 1999, then a sspace object of the form given below (i.e. variance of both residuals equal to 1, all system matrices equal to 1).

I've then estimated and produced filtered (i.e. not smoothed) state estimates and state se estimates (sv1fil and sv1fil_se).

I would have thought that the first value of the filtered mean would be 1,000 and of the filtered covariance would be 1, but that's not the case. Can you please help me out with determining how EViews comes up with those first numbers at time t=1900 (i.e. 999.999000001 for the filtered mean and 0.9999994999378601 for the filtered s.e.)?

Code: Select all

@ENAME E1 @ENAME E2 @EVAR VAR(E1) = 1 @EVAR VAR(E2) = 1 @SIGNAL OBSERVED = SV1 + E1 @STATE SV1 = SV1(-1) +E2

Re: How does EViews determine prior mean and prior covarianc

Posted: Tue Mar 29, 2016 2:09 pm
by trubador

Re: How does EViews determine prior mean and prior covarianc

Posted: Tue Mar 29, 2016 2:55 pm
by JethroArm
Thanks Trubador, I've looked there, but can't square that up with what I'm seeing in the output.

As far as I can tell, all of my system matrices here are equal to 1. T is 1, Z is 1, Omega is time-invariant and is equal to eye(2) (i.e. Q=P=1, G = 0). So, based on this (and the User Guide II pg 603-604 and 625) I would think that the initial value of P should be 1. But that's not the case - it's 0.9999994999378601. Similarly with the initial mean - I would think (based on the User Guide) that it would take a value of 0 or of inv(T)*1000 = 1000. But again, that's not the case.

Am I missing something here? Any advice would be appreciated, particularly if you can show how those exact numbers were derived from the system that I input.

Re: How does EViews determine prior mean and prior covarianc

Posted: Tue Mar 29, 2016 3:56 pm
by trubador
Your first value is not the initial prior of the state variable. You need to initialize α1|0 to zero and P1|0 to 1000000. After that, you'll have to apply Kalman Filter Recursion.

Re: How does EViews determine prior mean and prior covarianc

Posted: Tue Mar 29, 2016 6:10 pm
by JethroArm
Perfect, that makes a lot of sense!

Then my one-step-ahead prediction for the mean will be 0. I'm a little confused around the one-step-ahead prediction for the covariance matrix - the textbook I have says you can calculate it by A*V_(t-1)*A'+Q. In my case, A=1, Q = 1, and V_0 is 1000000, so am I right that the one-step ahead covariance matrix estimate in t=1900 is 1*1000000*1+1 = 1000001. So the one-step-ahead standard error should be 1,000.000499999875 (sqrt(1000001)), but I'm finding it as 1,000. Am I doing something wrong with my one-step-ahead predictions?

Re: How does EViews determine prior mean and prior covarianc

Posted: Wed Mar 30, 2016 2:59 am
by trubador
It's not that straightforward. Kalman Filter Recursion is a system of equations, which requires simultaneous updating. You seem to have obtained forecast error variance, Ft. But, you also need to compute Kalman gain to be able to obtain the variance of state estimate error, Pt.

Re: How does EViews determine prior mean and prior covarianc

Posted: Wed Mar 30, 2016 1:16 pm
by JethroArm
Sure, that makes sense!

I'm following along with this derivation: https://users.ece.cmu.edu/~byronyu/papers/derive_ks.pdf.

As far as I can tell, the steps for the covariance are:
  • 1) Form a 1-step ahead prediction of the system covariance (using equation 7).
    2) Compute the Kalman gain (using equation 6)
    3) Update the filtered covariance matrix (using equation 5)
I would have thought that step 1 would correspond to EViews producing the one-step-ahead standard error (well, once you take a square root), but like I said in my previous post the numbers don't line up.

Am I missing something, or is there a difference between how EViews does it and how it's outlined in the above derivation?

Again, if you're able to show specifically how those numbers were reached using the input data and system matrices, that would be great!

Re: How does EViews determine prior mean and prior covarianc

Posted: Tue Apr 05, 2016 4:47 pm
by JethroArm
Any further assistance would really help. I'm quite confused as to why the results from EViews seem different to what I'd expect given the derivation I posted.