Extracting pre-sample information

Discussion of State Space and Dynamic Stochastic General Equilibrium Models
AdamElderfield
Posts: 28
Joined: Fri Nov 20, 2020 2:37 pm

Extracting pre-sample information

Unread post by AdamElderfield »

Hi,

Is there any way to extract the pre-sample (specifically the ergodic values) from the DLM instruction?

Thanks

Adam
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Extracting pre-sample information

Unread post by TomDoan »

The %DLMINIT function can be used to compute the initial conditions from the system matrices---note that it allows for an A matrix with unit roots and includes both the stationary and non-stationary parts. (If the model is stationary, the diffuse covariance matrix will be zeros). You can also use the FPRE option to grab the initial (stationary only) covariance matrix before any update steps are taken. Note that that will get called for each time period, so you would just ignore it except on the first period.
AdamElderfield
Posts: 28
Joined: Fri Nov 20, 2020 2:37 pm

Re: Extracting pre-sample information

Unread post by AdamElderfield »

Thanks Tom - could you please point me to an example where this formula is used. The help page isn't totally useful for someone new to the program. Specifically, I am after the ability to see what the starting values for dlm instruction below this is taken from the Matherson and Stavrev replication code you have provided.

Code: Select all


dlm(start=%%DLMSetup(),a=a,c=cf,y=||pi,u||,mu=muf,sv=svf,sw=swf,$
  presample=ergodic,type=filter) sstart send xstates vstates


TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Extracting pre-sample information

Unread post by TomDoan »

I'm not sure what you're looking for. The underlying dynamic model in Matheson and Stavrev is quite simple: it has five states, one an AR(1) and four simple random walks, all independent of each other. So the "ergodic" covariance matrix is a diagonal matrix with 1/(1-rho^2) for the AR(1) component and "infinity" for the others. The complexity of the MS model comes from the non-linear interaction of the states which produces a complicated linearized measurement equation, which is seen in the C and MU components---but those don't affect the initialization.
AdamElderfield
Posts: 28
Joined: Fri Nov 20, 2020 2:37 pm

Re: Extracting pre-sample information

Unread post by AdamElderfield »

I see - I had initially thought this.

I am trying to understand why I get different results using Eviews state space procedure and DLM (my employer uses Eviews). I put it down to different handling of initial values, however I did put in starting values like you described below, with "infinity" be 1000000. The other thing could be handling of constraints - which in Eviews I have parameterised directly in the model i.e. (0.95-exp(rho) to constrain rho to be <= 0.95. Either way, it has me beat.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Extracting pre-sample information

Unread post by TomDoan »

The EViews state-space procedure is fine for relatively simple models. This isn't one of them. Putting in big positive numbers as a proxy for "infinity" is hoping for good luck---a number which produces reasonable results in one model (or for one state in a model) may result in complete garbage in another model (or within a single model). That's why RATS does the exact (limit) calculations.

There is really no good way to do the constrained states unless you assume that all the underlying parameters are known, which is never the case with economic models. Even if the underlying model is fully known, everything is an approximation and different approximations will work better in different situations. (The paper that M&S reference for constrained Kalman filtering is for equality constrained models, not inequality constrained models. Seeing if the point estimate is out-of-bounds and imposing an equality constraint if it is doesn't really work well in this case.)
AdamElderfield
Posts: 28
Joined: Fri Nov 20, 2020 2:37 pm

Re: Extracting pre-sample information

Unread post by AdamElderfield »

Thanks Tom - I figured that might be the case.
Post Reply