Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: state space model estimation in STATA


From   Richard Gates <[email protected]>
To   [email protected]
Subject   Re: st: state space model estimation in STATA
Date   Thu, 09 Feb 2012 11:50:15 -0600

Adjmal Sekander Sirak is attempting to estimate a dynamic factor model
using -sspace-, but is having convergence problems.  He describes the
essence of the model thus:
> 
>                                              ... I want to estimate a so
> called Dynamic Nelson-Siegel model for sovereign bond yields, which is
> basically just a dynamic factor model. I have daily observations over a span
> of several years for yields of zero coupon bonds for 16 maturities ranging
> from 3 months to ten years. They are all for the same country, of course.
> The model that I want to estimate looks like this:
> 
> y_{t}(tau) = Lambda(tau)*f_{t}+eps_{t}
> f_{t} = A*f_{t-1} + (I-A)*mu + eta_{t}
> 
> where t denotes the time of observation and tau the maturity. y_{t} is a
> 16x1 vector and f_{t} is usually 3x1, but I discard the third element for
> parsimony. This is also done by other authors in the literature. The
> elements of Lambda(tau) are fixed values given by the Nelson-Siegel model
> and need not be estimated. The two error terms are independent of each other
> and of their own lags or leads.

The statespace specification is 

> . sspace (lev L.lev L.slo, state) (slo L.lev L.slo, state) ///
> > (italy_3m lev slo, noconstant) (italy_6m lev slo, noconstant) ///
> > (italy_9m lev slo, noconstant) (italy_12m lev slo, noconstant) ///
> > (italy_15m lev slo, noconstant) (italy_18m lev slo, noconstant) ///
> > (italy_24m lev slo, noconstant) (italy_30m lev slo, noconstant) ///
> > (italy_36m lev slo, noconstant) (italy_48m lev slo, noconstant) ///
> > (italy_60m lev slo, noconstant) (italy_72m lev slo, noconstant) ///
> > (italy_84m lev slo, noconstant) (italy_96m lev slo, noconstant) ///
> > (italy_108m lev slo, noconstant) (italy_120m lev slo, noconstant) ///
> > in 1/3001, constraints(1/32) covstate(unstructured) covobserved(diagonal)
> > ///
> > technique(bfgs 30 dfp) difficult trace from(init)


The model without constraints has 57 parameters.  He correctly sets the 32
constraints for Lambda(tau).  The remaining 25 parameters to estimate are
the regression coefficients and constants for the states -lev- and -slo-,
2x3 = 6, and 3 variance-covariances for the unstructured state-equations
covariance, and the 16 variance estimates for the diagonal observed-equations
covariance. 
> 

He asks:
> 
> 1: Could it be that STATA is just incapable of estimating state space models
> with say more than 20 parameters? My ultimate goal is to include more
> regressors, so the number of parameters would increase at a later stage. If
> so, what other packages can you recommend?

-sspace- can estimate models with more than 20 parameters.  Of course,
the more parameters that are being estimated the greater the chance of
one or more parameters not be identified.

> 2: Am I doing something wrong in the model set-up? How can it be that the
> log-likelihood is -22 million when my initial guess comes from a less
> sophisticated, but decent estimate of the model? Do I assign the initial
> values in a wrong manner? I made sure to use the same order of coefficients
> in my initial values vector "init" (see below) as in the parameter vector
> e(b). Could you please take a look at my sspace command and the constraints?
 
It looks to me as though the -sspace- problem is correctly set up.  However,
the interation log provided by Adjmal shows that the variance for the
7-th observation equation, italy_24m, is going to zero. 

          c1         c2         c3         c4         c5         c6
r1   .0073258   .0011075    .997674  -.0081537   .9988129   .0009616

         n11        n12        n22        e1         e2
     .0026353  -.0022236   .0071163   .5454731   .2593829

         e3        e4         e5         e6       **e7**       e8
r1   .1128243   .0470635   .0209328   .0083046   1.27e-10   .0014872

         e9        e10       e11        e12        e13
     .0014012   .0002085   .0032718   .0169846   .0443123

        e14        e15        e16
r1   .0825854   .1254572   .1698563 

> Any help will gratefully be appreciated.

I would like to make the following suggestions:

1. Try to simplify the model using the -covobserved(dscalar)- option, not
   necessarily as a final model parameterization, but as starting point
   in model development.

2. Do not use the DFP optimization technique.  Stick with BFGS followed by
   NR, the default optimization technique.  If it converges using 
   Newtion-Raphson, you know you have true convergence.  The "refining step"
   transforms the variances and will take NR steps regardless of the 
   technique specified.  "Convergence" using BFGS or BFP does not 
   guarantee the NR steps during the "refining step" will converge if
   the model parameters are not identified.

3. Use the -iterate()- option to terminate the search early. The coefficient
   table will display (assuming -sspace- can transform the variance 
   parameters).  You will be able to see which parameters are giving you
   trouble.

   Also, there is an undocumented postestimation command for -sspace-

	. estat ssdisplay

   which will display the estimates in state space form.

I hope this has been helpful and if you have any further difficulties,
please feel free to contact Stata technical support at 

[email protected].


-Rich Gates
[email protected]  

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index