# Marginal effects of a logistic model, and their standard errors

I am using SAS to estimate some logistic models. Usually, I work with either MDs or social scientists, and odds ratios are the preferred metric. But I am now working with a client in economics/law and she wants the marginal effects and their standard errors, and she wants them at the means of the other variables.

This isn't easy in SAS, but, with help from tech support, I found that you can do this with PROC NLMIXED, I believe you then need the out = der option. Something like this

proc nlmixed data=olivia.small;
p=1/(1+exp(-(Intercept+ba*log_fund_age + bb*log_fund_size + bc*yield + bd*loaded + be*log_assets)));
model vote_code_num ~ binomial(1,p);
parms intercept 36.43 ba -14.55 bb -0.98 bc -0.37 bd 2.2 be -0.07;
predict p*(1-p)*ba out=a der;
predict p*(1-p)*bb out=b der;
predict p*(1-p)*bc out=c der;
predict p*(1-p)*bd out=d der;
predict p*(1-p)*be out=e der;
where year = 2003;
run;


but then the output data sets a, b, c, d and e have the derivatives and their standard deviations for each observation in the data set, not for the mean of the other variables. It's easy to find the mean of all those derivatives, but 1) Is that the same as the marginal at the mean of the other variables? and 2) How then to get the standard errors?

Peter

Some people would find such 'marginal effects' difficult to interpret and non-unique. There are other ways to get 'marginal effects' in binary logistic regression. Because of non-collapsibility of the odds ratio, marginal estimates are not well defined in general, and they can represent quantities that are not weighted averages over the factors you are unconditioning on. Mitch Gail has an example where the partial odds ratio for an exposure x2 is 9 for both x1=0 and x1=1 but is 5.44 when not holding x1 constant.

@ARTICLE{gai84bia,
author = {Gail, M.H. and Wieand, S. and Piantadosi, S.},
year = 1984,
title = {Biased estimates of treatment effect in randomized experiments with
nonlinear regressions and omitted covariates},
journal = Biometrika,
volume = 71,
pages = {431-444},
annote = {covariable adjustment;bias if omitted covariables and model is
nonlinear}
}


I wonder also whether you meant 'marginal effect' or 'effect on the original scale'. That would involve two different considerations. Effects on the log odds scale are easier to deal with, and you can relate odds ratios to absolute risk changes (as a function of starting risk) using a simple chart.

• Thanks Frank. I will look at that article. I believe what is wanted "marginal effect" that is, the effect of a one unit change in a particular variable at the means of the other variables in the model – Peter Flom Jul 21 '11 at 19:30
• In such a nonlinear model, this is not fully well-defined, e.g., if you fixed all the other variables at their medians you'd get a different "marginal effect." – Frank Harrell Jul 22 '11 at 12:47
• Yes, I know; but this is what my client says is normal in her field. It's not what I am used to - I think odds ratios are better. Or graphs of predicted probabilities – Peter Flom Jul 23 '11 at 10:10
• It's often tough to educate a client, but examples or simulations showing anomalies caused by their approach often does the trick. The best things about odds ratios is that you can take them out of context. But you can provide a nomogram or line graph showing how to convert to risk reduction. – Frank Harrell Jul 23 '11 at 15:09
• "Not well-defined" seems like a stretch to me. There are various marginal effects like average marginal effects, marginal effects at the mean/median, or at representative values. In non-linear models, they are all functions of covariates. Some are arguably better than others for a given purpose. Often, they are all quite close in practice. – Dimitriy V. Masterov Oct 30 '14 at 20:35

SAS Tech support solved this with the (now obvious) idea of adding a variable to the data set that has the average of all the variables.

Peter