Logistic regression: Equation for marginal effect at the mean

I am estimating the following logistic regression (binomial family) by maximum likelihood:

$$\ln\left(\frac{Y}{1-Y}\right) = \beta_{0} + \beta_{1}D + \beta_{2}X + \epsilon$$

where D is a dummy. I am interested in the marginal effect at the mean of $$D$$, i.e. $$\beta_{1}$$ is of interest. What does the marginal effect at the mean look like in equation form? Would it be:

$$\frac{1}{\bar{Y}} \left(\frac{e^{\beta_{0}+\beta_{1}+\beta_{2}\bar{X}}}{1+e^{\beta_{0}+\beta_{1}+\beta_{2}\bar{X}}} - \frac{e^{\beta_{0}+\beta_{2}\bar{X}}}{1+e^{\beta_{0}+\beta_{2}\bar{X}}}\right)$$

or

$$\left(\frac{e^{\beta_{0}+\beta_{1}+\beta_{2}\bar{X}}}{1+e^{\beta_{0}+\beta_{1}+\beta_{2}\bar{X}}} - \frac{e^{\beta_{0}+\beta_{2}\bar{X}}}{1+e^{\beta_{0}+\beta_{2}\bar{X}}}\right)$$

My intuition is that Y corresponds to the probability of the event occurring, and the e/(1+e) terms also correspond to the probability of the event occurring, but at specific values of Y. What would the rationale for dividing by $$\bar{Y}$$ be? Thank you.

• despite its interest to economists, this question is likely to attract more answers at the Stats StackExchange (stats.stackexchange.com) – emeryville Dec 29 '19 at 10:41
• The marginal effect of $D$ on which indicator? What is $Y$? Is it really "the probability of the event occurring"? You should indicate the "LHS" function whose variations you want to measure after a change of $D$ by one unit. – Bertrand Jan 30 '20 at 7:34

OP's second expression corresponds to $$\Delta p = P(Y=1|D=1,X=\bar{X}) - P(Y=1|D=0,X=\bar{X}),$$ which is $$\Delta p = \Lambda(\beta_0 + \beta_1 + \beta_2 \bar{X}) - \Lambda(\beta_0 + \beta_2 \bar{X}),$$ where $$\Lambda(z) = e^z/(1+e^z)$$.
OP's first expression corresponds to $$(\Delta p)/p$$, where $$p$$ is the proportion of 1's in the sample $$P(Y=1)$$. This expresses the MEA $$\Delta p$$ as a ratio to $$p$$. This is informative as it lets us have better ideas on how large $$\Delta p$$ is. (For example, if we just have $$\Delta p=0.01$$, we don't know how large it is. But if $$p=0.02$$ is also given, then we know $$\Delta p=0.01$$ is a quite large effect as it is 50% of $$p$$.) One might call it "MEA as a ratio to Y-bar". Anyway, MEA usually refers to $$\Delta p$$, but if you mean $$(\Delta p)/p$$ by it, it should be OK as long as you explain it.
The MEA associated with $$D$$ can also mean $$\dot{p}=\partial P(Y=1|D=\bar{D},X=\bar{X})/\partial \bar{D}$$. As $$P(Y=1|D=\bar{D},X=\bar{X}) = \Lambda(\beta_0+\beta_1 \bar{D} + \beta_2 \bar{X})$$ for your logit model, we have $$\dot{p} = \frac{\partial \Lambda(\beta_0+\beta_1 \bar{D} + \beta_2 \bar{X})}{\partial \bar{D}} = \beta_1 \lambda(\beta_0 + \beta_1 \bar{D} + \beta_2 \bar{X}),$$ where $$\lambda(z) = \Lambda'(z) = e^z / (1+e^z)^2$$. Note that $$D$$ is binary but $$\bar{D}$$ is continuous so differentiation with respect to $$\bar{D}$$ makes sense. $$\Delta p$$ and $$\dot{p}$$ have different interpretations. I personally think $$\Delta p$$ in Part A is easier to understand as the notion of $$P(Y=1|D=\bar{D}, X=\bar{X})$$ is a bit awkward.