.-
help for ^adjust^ (STB-46: sg89.2)
.-
Adjusted predictions and probabilities after estimation
-------------------------------------------------------
^adjust^ var[^=^ #] [var[^=^ #] ...] [^if^ exp] [^in^ range]^,^ ^by(^varlist^)^ [{^xb^|^p^r}
{^stdp^|^stdf^|^noe^rror} ^g^enerate^(^newvar1 [newvar2]^)^ ^xblab^el^(^["]text["]^)^
^prlab^el^(^["]text["]^)^ ^stdplab^el^(^["]text["]^)^ ^stdflab^el^(^["]text["]^)^
]
Where allowed @tabdisp@ options are: ^f^ormat^(%^fmt^)^, ^cen^ter, ^l^eft, ^cellw^idth^(^#^)^,
^csep^width^(^#^)^, ^scsep^width^(^#^)^, and ^stubw^idth^(^#^)^. See @tabdisp@ for help.
Description
-----------
After an estimation command ^adjust^ provides adjusted predictions of xbeta (the
means in a linear-regression setting) or probabilities (available after certain
estimation commands). The estimate is computed for each level of the ^by^
variable(s) setting the variable(s) specified in var[= #] [var[= #] ...] to
their mean or to the specified number if the = # part is used. Variables used
in the estimation command but not included in either the ^by^ variable list or
the ^adjust^ variable list are left at their current values, observation by
observation. In this case ^adjust^ displays the average estimated prediction or
probability for each level of the ^by^ variables.
Options
-------
^by(^varlist^)^ is required and specifies the variable(s) whose levels determine
the subsets of the data for which adjusted predictions are to be computed.
The variables in the ^by^ option are not required to be involved in the
original estimation command.
^xb^ indicates that the linear prediction from the estimation command is to be
used. This produces predicted values (means in the linear-regression
setting) and is equivalent to the ^xb^ option of @predict@. Realize that
depending on the estimation command the ^xb^ values may not be in the
original units of the dependent variable.
^pr^ is an alternative to ^xb^ and indicates that predicted probabilities are to be
computed. The ^pr^ option is only allowed after a few commands (@blogit@,
@bprobit@, @dprobit@, @logistic@, @logit@, and @probit@). The default is ^xb^ if ^pr^ is
not specified.
^stdp^, ^stdf^, and ^noerror^ specify the kind of standard error reported for each
mean. ^stdp^, the default, uses the standard error of the linear prediction
and is available only with the ^xb^ option. ^stdf^ uses the standard error of
the forecast which is the standard error of the linear prediction plus the
residual. ^stdf^ may be specified only with the ^xb^ option and after linear-
regression estimation commands (@boxcox@, @corc@, @fit@, @hlu@, @prais@, @regdw@,
@regress@, and @rreg@). ^noerror^ specifies that no error term is to be used and
hence no standard errors for the means reported in the table.
^generate(^newvar1 [newvar2]^)^ generates one or two new variables. If one
variable is specified then the adjusted predictions for each observation
are generated in ^newvar1^ (holding the appropriate variables to their means
or other specified values). If ^pr^ is specified then the predictions are
probabilities. If ^newvar2^ is specified then the standard errors from
either the ^stdp^ or ^stdf^ option are placed in the second variable.
^xblabel()^, ^prlabel()^, ^stdplabel()^, and ^stdflabel()^ allow you to change the
labels for ^xb^, ^pr^, ^stdp^, and ^stdf^ in the output produced by ^adjust^. This
also changes the variable labels for the variables created by the ^generate^
option.
Remarks
-------
If you have restricted your estimation command to a portion of the data using
^if^ or ^in^ then you will generally want to use the same conditions with ^adjust^.
However, there may be legitimate reasons for using different data to perform
the estimation and to obtain adjusted predictions.
An interesting way to use ^adjust^ is after using @xi@ with the estimation command.
Another interesting use of ^adjust^ is to specify a categorical variable both in
the variable list being set to a specific value and as a ^by^ variable. This is
helpful in examining the predictions for several groups as if they were set at
a particular group's value (possibly also holding some other variables to
certain values also).
^adjust^ is implemented to follow the same estimation commands as listed in the
help for @predict@. However, ^adjust^ currently is not allowed after @anova@
(because we can not obtain the variable names from the beta vector), @areg@
(because @predict@ doesn't handle the absorbed variable as expected), and
multiple-equation estimation commands. ^adjust^ only uses @predict@. It does
not use any specialized predict commands such as @fpredict@, @glmpred@, and @xtpred@.
^adjust^ is similar to ^adjmean^ and ^adjprop^ written by Joanne Garrett (see STB-43
sg33.1). There are some differences between this command and those. First,
^adjmean^ and ^adjprop^ internally use @regress@ and @logistic@ and are not available
for other estimation commands. In comparison, ^adjust^ does not perform the
estimation command, but instead is a post estimation command and will work
after a large number of single equation estimation commands. A second
difference is that ^adjust^ lets you specify up to seven variables in the ^by^
option. ^adjust^ also allows ^by^ variables that were not used in the estimation
command. Variables used in the estimation command are left at their individual
values if the variables are not specified in the ^adjust^ command. Another
difference is that ^adjmean^ and ^adjprop^ compute confidence intervals and
optionally display them in a graph, while ^adjust^ does not. ^adjust^ really is a
front end process for @predict@. It sets up the values at which predictions are
desired and then displays them using @tabdisp@. This means that ^adjust^ does not
provide confidence intervals directly, but will provide ^stdp^ or ^stdf^ estimates
of error under the same conditions that @predict@ would produce them.
Examples
--------
After a regression:
. ^regress price mpg weight turn foreign^
. ^adjust mpg weight turn, by(foreign)^
. ^adjust mpg weight turn, by(foreign) stdf^
This time we set some variables to specific values instead of their mean.
. ^adjust mpg=25 weight turn=35.2, by(foreign) noerror^
We can generate variables containing the predictions and errors.
. ^adjust mpg weight, by(foreign) gen(pred err)^
We can use multiple ^by^ variables and they aren't required to have been used in
the estimation command.
. ^adjust mpg weight, by(foreign rep78)^
After a @logit@ estimation command:
. ^logit foreign weight mpg^
. ^adjust mpg, by(rep78) pr^
. ^adjust mpg, by(rep78)^
After a @probit@ estimation command:
. ^probit foreign weight mpg^
. ^adjust mpg, by(rep78) pr^
. ^adjust mpg, by(rep78) gen(xb ee)^
Using @xi@ with the estimation command followed by ^adjust^:
. ^xi : regress price I.rep78 mpg weight turn^
. ^adjust mpg weight turn, by(rep78)^
Both set a variable and use it as a ^by^ variable:
. ^regress price mpg weight turn foreign^
. ^adjust weight foreign=0, by(foreign)^
Compare this to:
. ^adjust weight, by(foreign)^
and this:
. ^adjust weight foreign=1, by(foreign)^
Author
------
Kenneth Higbee
StataCorp
email: tech-support@@stata.com
Also see
--------
STB: STB-46 sg89.2, STB-45 sg89.1, STB-44 sg89
STB-43 sg33.1 (for ^adjmean^ and ^adjprop^)
Manual: ^[R] predict^
^[U] 26 Estimation and post-estimation commands^