This FAQ is for users of Stata 7. It is not relevant for Stata 8.

Title | Stata7: Marginal effects by example | |

Author | Ronna Cong, StataCorp | |

Date | February 2001; updated May 2001 |

The Stata 7 command

The marginal effect is defined as

d F(X) ---------- d XThe

Examples are presented under two sections: Section 1: Specifying the form of F(X); and Section 2: Specifying the Xs.

Examples are presented for **biprobit**,
**heckman**,
**heckprob**,
**intreg**,
**mlogit**,
**ologit**,
**oprobit**,
**tobit**,
**treatreg**,
**xtintreg**,
**xtlogit**,
**xtprobit**,
and **xttobit**.

The marginal effects for Pr(depvar1=1, depvar2=0) are. mfx compute, predict(p11)

The marginal effects for Pr(depvar1=0, depvar2=1) are. mfx compute, predict(p10)

The marginal effects for Pr(depvar1=0, depvar2=0) are. mfx compute, predict(p01)

The marginal effects for the marginal probability of outcome 1, Pr(depvar1=1), are. mfx compute, predict(p00)

The marginal effects for the marginal probability of outcome 2, Pr(depvar2=1), are. mfx compute, predict(pmarg1)

The marginal effects for the conditional probability of outcome 1 given outcome 2, Pr(depvar1=1 | depvar2=1), are. mfx compute, predict(pmarg2)

The marginal effects for the conditional probability of outcome 2 given outcome 1, Pr(depvar2=1 | depvar1=1), are. mfx compute, predict(pcond1)

. mfx compute, predict(pcond2)

The marginal effects for the probability of the dependent variable being observed, Pr(y observed), are. mfx compute, predict(ycond)

. mfx compute, predict(psel)

The marginal effects for the probability of a positive outcome given the dependent variable being observed, Pr(depvar=1 | depvar_s=1), are. mfx compute, predict(pmargin)

The marginal effects for the probability of the dependent variable being observed, Pr(depvar_s=1), are. mfx compute, predict(pcond)

The marginal effects for Pr(depvar=1, depvar_s=1) are. mfx compute, predict(psel)

The marginal effects for Pr(depvar=1, depvar_s=0) are. mfx compute, predict(p11)

The marginal effects for Pr(depvar=0, depvar_s=1) are. mfx compute, predict(p10)

The marginal effects for Pr(depvar=0, depvar_s=0) are. mfx compute, predict(p01)

. mfx compute, predict(p00)

where a is the lower limit for left censoring and b is the upper limit for right censoring.. mfx compute, predict(p(a,b))

The marginal effects for the expected value of the dependent variable conditional on being uncensored, E(y | a<y<b), are

where a is the lower limit for left censoring and b is the upper limit for right censoring.. mfx compute, predict(e(a,b))

The marginal effects for the unconditional expected value of the dependent variable, E(y*), where y* = max(a, min(y,b)), are

where a is the lower limit for left censoring and b is the upper limit for right censoring.. mfx compute, predict(ys(a, b))

Run the estimation command first:

or. use auto, clear . mlogit rep78 mpg

or. ologit rep78 mpg

The marginal effects for the probability of outcome 1, Pr(y=1), are. oprobit rep78 mpg

The marginal effects for the probability of outcome 2, Pr(y=2), are. mfx compute, predict(outcome(1))

and so forth.. mfx compute, predict(outcome(2))

The marginal effects for the expected value of y conditional on being untreated, E(y | treatment =0), are. mfx compute, predict(yctrt)

The marginal effects for the probability of being treated, Pr(treatment=1), are. mfx compute, predict(ycntrt)

. mfx compute, predict(ptrt)

where a is the lower limit for left censoring and b is the upper limit for right censoring.. mfx compute, predict(pr0(a, b))

The marginal effects for the expected value of y conditional on being uncensored are

where a is the lower limit for left censoring and b is the upper limit for right censoring.. mfx compute, predict(e0(a, b))

The marginal effects for the unconditional expected value of y are

where a is the lower limit for left censoring and b is the upper limit for right censoring.. mfx compute, predict(ys(a, b))

The marginal effects for the predicted probability, taking into account. mfx compute, predict(pu0)

The marginal effects for predicted probability, ignoring offset() after the population-averaged model, are. mfx compute, predict(mu)

. mfx compute, predict(rate)

To calculate the marginal effects at the medians, type

To calculate the marginal effects at zeros, type. mfx compute, at(median)

To calculate the marginal effects at mpg=20 and zeros for other independent variables, type. mfx compute, at(zero)

. mfx compute, at(zero mpg=20)