Announcement

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

  • Why these 2 models that should be equivalent gives slightly different output?

    I'm running the following code:
    Code:
    clear all
    
    webuse hospdd, clear
    
    didregress (satis) (procedure), group(hospital) time(month)
    estimates store model1
    
    regress satis i.hospital i.month i.procedure, cluster(hospital)
    estimates store model2
    
    etable
    The treatment effect is exactly the same, both the coefficient and the standard error.

    The time fixed-effects are exactly the same (both coefficient and standard error).

    However, there are two differences:
    1. The `didregress` output do not report group fixed-effects (Group ID).
    2. The intercept is slightly different. For `didregress`, the estimated intercept is 3.445 with a standard error of (0.011).
    While in `regress` the coefficient equals 3.172 with a standard error of (0.017)

    Why there are these differences between these 2 models?




  • #2
    I don't know about your first question, but it might be that didregress uses something like xtreg , i() fe vce(cluster ) or areg , absorb() vce(cluster ) under the hood.

    I think that the answer to your second one has to do with didregress's marginalizing over hospitals, while the regression table for regress shows the intercept for the first (omitted) hospital. See below.

    .ÿ
    .ÿversionÿ17.0

    .ÿ
    .ÿclearÿ*

    .ÿ
    .ÿquietlyÿwebuseÿhospdd

    .ÿ
    .ÿquietlyÿdidregressÿ(satis)ÿ(procedure),ÿgroup(hospital)ÿtime(month)

    .ÿlincomÿ_b[Controls:_cons]

    ÿ(ÿ1)ÿÿ[Controls]_consÿ=ÿ0

    ------------------------------------------------------------------------------
    ÿÿÿÿÿÿÿsatisÿ|ÿCoefficientÿÿStd.ÿerr.ÿÿÿÿÿÿtÿÿÿÿP>|t|ÿÿÿÿÿ[95%ÿconf.ÿinterval]
    -------------+----------------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿ(1)ÿ|ÿÿÿ3.444675ÿÿÿÿ.011354ÿÿÿ303.39ÿÿÿ0.000ÿÿÿÿÿ3.421807ÿÿÿÿ3.467543
    ------------------------------------------------------------------------------

    .ÿ
    .ÿquietlyÿregressÿsatisÿi.(hospitalÿmonthÿprocedure),ÿvce(clusterÿhospital)

    .ÿ//ÿNotÿthis,ÿwhichÿisÿtheÿinterceptÿforÿHospitalÿ1
    .ÿlincomÿ_b[_cons]

    ÿ(ÿ1)ÿÿ_consÿ=ÿ0

    ------------------------------------------------------------------------------
    ÿÿÿÿÿÿÿsatisÿ|ÿCoefficientÿÿStd.ÿerr.ÿÿÿÿÿÿtÿÿÿÿP>|t|ÿÿÿÿÿ[95%ÿconf.ÿinterval]
    -------------+----------------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿ(1)ÿ|ÿÿÿ3.171657ÿÿÿ.0172328ÿÿÿ184.05ÿÿÿ0.000ÿÿÿÿÿ3.136948ÿÿÿÿ3.206365
    ------------------------------------------------------------------------------

    .ÿ
    .ÿ//ÿButÿratherÿthisÿ(marginalizedÿoverÿhospitals)
    .ÿmarginsÿ,ÿat(monthÿ=ÿ1ÿprocedureÿ=ÿ0)

    PredictiveÿmarginsÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNumberÿofÿobsÿ=ÿ7,368
    ModelÿVCE:ÿRobust

    Expression:ÿLinearÿprediction,ÿpredict()
    At:ÿmonthÿÿÿÿÿ=ÿ1
    ÿÿÿÿprocedureÿ=ÿ0

    ------------------------------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿÿÿÿÿÿÿÿÿÿDelta-method
    ÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿÿÿMarginÿÿÿstd.ÿerr.ÿÿÿÿÿÿtÿÿÿÿP>|t|ÿÿÿÿÿ[95%ÿconf.ÿinterval]
    -------------+----------------------------------------------------------------
    ÿÿÿÿÿÿÿ_consÿ|ÿÿÿ3.444675ÿÿÿÿ.011354ÿÿÿ303.39ÿÿÿ0.000ÿÿÿÿÿ3.421807ÿÿÿÿ3.467543
    ------------------------------------------------------------------------------

    .ÿ
    .ÿexit

    endÿofÿdo-file


    .

    Comment


    • #3
      Hi Joseph,
      thanks so much for your answer!
      1. I think it does `areg`. In fact, if I try to use `xtreg` like so:
      Code:
      xtreg satis i.procedure, i(month) fe vce(cluster hospital)
      I get the error "panels are not nested within clusters".

      Instead
      Code:
      areg satis i.month i.procedure, absorb(hospital) vce(cluster hospital)
      works and give the same result of the didregress!

      2. Indeed it is. And `areg` already seems to report the correct coefficient!

      Thanks

      Comment


      • #4
        Originally posted by Giuseppe Polito View Post
        if I try to use `xtreg` like so: . . . I get the error "panels are not nested within clusters".
        You used incorrect syntax for xtreg. The model needs to be specified in the same manner as for didregress and areg, viz.:
        Code:
        xtreg satis i.(procedure month), i(hospital) fe vce(cluster hospital)

        give the same result of the didregress! . . . And `areg` already seems to report the correct coefficient!
        As do xtreg and regress (when marginalized over the fixed effects of hospital). Why wouldn't they?

        Comment


        • #5
          Yes, I meant to say that `areg` would return the same coefficient of `didregress` out oft the box.

          It looks like that also:
          Code:
          xtreg satis i.(procedure month), i(hospital) fe vce(cluster hospital)
          returns the marginalized coefficient out of the box, while
          Code:
          regress satis i.(procedure month hospital), vce(cluster hospital)
          does not

          Comment

          Working...
          X