Announcement

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

  • different coefficients while performing didregress and regress

    Hi everyone,

    I am working on a DiD analysis. I have performed both didregress and reg, but the coefficients that came out differ slightly. The analysis is about the effect of a policy change in certain hospitals on the mean healthcare costs per insured year, compared to other hospitals that did not implement this policy change. The years of interest go from 2011 until 2019.

    Moreover, when I want to perform estat trendplots after the didregress command, I get the error "treatment assignment times vary; not allowed with estat trendplots"

    I hope anyone can help me solve this problem!

    Thank you!!

    Code:
    jaar    geslacht    leeftijdsklasse    postcode_3    aantal_bsn    aantal_verzekerdejaren    kosten_medisch_specialistische_z    zorgkosten_totaal    kosten_medspeczorg_per_verzjaar    Sex    HospitalName    post1    treat    TreatmentEffect
    2011    M    0    0    399    161.19    673,096    799,513    4,176    1    Other    0    0    0
    2011    M    0    101    608    314.16    1,141,314    1,248,520    3,633    1    Other    0    0    0
    2011    M    0    102    300    142.04    570,652    637,409    4,018    1    Other    0    0    0
    2011    M    0    103    287    137.22    1,459,150    1,692,445    10,634    1    Other    0    0    0
    2011    M    0    105    1049    509.1    3,036,502    3,300,447    5,964    1    Other    0    0    0
    2011    M    0    106    1099    557.27    2,918,753    3,214,812    5,238    1    Other    0    0    0
    2011    M    0    107    744    353.84    1,819,640    1,982,995    5,143    1    Other    0    0    0
    2011    M    0    108    315    153.85    778,080    837,113    5,057    1    Other    0    0    0
    Code:
    gen post1 = (jaar >= 2015) if !missing(jaar)
    
    * A dummy variable is created which distincts if a hospital is part of the treatment group or the control group.
    gen treat = 1 if HospitalName == "Ommelander" |HospitalName == "Bernhoven" | HospitalName == "Pantein"
    replace treat = 0 if treat == .
    
    * A variable is created which calculates the difference-in-difference estimator for the regression analysis.
    gen TreatmentEffect = post1 * treat
    
    * A difference-in-difference analysis is being performed.
    
    didregress (kosten_medspeczorg_per_verzjaar leeftijdsklasse Sex) (TreatmentEffect), group(postcode_3) time(jaar)
    
    * A regression analysis is being performed which includes the difference-in-difference effect.
    
    reg kosten_medspeczorg_per_verzjaar TreatmentEffect i.leeftijdsklasse Sex i.jaar i.postcode_3, vce(cluster postcode_3)

  • #2
    The didregress command gives me the following result:

    Code:
    Number of groups and treatment time
    
    Time variable: jaar
    Control:       TreatmentEffect = 0
    Treatment:     TreatmentEffect = 1
    -----------------------------------
                 |   Control  Treatment
    -------------+---------------------
    Group        |
      postcode_3 |       771         29
    -------------+---------------------
    Time         |
         Minimum |      2011       2015
         Maximum |      2017       2015
    -----------------------------------
    
    Difference-in-differences regression                 Number of obs = 1,229,925
    Data type: Repeated cross-sectional
    
                                  (Std. err. adjusted for 800 clusters in postcode_3)
    ---------------------------------------------------------------------------------
                    |               Robust
    kosten_medspe~r | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    ----------------+----------------------------------------------------------------
    ATET            |
    TreatmentEffect |
          (1 vs 0)  |  -45.96462   13.23776    -3.47   0.001    -71.94952   -19.97972
    ---------------------------------------------------------------------------------
    Note: ATET estimate adjusted for covariates, group effects, and time effects.

    The reg command gives the following results:

    Code:
    Linear regression                               Number of obs     =  1,229,925
                                                    F(99, 799)        =          .
                                                    Prob > F          =          .
                                                    R-squared         =     0.5819
                                                    Root MSE          =     1000.7
    
                                  (Std. err. adjusted for 800 clusters in postcode_3)
    ---------------------------------------------------------------------------------
                    |               Robust
    kosten_medspe~r | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    ----------------+----------------------------------------------------------------
    TreatmentEffect |  -45.14061   13.37775    -3.37   0.001     -71.4003   -18.88092
                    |
    leeftijdsklasse |
                 1  |  -5180.328   38.38068  -134.97   0.000    -5255.667   -5104.989
                 2  |  -5477.332   39.36555  -139.14   0.000    -5554.605    -5400.06
                 3  |  -5482.041   39.39597  -139.15   0.000    -5559.372   -5404.709
                 4  |  -5534.083   39.49704  -140.11   0.000    -5611.613   -5456.553
                 5  |  -5564.337   39.55385  -140.68   0.000    -5641.979   -5486.695
                 6  |  -5585.008   39.68362  -140.74   0.000    -5662.905   -5507.112
                 7  |  -5629.648   39.88622  -141.14   0.000    -5707.942   -5551.353
                 8  |  -5648.162   39.76554  -142.04   0.000    -5726.219   -5570.104
                 9  |  -5657.584   39.83417  -142.03   0.000    -5735.776   -5579.392
                10  |  -5654.039    40.0026  -141.34   0.000    -5732.561   -5575.516
                11  |  -5643.595   40.37906  -139.77   0.000    -5722.857   -5564.334
                12  |  -5640.504   40.39553  -139.63   0.000    -5719.798    -5561.21
                13  |  -5621.224   40.41216  -139.10   0.000    -5700.551   -5541.897
                14  |  -5577.343   40.48375  -137.77   0.000     -5656.81   -5497.876
                15  |  -5555.966   40.23838  -138.08   0.000    -5634.951    -5476.98
                16  |  -5535.566    40.1209  -137.97   0.000    -5614.321   -5456.811
    The reg command results go beyond for 800+ rows, but for simplicity I will only show the first rows.

    Comment


    • #3

      leeftijdsklasse vs. i.leeftijdsklasse ?

      Comment


      • #4
        Hi George,
        Thank you! I have tried leeftijdsklasse instead of i.leeftijdsklasse (and similar commands for postcode_3 and jaar) but then I get an overall full-effect coefficient. The variable leeftijdsklasse consists of 91 observations and I need their coefficients too. Same goes for postcode_3 and jaar, both have multiple observations. Also, the the TreatmentEffect coefficient changed even more:

        Code:
         reg kosten_medspeczorg_per_verzjaar TreatmentEffect leeftijdsklasse Sex jaar postcode_3, vce(clu
        > ster postcode_3)
        
        Linear regression                               Number of obs     =  1,229,925
                                                        F(5, 799)         =   14951.66
                                                        Prob > F          =     0.0000
                                                        R-squared         =     0.3247
                                                        Root MSE          =     1271.4
        
                                      (Std. err. adjusted for 800 clusters in postcode_3)
        ---------------------------------------------------------------------------------
                        |               Robust
        kosten_medspe~r | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        ----------------+----------------------------------------------------------------
        TreatmentEffect |  -2.268677   19.46112    -0.12   0.907    -40.46965    35.93229
        leeftijdsklasse |   33.93209   .1354591   250.50   0.000     33.66619    34.19799
                    Sex |   105.7558   3.245623    32.58   0.000     99.38485    112.1268
                   jaar |   26.93859   .5275116    51.07   0.000     25.90311    27.97406
             postcode_3 |  -.0285215   .0172067    -1.66   0.098    -.0622972    .0052543
                  _cons |  -54324.75    1063.32   -51.09   0.000    -56411.98   -52237.52

        Comment


        • #5
          Whatever leeftijdsklasse is, enter it properly in both commands.

          What may be happening is the didregress appears to adjusting the effect side to fit the mean of treated xs. You could use margins to do the same after reg. It’s a small difference so that could explain it.

          Comment

          Working...
          X