Statalist


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

st: Troubleshooting 'not sorted' and 'not regularly spaced' errors in newey and newey2


From   "Thomas Jacobs" <[email protected]>
To   StataList <[email protected]>
Subject   st: Troubleshooting 'not sorted' and 'not regularly spaced' errors in newey and newey2
Date   Thu, 9 Oct 2008 18:09:02 -0500

Fellow listers, I am trying to understand the cause of intermittent errors

"[time series variable] is not regularly spaced" and

"not sorted"

when trying to run newey and newey2 on panel data with approximately
50 companies and 900 trade days of market variables.

I have ensured that my time variable is consecutive for all firms:

. xtset
       panel variable:  CompanyNum (unbalanced)
        time variable:  TradeDateNe~m, 1 to 902
                delta:  1 unit

and while not perfectly balanced (one firm begins at
TradeDateNewNumber 23 as opposed to 1) it is much closer to balanced
than not.  I can force newey to work

. newey LnRtFiveYrMid L(1/2).LnRtFiveYrMid L(0/4).LnRtCDX LnRtCMT
LnRtTED L(0/2).LnRtStock ,
>  lag(4) force

[output excluded placed at bottom of note for readability]

but the same command on newey2 produces not sorted:
. newey2 LnRtFiveYrMid L(1/2).LnRtFiveYrMid L(0/4).LnRtCDX LnRtCMT
LnRtTED L(0/2).LnRtStock
> , lag(4) force

not sorted

I have tried sorting by time variable first as opposed to panel and
time, the default, with no effect.

Without force I nearly always get:

. newey LnRtStock LnRtSP500, lag(2)
TradeDateNewNum is not regularly spaced

If I drop the one firm I mentioned to perfectly balance the dataset:

. xtset
       panel variable:  CompanyNum (strongly balanced)
        time variable:  TradeDateNe~m, 1 to 902
                delta:  1 unit

and run newey without force:

. newey LnRtFiveYrMid L(1/2).LnRtFiveYrMid L(0/4).LnRtCDX LnRtCMT
LnRtTED L(0/2).LnRtStock ,
>  lag(4)
TradeDateNewNum is not regularly spaced

force works:
. newey LnRtFiveYrMid L(1/2).LnRtFiveYrMid L(0/4).LnRtCDX LnRtCMT
LnRtTED L(0/2).LnRtStock ,
>  lag(4) force

but I have problems with newey2 either way

. newey2 LnRtFiveYrMid L(1/2).LnRtFiveYrMid L(0/4).LnRtCDX LnRtCMT
LnRtTED L(0/2).LnRtStock
> , lag(4)
TradeDateNewNum is not regularly spaced -- use the force option to override
r(198);

. newey2 LnRtFiveYrMid L(1/2).LnRtFiveYrMid L(0/4).LnRtCDX LnRtCMT
LnRtTED L(0/2).LnRtStock
> , lag(4) force

not sorted
r(5);

The only thing I can think of is that one of my independent variables
in the regressions, LnRTCDX, is missing about 15 values over the range
of the time series.

This question was posted four years ago without a satisfactory reply
save for read the FAQ.
Can anyone help me to continue troubleshooting or to understand the
cause of these errors?

Output from original successful implementation of newey:

Regression with Newey-West standard errors          Number of obs  =     46545
maximum lag: 4                                      F( 12, 46532)  =    323.37
                                                    Prob > F       =    0.0000

------------------------------------------------------------------------------
             |             Newey-West
LnRtFiveYr~d |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
LnRtFiveYr~d |
         L1. |  -.1238135   .0154237    -8.03   0.000    -.1540441   -.0935829
         L2. |   -.043356    .013119    -3.30   0.001    -.0690694   -.0176426
     LnRtCDX |
         --. |   .4423975     .01975    22.40   0.000     .4036871    .4811079
         L1. |   .3530493   .0143778    24.56   0.000     .3248685      .38123
         L2. |   .0776956   .0143038     5.43   0.000     .0496599    .1057312
         L3. |   .0978518   .0105124     9.31   0.000     .0772474    .1184562
         L4. |   .0906659   .0097509     9.30   0.000     .0715539    .1097778
     LnRtCMT |  -.2242314   .0194782   -11.51   0.000     -.262409   -.1860538
     LnRtTED |  -.0140888      .0032    -4.40   0.000    -.0203609   -.0078166
   LnRtStock |
         --. |  -.1728564   .0566356    -3.05   0.002    -.2838631   -.0618497
         L1. |  -.1885385   .0431331    -4.37   0.000      -.27308   -.1039969
         L2. |  -.0669546   .0234642    -2.85   0.004    -.1129447   -.0209644
       _cons |   .0008108   .0002241     3.62   0.000     .0003716    .0012499
------------------------------------------------------------------------------

-- 
Thomas Jacobs
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index