Announcement

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

  • Testing the joint significance of the mean with clustering option

    I am replicating one of Krueger's papers.

    I would like to test whether the mean of freelunchk given three groups ctypek==1/2/3 are jointly equal to 0, with the clustering option (assume freelunchk has the same standard deviation with the same school schid). I try reg with cluster option, estout command, ttest for several days, but that does not work. Could you please help me solve the problem? Thank you!

  • #2
    Yiling:
    why not going -regress-? (please note that in the following toy-example clustered standard errors are totally misleading, as they are way below the 30 rule of thumb threshold).
    Code:
    . sysuse auto.dta
    . regress weight i.rep78 price, vce(cluster foreign)
    
    Linear regression                               Number of obs     =         69
                                                    F(0, 1)           =          .
                                                    Prob > F          =          .
                                                    R-squared         =     0.4895
                                                    Root MSE          =     588.53
    
                                    (Std. err. adjusted for 2 clusters in foreign)
    ------------------------------------------------------------------------------
                 |               Robust
          weight | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           rep78 |
              2  |   50.37226   14.41343     3.49   0.177    -132.7678    233.5123
              3  |  -71.28614   238.7848    -0.30   0.815    -3105.334    2962.762
              4  |   -448.434   732.0831    -0.61   0.650    -9750.432    8853.564
              5  |  -972.7328   29.62635   -32.83   0.019    -1349.171   -596.2943
                 |
           price |   .1449463   .0102724    14.11   0.045     .0144233    .2754692
           _cons |   2438.393   46.88828    52.00   0.012     1842.621    3034.165
    ------------------------------------------------------------------------------
    
    . mat list e(b)
    
    e(b)[1,7]
                1b.          2.          3.          4.          5.                        
             rep78       rep78       rep78       rep78       rep78       price       _cons
    y1           0   50.372265  -71.286141  -448.43403  -972.73277   .14494627   2438.3928
    
    . test 2.rep78=3.rep78=4.rep78
    
     ( 1)  2.rep78 - 3.rep78 = 0
     ( 2)  2.rep78 - 4.rep78 = 0
           Constraint 1 dropped
    
           F(  1,     1) =    0.48
                Prob > F =    0.6133
    
    . regress weight i.rep78 price
    
          Source |       SS           df       MS      Number of obs   =        69
    -------------+----------------------------------   F(5, 63)        =     12.08
           Model |  20924760.3         5  4184952.07   Prob > F        =    0.0000
        Residual |  21820955.6        63  346364.375   R-squared       =    0.4895
    -------------+----------------------------------   Adj R-squared   =    0.4490
           Total |  42745715.9        68   628613.47   Root MSE        =    588.53
    
    ------------------------------------------------------------------------------
          weight | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           rep78 |
              2  |   50.37226   466.5591     0.11   0.914    -881.9716    982.7161
              3  |  -71.28614   432.2574    -0.16   0.870    -935.0836    792.5113
              4  |   -448.434   440.2368    -1.02   0.312    -1328.177    431.3091
              5  |  -972.7328   453.6275    -2.14   0.036    -1879.235   -66.23058
                 |
           price |   .1449463   .0246846     5.87   0.000     .0956181    .1942745
           _cons |   2438.393   431.1349     5.66   0.000     1576.838    3299.947
    ------------------------------------------------------------------------------
    
    . mat list e(b)
    
    e(b)[1,7]
                1b.          2.          3.          4.          5.                        
             rep78       rep78       rep78       rep78       rep78       price       _cons
    y1           0   50.372265  -71.286141  -448.43403  -972.73277   .14494627   2438.3928
    
    . test 2.rep78=3.rep78=4.rep78
    
     ( 1)  2.rep78 - 3.rep78 = 0
     ( 2)  2.rep78 - 4.rep78 = 0
    
           F(  2,    63) =    2.99
                Prob > F =    0.0573
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dear Mr. Lazzaro,

      I wanted to express my heartfelt thanks for your quick and helpful response. I just solved the problem. Thank you!!! Have a nice day!!!

      Best,
      Yiling

      Comment


      • #4
        Yiling:
        Carlo is enough! ! Thanks.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X