Announcement

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

  • #76
    Clyde Schechter According to #74, it might be possible to create a DIDID setting in my context as specified in #75?

    Comment


    • #77
      Yes, I suppose you can do that. I think you will find it difficult to interpret the results given that you are, in effect, splitting the data into 9 groups based on two criteria that should be fairly strongly correlated with each other. And that, in turn, means that some of the provgroup#indgroup levels should have pretty small n's, so your analylsis might prove rather severely underpowered. And you would not be able to say that the causal policy effect was properly reflected by either provgroup or indgroup separately, but only by their interaction.

      There remains the question of whether that approach also makes economic sense--and I don't have the ability to advise you on that.

      Comment


      • #78
        Originally posted by Clyde Schechter View Post
        Rather than interpret this output, which requires some calculations that are easy to get wrong, go back and re-do the regression using factor variable notation instead of using your calculated interaction term d1d2. See -help fvvarlist-. Then run
        Code:
        margins d1#d2 // EXPECTED VALUE OF CSRI IN EACH GROUP PRE- AND POST-
        margins d1, dydx(d2) // MARGINAL EFFECT OF TREATMENT IN EACH TIME PERIOD
        The clearest explanation of the margins command is the excellent Richard Williams' https://www3.nd.edu/~rwilliam/stats/Margins01.pdf. It contains several worked examples, including some interaction models similar to yours.

        In the event you need assistance with that, when showing the output, please put it between code delimiters so it will be more readable and better aligned. See Forum FAQ #12 for instructions on using code delimiters if you are not familiar with them.
        Clyde Schechter Referring to post #6

        Are these commands also generally applicable in the case of a fixed effects regression?

        Comment


        • #79
          Well, the -margins- command can be used after any Stata estimation command. Evidently, reference to an interaction term is only possible when the regression command itself contains that interaction term.

          That said, there is a limitation you should be aware of. With conditional fixed-effects regressions (e.g. xtlogit, xtpoisson), although the -margins- command will provide estimates of predicted margins, those results are meaningless because those margins actually depend on the fixed effects, which are not estimated in those regressions. The predictions with the fixed effects constrained to zero may be useful in some circumstances, but are generally not helpful. So with conditional fixed-effects regressions, using -margins, dydx()- is fine, but straight-up -margins- should be used only if you are quite sure that constraining all the fixed effects to zero is meaningful and useful in your context (which, in general, it will not be.) This limitation does not apply to -xtreg, fe-, however, because it is not a conditional estimator and it does estimate the fixed effects.

          Comment


          • #80
            Clyde Schechter Thank you very much for your answer and explanation.

            I'm still a bit confused, though. My question was asked because I'm trying to run a DD model with fixed effects.

            Code:
            . xtreg anyMMactivity_conistent i.pre_post##i.treatment_2, fe
            note: 1.treatment_2 omitted because of collinearity
            
            Fixed-effects (within) regression               Number of obs     =      4,152
            Group variable: id                              Number of groups  =      2,177
            
            R-sq:                                           Obs per group:
                 within  = 0.3550                                         min =          1
                 between = 0.0811                                         avg =        1.9
                 overall = 0.2027                                         max =          2
            
                                                            F(2,1973)         =     542.92
            corr(u_i, Xb)  = 0.0188                         Prob > F          =     0.0000
            
            --------------------------------------------------------------------------------------
            anyMMactivity_coni~t |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            ---------------------+----------------------------------------------------------------
                      1.pre_post |   .3530466   .0231408    15.26   0.000     .3076637    .3984295
                   1.treatment_2 |          0  (omitted)
                                 |
            pre_post#treatment_2 |
                            1 1  |   .0710889   .0273197     2.60   0.009     .0175104    .1246674
                                 |
                           _cons |   .4939788   .0083795    58.95   0.000     .4775452    .5104124
            ---------------------+----------------------------------------------------------------
                         sigma_u |   .3280158
                         sigma_e |  .38652689
                             rho |  .41865935   (fraction of variance due to u_i)
            --------------------------------------------------------------------------------------
            F test that all u_i=0: F(2176, 1973) = 1.29                  Prob > F = 0.0000
            When I'm trying the commands you suggested I get empty tables, however, with the information "not estimtable".

            Code:
            . margins pre_post#treatment_2                                                                                                    //EXPECTED VALUE OF anyMMactivity_conis
            > tent IN EACH GROUP PRE- AND POST-
            
            Adjusted predictions                            Number of obs     =      4,152
            Model VCE    : Conventional
            
            Expression   : Linear prediction, predict()
            
            --------------------------------------------------------------------------------------
                                 |            Delta-method
                                 |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
            ---------------------+----------------------------------------------------------------
            pre_post#treatment_2 |
                            0 0  |          .  (not estimable)
                            0 1  |          .  (not estimable)
                            1 0  |          .  (not estimable)
                            1 1  |          .  (not estimable)
            --------------------------------------------------------------------------------------
            
            . margins pre_post, dydx(treatment_2)                                                                                             //MARGINAL EFFECT OF TREATMENT IN EACH
            > TIME PERIOD
            
            Conditional marginal effects                    Number of obs     =      4,152
            Model VCE    : Conventional
            
            Expression   : Linear prediction, predict()
            dy/dx w.r.t. : 1.treatment_2
            
            --------------------------------------------------------------------------------
                           |            Delta-method
                           |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
            ---------------+----------------------------------------------------------------
            0.treatment_2  |  (base outcome)
            ---------------+----------------------------------------------------------------
            1.treatment_2  |
                  pre_post |
                        0  |          .  (not estimable)
                        1  |          .  (not estimable)
            --------------------------------------------------------------------------------
            Note: dy/dx for factor levels is the discrete change from the base level.
            Any clue why this comes up? If I understand your response correctly, these tables should not be empty, right?

            Comment


            • #81
              I don't know why it comes up, but I also don't know why you'd want even the margins command at all here. DD already gives you your average treatment effect on the treated, why would one want marginal effects?

              Comment


              • #82
                Well, first of all the presentation of the results appears very handy to me. Secondly, I do not understand why there are no results in table. That raises my suspicion that the DD analysis was not performed correctly but I don't see the mistake.

                Comment


                • #83
                  I guess I misunderstood your question in #80. I thought you were contrasting your own situation with DD models and wondering what the general limits of applicability of these techniques is.

                  No, there is nothing wrong with the DD model. The command -margins treatment_2-, without the -dydx()- option, which is your first -margins-command would require Stata to produce results that are not estimable from the regression model. They are not estimable because the treatment_2 variable is colinear with the id level fixed effects. That leaves these predictive margins unidenfitiable. The marginal effects, calculated with -margins pre_post, dydx(treatment_2)- are estimable. But -margins- seems not to recognize this fact and gets "confused" by the mention of treatment_2. To get those results, add the -noestimcheck- option to that -margins, dydx()- command and you will get the results. As Jared Greathouse points out, these marginal effects may or may not be of interest. The estimated treatment effect is not found there: that is found as the coefficient of the interaction term in the regression output, and that should be the primary focus of your attention.

                  Comment


                  • #84
                    Thanks for the clarification!

                    Comment


                    • #85
                      Dear Sir, I
                      am working on a panel ( Households as the units and affiliation to the borrowing product as the change or intervention) with pre covid as Control and post covid as the Tretament group. There was a policy change in a rural finance product. This product was already taken by few households . After COVID the product affiliation declined. Is this a good model . I did not have a baseline data and had to work on survey data collected earlier
                      Household ID || Affiliation to Rural Fin product (1,0,1,0)|| Income (Outcome Y ) ||Period (0 for Post Covid & Pre Covid) Months

                      1,2,3,4,5,


                      I used DiD
                      (1) (2) (3)
                      VARIABLES Log Income Log Income Log Income
                      SHG*Covid 0.0459** -0.00859 -0.0644***
                      (0.0224) (0.0214) (0.0159)
                      SHG*Rural 0.249***
                      (0.0297)
                      SHG*Rural*Covid -0.145***
                      Log Expenses 0.947***
                      (0.0260) (0.012)
                      COVID 0.133*** 0.136*** -0.192***
                      (0.0243) (0.0241) (0.0222)
                      SHG 0.0267 0.115*** -0.0115
                      (0.0163) (0.0144) (0.0102)
                      Education 0.132*** 0.132*** 0.0477***
                      (0.00447) (0.00448) (0.003)
                      Gender 0.0739*** 0.0721*** 0.0168**
                      (0.0115) (0.0116) (0.008)
                      Constant 10.68*** 10.67*** 2.026***
                      (0.183) (0.180) (0.199)
                      Observations 18,753 18,753 18,753
                      R-squared 0.200 0.196 0.526
                      State Fixed effect Yes Yes Yes
                      Period fixed effect Yes Yes Yes
                      Period fixed effect Yes Yes Yes
                      Using equation : constant + Treatment*post + Post + Treatment
                      Last edited by nishi malhotra; 21 Mar 2022, 15:15.

                      Comment

                      Working...
                      X