Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • -regress- allows both robust/cluster and mse1 as options, it should not, this is a trap

    Good afternoon,

    -regress- has the option mse1 which makes it easy to get the inv(X’X) matrix, which you might want to use in further calculations.

    To my dismay today I discovered that
    1. Stata does not throw an error, when you specify both cluster/robust and mse1. E.g. -reg y x, robust mse1- does not generate an error or a warning.
    2. Not only this, but Stata also reports MSE = 1 in the regression header, when you specify both, e.g., -reg y x, robust mse1-.
    This behaviour can only lead to problems and errors, because when you specify both mse1 and robust/cluster, Stata does not calculate inv(X’X) in e(V), but rather the standard robust/cluster robust variance is placed in e(V). Not only this, but you would not notice anything irregular from the regression table because the header of the regression table claims that MSE =1, whatever that might mean when you have in e(V) the robust variance placed.
    The only way to detect that you are not getting what you asked for is to issue the calls sequentially and compare the results, e.g.
    reg y x, mse1
    matlist e(V)
    reg y x, robust
    matlist e(V)
    reg y x, mse1 robust
    matlist e(V)

    See the code below:

    Code:
    . reg price mpg headroom if !missing(rep), mse1
     
          Source |       SS           df       MS      Number of obs   =        69
    -------------+----------------------------------   F(2, 69)        >  99999.00
           Model |   123364948         2  61682473.8   Prob > F        =    0.0000
        Residual |   453432011        69  6571478.42   R-squared       =    0.2139
    -------------+----------------------------------   Adj R-squared   =    0.2253
           Total |   576796959        68  8482308.22   Root MSE        =         1
     
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             mpg |  -243.1092   .0225501 -1.1e+04   0.000    -243.1542   -243.0643
        headroom |  -288.1991   .1550501 -1858.75   0.000    -288.5084   -287.8898
           _cons |    12186.4   .7998794  1.5e+04   0.000     12184.81       12188
    ------------------------------------------------------------------------------
     
    . matlist e(V)
     
                 |       mpg   headroom      _cons
    -------------+---------------------------------
             mpg |  .0005085                      
        headroom |  .0013971   .0240405          
           _cons | -.0150173  -.1018658    .639807
     
    . reg price mpg headroom if !missing(rep), mse1 robust
     
    Linear regression                               Number of obs     =         69
                                                    F(2, 66)          =       7.49
                                                    Prob > F          =     0.0012
                                                    R-squared         =     0.2139
                                                    Root MSE          =          1
     
    ------------------------------------------------------------------------------
                 |               Robust
           price | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             mpg |  -243.1092   66.25903    -3.67   0.000    -375.3997   -110.8188
        headroom |  -288.1991    326.297    -0.88   0.380    -939.6722    363.2739
           _cons |    12186.4   2197.378     5.55   0.000     7799.194    16573.61
    ------------------------------------------------------------------------------
     
    . matlist e(V)
     
                 |       mpg   headroom      _cons
    -------------+---------------------------------
             mpg |  4390.259                      
        headroom |  11389.16   106469.8          
           _cons | -134681.3  -566200.5    4828471
     
    . reg price mpg headroom if !missing(rep), robust
     
    Linear regression                               Number of obs     =         69
                                                    F(2, 66)          =       7.49
                                                    Prob > F          =     0.0012
                                                    R-squared         =     0.2139
                                                    Root MSE          =     2621.1
     
    ------------------------------------------------------------------------------
                 |               Robust
           price | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             mpg |  -243.1092   66.25903    -3.67   0.000    -375.3997   -110.8188
        headroom |  -288.1991    326.297    -0.88   0.380    -939.6722    363.2739
           _cons |    12186.4   2197.378     5.55   0.000     7799.194    16573.61
    ------------------------------------------------------------------------------
     
    . matlist e(V)
     
                 |       mpg   headroom      _cons
    -------------+---------------------------------
             mpg |  4390.259                      
        headroom |  11389.16   106469.8          
           _cons | -134681.3  -566200.5    4828471
    Last edited by Joro Kolev; 06 May 2022, 07:45.

  • #2
    Dear Joro,

    I suppose that this should be reported to 'tech support' to have a close look at.

    Best,
    Eric
    http://publicationslist.org/eric.melse

    Comment

    Working...
    X