I've read the manual, but I'm still unclear how the margins dydx option works for factor variables (eg for logistic regression). Consider a factor variable with 2 levels and the first as reference. My understanding is that for each case the margins command calculates the predicted probability when the second level = 1, the predicted probability when the second level = 0, takes the difference and then averages this over all cases.
How does this work with 3 level factor variables? If we are interested in the effect of level 2 relative to level 1, does it do this calculation for cases where the 3rd level is true? In other words, are the marginal effects for level 2 defined to be zero for cases where level 3 is true? Or does it simply do the counterfactual calculation in the paragraph above, ignoring the values of the other levels?
How does this work with 3 level factor variables? If we are interested in the effect of level 2 relative to level 1, does it do this calculation for cases where the 3rd level is true? In other words, are the marginal effects for level 2 defined to be zero for cases where level 3 is true? Or does it simply do the counterfactual calculation in the paragraph above, ignoring the values of the other levels?
Comment