Title

mchange -- Marginal effects for regression models

General syntax

mchange
[varlist]
[if]
[in]
,
[ mchange-options
margins-options ]

where varlist is a list of regressors for which changes are to be
computed. If no name is specified, changes for all independent variables
are computed.

Overview

mchange uses margins to compute marginal
effects for a regression model.
Both marginal changes (partial derivatives) and discrete changes can be
computed. Discrete changes of one, a standard deviation, from 0 to 1,
over the range, over a trimmed ranged, or for a specific increase from the
observed value can be computed.

Average marginal effects (AME) are computed by averaging over the sample.
Marginal effects at the mean (MEM) and marginal effects at representative value (MER) are computed using
atmeans and at() options.
Prior to Stata 13, standard errors and tests of AME's for discrete changes of 1, a standard deviation,
or a fixed amount from the observed value cannot be computed.

mchange works with models specified with factor variables and interactions
using factor variable notation.
It should work with any regression command supported by margins,
although we have not tried every model.

Options

Amount of change options

amount(change-amounts)
trim(integer-trim%)
delta(number)
centered

Statistics to compute

statistics(statistics-names)
outcomes(values)
pr(values)
cpr(values)
level(values)

Fixed values of independent variables

at(atspec)
atmeans

Output controls

brief
commands
decimals(integer)
descriptives
details
matrix(matrix-name)
title(title-string)
width(integer)

Options

Specifying values of independent variables
Selecting the amount of change
Selecting statistics to display
Options controlling output
Returns

Setting values of independent variables

Predictions are computed using margins. If values of independent variables
are specified, predictions are computed at these values. For variables
whose values are not specificed, changes are averaged across observed values
(i.e., margins' asobserved option).

at(atspec)
where atspec is set in the same way as with margins,
such as at(wc=0 k5=0 age=50).
With mchange multiple values of a variable cannot be
specified (e.g., at(wc=(0 1))).

atmeans
All variables not specified with at() are held at their means.
If if or in are used to specify the sample, the means are
computed for the selected observations.

Amount of changes

By default a change from 0 to 1 is computed for factor variables entered
with the i.varname notation (see factor variable notation).
For continuous variables, marginal changes (i.e., partial derivatives)
and discrete changes of one and a standard deviation are computed.

These defaults can be changed with amount(amount-list)
where the amount list can contain the following:

Option Amount of change

all All types of changes are computed.

binary Change from 0 to 1.

marginal Marginal rate of change.

one Change by 1.

range Change over range or trimmed range; see trim().

sd Change by the regressor's standard deviation or by the
amount specified by delta(). delta is a synonym for
sd.

The range can be trimmed and an amount other than
a standard deviation can be computed with these options:

delta(#)
Change by # units instead of a standard deviation change
(e.g., delta(4) computes a change of 4).

trim(#)
Instead of computing change over the range, trim the range by this
percentile from each end of the distribution.

level(#)
Specified the default confidence intervals, from 10 to 99.99.

centered
By default changes of one, a standard deviation are for an increase of these
amounts from the value of the independent variable. That is, they are uncentered changes.
Centered changes of one, a standard deviation, or delta are
computed by adding half the value above and half the value below the value of the regressor
(e.g., mean-sd/2 to mean+sd/2).

Statistics

By default the estimate of change and the p-value for a test that the
change is 0 are displayed. Other statistics can be requested with
statistics(stat-list). stats() is a synonym.

Option Statistic

ci Confidence interval along with change.

all All statistics.

change Discrete or marginal change.

pvalue p-value for test change is 0.

se Standard error of the estimated change.

zvalue z-value of test change is 0.

ll Lower level of CI.

ul Upper level of CI.

start Start value for discrete change.

end End value for discrete change.

For models with multiple outcomes or outcome probabilities, you can specify
the values for which statistics are to be computed. Statistics are then
computed for all specified values.

outcomes(numlist)
Estimates displayed for these values of the outcome for models
where outcomes() is an option for predict, such as mlogit.
Outcome values must be non-negative integers.

pr(numlist)
Estimates displayed for these probabilities for models
where pr() is an option for predict, such as poisson.
Outcome values must be non-negative integers.

cpr(numlist)
Estimates displayed for these conditional probabilities for models
where pr() is an option for predict.
Outcome values must be non-negative integers.

Controlling output

How output is displayed is controlled by these options.

brief
Do not show base values, values of r(at) matrix, or
details on how changes were computed.

descriptive
Show table of descriptive statistics.

title(title)
Label the output with this title.

decimals(#)
Number of decimal digits to display.

width(#)
Width of columns displaying statistics.

commands
Display the commands used with margins without the output.

details
Display the sometime lengthy output from margins and lincom used
to compute the changes. verbose is a synonym.

Returned results

r(atspec)
a local with the at-specification used.

r(atconstant) a matrix containing the constant values if any
of the independent variables when predictions were made.

r(basepred) a matrix with the predictions at the baseline values or
averaged over the sample depending on options used.

r(centering)
a local indicating if centered or uncentered changes were computed.

r(changes) a matrix containing the all changes and statistics
even if not displayed. This is also saved in the matrix _mchange which
is used by mchangeplot and mlogitplot.

r(table) a matrix containing the displayed results.

matrix(matrix-name)
The matrix r(table) is saved as matrix-name.

Examples

Example 1: Average marginal effects of all variables in model

. spex logit

. mchange

Example 2: Changing displayed statistics

. spex logit

. mchange, stat(change z start end) dec(4)

Example 3: Marginal effects at specific values

. spex logit

. mchange, at(wc=0 hc=1)

Example 4: Marginal effects only for certain values of outcome

. spex ologit

. mchange, outcome(2)

Example 5: Adjust amount of change for discrete change

. spex ologit

. mchange income, amount(sd) delta(15)