Announcement

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

  • Endogenous Factor Variables in IV Poisson and the Margins Command

    Hello all,

    I am doing an IV estimation with a count dependent variable and two endogenous variables, one of which is an interaction term. I want to conduct a marginal analysis using the command
    Code:
    margins
    after my estimation.

    Thus far, I have been able to accomplish this using the ivregress command with the following lines of code:
    Code:
    ivregress 2sls days_missed_09 treatedHH carer_score_max carer_score_max2 /// 
                    total_chronically_ill hh_sex_07 hh_wage_emp days_missed_07 hh_cons_total_DT_07 ///
                    own_livestock hh_agland_acres_07 rural hh_size_07 ( i.fined i.fined#c.hh_cons_total_DT_07 ///
                    = i.conditions i.conditions#c.hh_cons_total_DT_07 ), vce(cluster district) 
            
                margins, dydx(fined) at(hh_cons_total_DT_07=(.669 .948 1.405 1.952 2.772)) vsquish
    Since the outcome variable is a count variable, however, I want to be able to use an IV poisson specification to accomplish this as well. Specifically, I want to be able to run the following code:
    Code:
    ivpoisson cfunc days_missed_09 treatedHH carer_score_max carer_score_max2 /// 
                    total_chronically_ill hh_sex_07 hh_wage_emp days_missed_07 hh_cons_total_DT_07 ///
                    own_livestock hh_agland_acres_07 rural hh_size_07 ( i.fined i.fined#c.hh_cons_total_DT_07 ///
                    = i.conditions i.conditions#c.hh_cons_total_DT_07 ), vce(cluster district) 
            
                margins, dydx(fined) at(hh_cons_total_DT_07=(.669 .948 1.405 1.952 2.772)) vsquish
    Unfortunately, when I do so I receive the following error message:

    Code:
    endogenous regressors cannot be factor variables
    r(198);
    Now, I would be more than happy to generate the endogenous interaction term by hand and run ivpoisson. However, I want to conduct a marginal analysis of "fined" by different values of "hh_cons_total_DT_07" and I do not think that I can do that using the margins command unless I use the factor variable notation. Are there any suggestions for getting around this?

    Thank you!

  • #2
    You can always assign more than one value at a time in margins so you can create the interactions and then when you do margins set the values for both main and interactions to be appropriate. It is a lot easier if you can use factor variable notation (since Stata handles the "appropriate" for you), but it is quite doable with manually created interactions.

    Comment


    • #3
      Phil,

      Thank you very much for the help. I am wondering exactly how I would specify the margins command if I were to manually generate the interaction terms. For example, if I took the derivative with respect to "fined", how would the margins command know that the interaction term is a function of "fined" as well, if it is created manually? I see how Stata could understand that with factor variables and interactions using the # operator, but not with manually-created interactions.

      Thanks again.

      Comment

      Working...
      X