Announcement

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

  • What does -teffects ipwra- actually do?

    Dear Statalist

    I am trying to figure out to understand what -teffects ipwra- actually does.

    I understand that -teffects ra-

    Code:
    webuse cattaneo2, clear
    
    // Regression adjustment
    teffects ra (bweight mmarried prenatal1 fbaby medu) (mbsmoke)
    does the following

    Code:
    // -teffects ra- using -regress-
    qui regress bweight mbsmoke##(mmarried prenatal1 fbaby c.medu)
    margins r.mbsmoke
    and -teffects ipw-

    Code:
    // Inverse probability of treatment weighting
    teffects ipw (bweight) (mbsmoke mmarried prenatal1 fbaby medu, logit)
    does this:

    Code:
    // -teffects ipw- using -regress-
    logit mbsmoke mmarried prenatal1 fbaby medu
    predict probab
    generate w = 1/probab       if mbsmoke == 1
    replace  w = 1/(1 - probab) if mbsmoke == 0
    regress bweight mbsmoke [pw = w]
    I would now assume that -teffects ipwra- does a combination of the two,
    but whatever I tried with -regress- didn't lead me to the -teffects ipwra-
    result (and I didn't find/understand the page in the documentation explaining
    what -teffects ipwra- actually does).

    Can anybody help?

    Thanks for your consideration
    KS

  • #2
    The teffects estimators appear to be implemented as gmm evaluator programs. I do not have the time to figure out the details, but here is how you replicate the ATE.

    Code:
    use http://www.stata-press.com/data/r15/cattaneo2 , clear
    
    teffects ipwra (bweight prenatal1 mmarried mage fbaby) ///
      (mbsmoke mmarried c.mage##c.mage fbaby medu, probit)
    
    tempvar p mbsmoke0 mbsmoke1 ate
    
    // treatment
    probit mbsmoke mmarried c.mage##c.mage fbaby medu
    predict `p' , pr
    
    // outcome
    regress bweight prenatal1 mmarried mage fbaby if !mbsmoke [pw = 1/(1-`p')]
    predict `mbsmoke0' , xb
    regress bweight prenatal1 mmarried mage fbaby if  mbsmoke [pw = 1/`p']
    predict `mbsmoke1' , xb
    
    // ATE
    generate `ate' = (`mbsmoke1' - `mbsmoke0')
    summarize `ate'
    Best
    Daniel

    Comment


    • #3
      Thanks, that's exactly what I wanted to know, I think!

      Best

      Comment


      • #4
        Thank you I got it. Daniel klein that was also my headache.

        Comment

        Working...
        X