The marginal effect of a predictor in a categorical response model estimates how much the probability of a response level changes as the predictor changes. For a continuous predictor, the marginal effect is defined as the partial derivative of the event probability with respect to the predictor of interest. For a binary categorical predictor, it is the change in event probability when the predictor is changed between its levels.
As a derivative, the marginal effect is the slope of a line drawn tangent to the fitted probability curve at the selected point. It is the instantaneous rate of change of the probability at that point. Note that the marginal effect depends on the predictor setting that corresponds to the selected point at which this tangent line is drawn, so the marginal effect of a variable is not constant. A measure of the overall effect of the predictor is the average of the marginal effects (AME). An alternative overall measure is marginal effect evaluated at the mean of all of the predictors (MEM). For small samples, the AME is considered the better measure.
Note that if the fitted probability curve is approximately linear (as it is near p=0.5) at the selected point, then the tangent line will closely approximate the fitted curve and the marginal effect will closely approximate the change in probability when changing the predictor by a fixed amount such as one unit. But in areas where the curve is nonlinear (near the smallest and largest values of p), the marginal effect might deviate substantially from the change over a fixed amount.
For a categorical predictor, the derivative is not strictly defined. In this case, the marginal effect is measured by the change in predicted probability between its levels.
For a binary logistic main-effects model, logit(p)=Σixiβi , the marginal effect of xi is equal to p(1–p)bi , where p is the event probability at the chosen setting of the predictors and bi is the parameter estimate for xi . The binary probit main-effects model is Φ-1(p)=Σixiβi , where Φ-1 is the inverse of the cumulative normal distribution function, or probit. The marginal effect of xi in the probit model is equal to φ(x'b)bi , where φ(x'b) is the density function of the standard normal distribution evaluated at x'b, x'b is the product of the row vector of chosen covariate values, x, and the column vector of parameter estimates, b, and bi is the parameter estimate for xi .
Marginal effects for continuous and categorical predictors in binary response models are available using the Margins macro. The Margins macro can also estimate and test predictive margins and marginal effects in other generalized linear models such as Poisson and gamma models and in Generalized Estimating Equations models. Additionally, point estimates of marginal effects for continuous predictors in binary or ordinal responses in main effects models are available in PROC QLIM in SAS/ETS® software by specifying the MARGINAL option in the OUTPUT statement.
Example: Binary logistic modelThis example illustrates estimating marginal effects in a binary logistic model. In addition to the Margins macro and PROC QLIM, the partial derivative can be computed using results from the procedure used to fit the model. Note that many SAS® procedures can fit the binary logistic model as discussed in this note on the kinds of logistic models available in SAS. This example uses the cancer remission data presented in the example titled "Stepwise Logistic Regression and Predicted Values" in the PROC LOGISTIC documentation.
Marginal effects using the Margins macroThe following call of the Margins macro estimates the average marginal effect (AME) for the BLAST predictor. Note that the macro code must first be downloaded and submitted in your SAS session in order to make it available for use. The macro first fits a logistic model (the default when dist=binomial is specified) with response variable REMISS and predictors BLAST and SMEAR. The probability of REMISS=1 is chosen for modeling by roptions=event='1'. The macro then estimates the marginal effect of the continuous predictor specified in effect=. A confidence interval is requested with options=cl.
%Margins(data = Remiss, response = remiss, roptions = event='1', model = blast smear, dist = binomial, effect = blast, options = cl)The average marginal effect of BLAST is estimated to be 0.315. A 95% large-sample confidence interval is also provided as well as a test that the marginal effect is zero. The macro can be run again to estimate the average marginal effect for SMEAR.
The average marginal effect for BLAST on REMISS=1 is 0.315 as found by the Margins macro above. The minimum and maximum marginal effects are also provided.
The same can be done for a probit model. In the Margins macro, specify link=probit. To fit the probit model in PROC QLIM, omit the D=LOGISTIC option from the previous code. The results (not shown) produce estimated marginal effects for BLAST similar to the values estimated under the logistic model.
%Margins(data = Remiss, response = remiss, roptions = event='1', model = blast smear, dist = binomial, link = probit, effect = blast, options = cl) proc qlim data=Remiss; model remiss=blast smear / discrete; output out=outqlim marginal; run; proc print data=outqlim (obs=5) noobs; var smear blast meff:; run; proc means data=outqlim mean min max; var Meff_P2:; run;