Announcement

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

  • Regression with propensity score

    Dear all
    I am trying to estimates the dynamic treatment effect while using propensity scores. I would normally use the 'teffects psmatch' command however, I'm not sure whether it matches on my dynamic treatment effects or how I can include them in my model?

    fx.

    teffects psmatch (bweight) (mbsmoke mmarried mage prenatal1 fbaby mbsmoke*year, probit)

    Can anyone help?


    ​​​​​​​Thanks!

  • #2
    If you'd like to examine treatment effects by year, you must have a pooled cross-sectional or panel data. More information would be helpful: What's the data structure? What's the nature of the treatment -- Treatment happens every year? If data are panel, treatment happens to the same group of subjects every year? etc.

    Comment


    • #3
      I have panel-data, where I observe each individuel over at 10 year periode. Treatment = 1 if mother smoked during pregnancy og 0 if not.
      And sorry, it not bweight, but body mass index that is my dependent variable.

      Comment


      • #4
        If I understand correctly, you are examining the effect of mother smoking during pregnancy on children's BMI. So in the data, if an individual (child) is treated (mother smoked), s/he will always be treated during the 10 years. A comprehensive matching would be based on characteristics that predict mother smoking in every year. It's a bit complicated. First, I would reshape wide the covariates that predict mother smoking, say x and z, to x1, x2, ..., x10, z1, z2, ..., z10. Then I would match based on the cross-sectional data as below

        Code:
        psmatch2 mbsmoke x1 ... x10 z1 ... z10, ate
        -psmatch2- is from SSC and you will obtain a weight variable called "_weight". Then reshape the data back to long form and run a weighted regression as below.

        Code:
        reg bmi mbsmoke c.mbsmoke#c.year covariates [aw=_weight]
        -psmatch2- instead of -teffects psmatch- is used because it's easier to obtain the weights from the former. In practice, x and z are likely predetermined variables, like mother's education and birth year, etc. In such cases, x and z may be time invariant, and you may only need to include, say x1 and z1 in the matching equation.
        Last edited by Fei Wang; 29 Nov 2021, 11:45.

        Comment


        • #5
          Thanks, but when you say reshape to wide format, is it then dummies for each nominal variable?
          And how come you weight? and not just use the _pscore? e.g.
          reg bmi mbsmoke _pscore c.mbsmoke#c.year covariates

          Comment


          • #6
            but when you say reshape to wide format, is it then dummies for each nominal variable?
            No. It's still the same variable, but arranged in a row rather than in a column.

            And how come you weight? and not just use the _pscore? e.g.
            reg bmi mbsmoke _pscore c.mbsmoke#c.year covariates
            Directly controlling for pscores is not the way that PSM works. "_weight" reflects the matching results based on pscores and should be used as weights in regression. There are other ways of matching dependent on pscores, like -teffects ipw-, but again pscores are used to construct weights rather than become covariates.

            Comment


            • #7
              Thanks a lot! I really can't see why, I have to reshape the data to wide format to estimate the weight. Can you explain it to me?

              .

              Comment


              • #8
                Originally posted by Mads Oernfeldt View Post
                Thanks a lot! I really can't see why, I have to reshape the data to wide format to estimate the weight. Can you explain it to me?

                .
                Because I'd like to match predictors of every year simultaneously. For example, two individuals form a pair of match if their characteristics in years 1, 2, ..., 10 are simultaneously similar. But if your predictors are all predetermined and time invariant, you may not need to reshape wide, just match based on a cross-section in a specific year, and then make weights identical within each individual.

                Code:
                psmatch2 mbsmoke x z if year == 1
                bys id (_weight): replace _weight = _weight[1]
                By the way, there is a typo in #4, and "ate" should be dropped from the option -- Without "ate", matching is for ATT, and "_weights" can directly be used in regressions; with "ate", matching is for ATE, and "_weights" need to be adjusted before being used in regressions. Below is an example showing how weighted regressions replicate PSM results.

                Code:
                . webuse cattaneo2, clear
                (Excerpt from Cattaneo (2010) Journal of Econometrics 155: 138-154)
                
                . psmatch2 mbsmoke mmarried mage fbaby medu, outcome(bweight)             //ATT
                
                Probit regression                               Number of obs     =      4,642
                                                                LR chi2(4)        =     353.55
                                                                Prob > chi2       =     0.0000
                Log likelihood = -2053.9723                     Pseudo R2         =     0.0792
                
                ------------------------------------------------------------------------------
                     mbsmoke |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                -------------+----------------------------------------------------------------
                    mmarried |  -.5848065   .0512795   -11.40   0.000    -.6853124   -.4843005
                        mage |  -.0023797   .0047683    -0.50   0.618    -.0117255     .006966
                       fbaby |  -.2610501   .0485017    -5.38   0.000    -.3561116   -.1659885
                        medu |  -.0784464    .009713    -8.08   0.000    -.0974836   -.0594092
                       _cons |   .6177995   .1396324     4.42   0.000      .344125    .8914741
                ------------------------------------------------------------------------------
                --------------------------------------------------------------------------------------
                > --
                        Variable     Sample |    Treated     Controls   Difference         S.E.   T-st
                > at
                ----------------------------+---------------------------------------------------------
                > --
                         bweight  Unmatched | 3137.65972   3412.91159  -275.251871   21.4528037   -12.
                > 83
                                        ATT | 3137.65972   3330.58333  -192.923611   55.0326373    -3.
                > 51
                ----------------------------+---------------------------------------------------------
                > --
                Note: S.E. does not take into account that the propensity score is estimated.
                
                           | psmatch2:
                 psmatch2: |   Common
                 Treatment |  support
                assignment | On suppor |     Total
                -----------+-----------+----------
                 Untreated |     3,778 |     3,778 
                   Treated |       864 |       864 
                -----------+-----------+----------
                     Total |     4,642 |     4,642 
                
                . reg bweight mbsmoke [aw=_weight]
                (sum of wgt is 1,728)
                
                      Source |       SS           df       MS      Number of obs   =     1,153
                -------------+----------------------------------   F(1, 1151)      =     29.72
                       Model |  10728526.6         1  10728526.6   Prob > F        =    0.0000
                    Residual |   415477335     1,151  360970.752   R-squared       =    0.0252
                -------------+----------------------------------   Adj R-squared   =    0.0243
                       Total |   426205862     1,152  369970.366   Root MSE        =    600.81
                
                ------------------------------------------------------------------------------
                     bweight |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                -------------+----------------------------------------------------------------
                     mbsmoke |  -192.9236   35.38762    -5.45   0.000    -262.3551   -123.4921
                       _cons |   3330.583   25.02283   133.10   0.000     3281.488    3379.679
                ------------------------------------------------------------------------------
                
                . 
                . psmatch2 mbsmoke mmarried mage fbaby medu, outcome(bweight) ate         //ATE
                
                Probit regression                               Number of obs     =      4,642
                                                                LR chi2(4)        =     353.55
                                                                Prob > chi2       =     0.0000
                Log likelihood = -2053.9723                     Pseudo R2         =     0.0792
                
                ------------------------------------------------------------------------------
                     mbsmoke |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                -------------+----------------------------------------------------------------
                    mmarried |  -.5848065   .0512795   -11.40   0.000    -.6853124   -.4843005
                        mage |  -.0023797   .0047683    -0.50   0.618    -.0117255     .006966
                       fbaby |  -.2610501   .0485017    -5.38   0.000    -.3561116   -.1659885
                        medu |  -.0784464    .009713    -8.08   0.000    -.0974836   -.0594092
                       _cons |   .6177995   .1396324     4.42   0.000      .344125    .8914741
                ------------------------------------------------------------------------------
                --------------------------------------------------------------------------------------
                > --
                        Variable     Sample |    Treated     Controls   Difference         S.E.   T-st
                > at
                ----------------------------+---------------------------------------------------------
                > --
                         bweight  Unmatched | 3137.65972   3412.91159  -275.251871   21.4528037   -12.
                > 83
                                        ATT | 3137.65972   3330.58333  -192.923611   55.0326373    -3.
                > 51
                                        ATU | 3412.91159   3179.69217  -233.219428            .       
                >  .
                                        ATE |                          -225.719302            .       
                >  .
                ----------------------------+---------------------------------------------------------
                > --
                Note: S.E. does not take into account that the propensity score is estimated.
                
                           | psmatch2:
                 psmatch2: |   Common
                 Treatment |  support
                assignment | On suppor |     Total
                -----------+-----------+----------
                 Untreated |     3,778 |     3,778 
                   Treated |       864 |       864 
                -----------+-----------+----------
                     Total |     4,642 |     4,642 
                
                . replace _weight = cond(!mi(_weight), _weight+1, 1)
                (4,642 real changes made)
                
                . reg bweight mbsmoke [aw=_weight]
                (sum of wgt is 9,284)
                
                      Source |       SS           df       MS      Number of obs   =     4,642
                -------------+----------------------------------   F(1, 4640)      =    167.50
                       Model |  59126550.4         1  59126550.4   Prob > F        =    0.0000
                    Residual |  1.6379e+09     4,640  352994.423   R-squared       =    0.0348
                -------------+----------------------------------   Adj R-squared   =    0.0346
                       Total |  1.6970e+09     4,641  365658.408   Root MSE        =    594.13
                
                ------------------------------------------------------------------------------
                     bweight |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                -------------+----------------------------------------------------------------
                     mbsmoke |  -225.7193    17.4406   -12.94   0.000    -259.9112   -191.5274
                       _cons |   3397.588   12.33236   275.50   0.000     3373.411    3421.765
                ------------------------------------------------------------------------------

                Comment


                • #9
                  Thanks a lot Fei Wang.
                  I tried to assume time invarient, however it did not seem pausible and my results seems to depend a lot on which year I'm weighting on.
                  I therefore tried your time varient version. However, when I use the psmatch command in wideformat data is treatment (mbsmoke) ommited, because it does not vary in time. What is the solution to this problem? I used the following commands:

                  reshape wide mbsmoke x z, i(id) j(year)
                  psmatch mbsmoke* x* z*


                  Comment


                  • #10
                    You only need to reshape wide time-varying predictors (like x and z), and time-invariant variable (like mbsmoke) will automatically fit in.

                    Code:
                    reshape wide x z, i(id) j(year)
                    psmatch2 mbsmoke x* z*

                    Comment


                    • #11
                      Thanks Fei! I'm though now told, that I should not use matching but instead inverse probability weighting regression adjustment. Is this possible with the psmatch2 command?

                      Comment


                      • #12
                        For this method, you may want to check

                        Code:
                        help teffects ipwra

                        Comment

                        Working...
                        X