From: E Hofstadler <e.hofstadler_at_gmail.com>

Date: Mon, 28 Mar 2011 09:44:37 +0300

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 28 Mar 2011 - 08:29:20 GMT

Date: Mon, 28 Mar 2011 09:44:37 +0300

Dear list,

My question to follow is not a pure R question but contains also a more general statistical/econometrical part, but I was hoping that perhaps someone knowledgable on this list could offer some help.

I have estimated a binary logistic regression model and would like to calculate average marginal effects for certain predictors of interest. The average marginal effect for a continuous variable cont has been given as

AME_cont = 1/n * SUM(beta_{cont} * prob(Y)* 1-prob(Y))

This seems easy enough to calculate with R.

However, the predictors I'm interested in are dummy variables, not continuous, and the following formula has been suggested for estimating the average marginal effect for dummies:

AME_dummy = 1/n*SUM(prob(Y| dummy=1) - prob(Y|dummy=0))

So according to this formula, the dummy is set to one and then to zero for each observation (with the rest of the variables set at their observed values), and the difference in the predicted values are averaged across all observations.

So here's my questions:

- (R-part:) How can I calculate AME_dummy in R? While predict() gets the fitted values for the actual observations, I'm not quite sure how to get predictions for the "counterfactual" part in AME_dummy, i.e. setting the dummy to one and then zero for each observation, while keeping the rest of the variables in the model at their observed values for each observation.
- (Econometric part: ) Would it be ok to use the formula for the AME_cont even though the variable in question is a dummy? I guess it might be problematic, since the continuous formula is based on a derivation and thus a marginal increase, whereas the dummy-formula looks at the change from 1 to zero -- am I correct?

Cheers,

Esther

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 28 Mar 2011 - 08:29:20 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Mon 28 Mar 2011 - 08:50:25 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*