help adjust dialog: adjust
-------------------------------------------------------------------------------
adjust has been superseded by margins. margins can do everything that
adjust did and more. margins syntax differs from adjust; see margins.
adjust continues to work but does not support factor variables and will
often fail if you do not run your estimation command under version
control, with the version set to less than 11. This help file remains to
assist those who encounter an adjust command in old do-files and
programs.
Title
[R] adjust -- Tables of adjusted means and proportions
Syntax
adjust [var[= #] ...] [if] [in] [, options]
options description
-------------------------------------------------------------------------
Main
by(varlist) compute and display predictions for each
level of variables
Options
xb linear prediction; the default
pr predicted probabilities
exp exponentiated linear prediction
se display standard error of the prediction;
default is none
stdf display standard error of the forecast;
default is none
ci display confidence or prediction intervals
level(#) set confidence level; default is level(95)
vertical stack confidence intervals
equation(eqno) use eqno equation in a multiple-equation
system
nooffset ignore offset or exposure variable (if
any) when making predictions
generate(newvar1 [newvar2]) generate prediction variable, error
variable
More options
replace replace data in memory with table
label(text) prediction label
selabel(text) error-term label
cilabel(text) confidence-interval label
format(%fmt) display format for numbers in table
nokey suppress table key
noheader suppress table header
center center numbers in cells; default is to
right-align
left left-align column labels; default is to
right-align
cellwidth(#) cell width
csepwidth(#) column separation
scsepwidth(#) supercolumn separation
stubwidth(#) left stub width
-------------------------------------------------------------------------
Menu
Statistics > Postestimation > Adjusted means and proportions
Description
After an estimation command (see [I] estimation commands), adjust
provides adjusted predictions of xb (the means in a linear-regression
setting), probabilities (available after some estimation commands), or
exponentiated linear predictions. The estimate is computed for each
level of the by() variables, setting the variables specified in [var[= #]
...] to their mean or to the specified number if the = # part is
specified. If by() is not specified, adjust produces results as if by()
defined one group. 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. Here adjust
displays the average estimated prediction (or the corresponding
probability or exponentiated prediction), substituting the mean of these
unspecified variables within each group defined by the variables in the
by() option.
Options
+------+
----+ Main +-------------------------------------------------------------
by(varlist) specifies the variables whose levels determine the subsets of
the data for which adjusted predictions are to be computed. The
variables in by() need not have been involved in the original
estimation command. A maximum of seven variables may be specified in
the by() option. If by() is not specified, the results are computed
treating all the data as one group.
+---------+
----+ Options +----------------------------------------------------------
xb, the default, specifies that the linear prediction from the estimation
command be displayed. This produces a predicted value (a mean in the
linear-regression setting) and is equivalent to the xb option of
predict. Depending on the estimation command, the xb value may not
be in the original units of the dependent variable.
pr is an alternative to xb that specifies that the predicted probability
be displayed. The pr option is not available after all commands.
exp is an alternative to xb that specifies that exponentiated linear
prediction, exp(xb), be displayed. Depending on the estimation
command, the resulting quantity might be called an "incidence rates",
a "hazard ratios", etc.
se specifies that the standard error of the linear prediction be
displayed. This is equivalent to the stdp option of predict.
stdf specifies that the standard error of the forecast of the linear
prediction be displayed. This is equivalent to the stdf option of
predict and is available only after estimation commands that support
the stdf predict option.
ci specifies that a confidence interval be displayed. The confidence
interval is for the displayed estimate as determined by the xb, pr,
or exp option -- producing an interval for the adjusted linear
prediction, probability, or exponentiated linear prediction. When
stdf is specified, a prediction interval is produced, which is, by
definition, wider than the corresponding confidence intervals.
level(#) specifies the confidence level, as a percentage, for confidence
or prediction intervals. The default is level(95) or as set by set
level.
vertical requests that the endpoints of confidence or prediction
intervals be stacked vertically on display. You must specify more
than two variables in the by() option for vertical results to be
produced.
equation(eqno) specifies the equation in a multiple-equation system that
is to be used in the adjust command. This option is allowed only
after multiple-equation estimation commands.
nooffset is relevant only if you specified offset(varname) or
exposure(varname) when you fit your model. It modifies the
calculations made by adjust so that they ignore the offset or
exposure variable.
generate(newvar1 [newvar2]) generates one or two new variables. If one
variable is specified, the adjusted linear prediction for each
observation is generated in newvar1 (holding the appropriate
variables to their means or to other specified values). If pr is
specified, the adjusted linear prediction is transformed to a
probability. If exp is specified, the exponentiated prediction is
returned. If newvar2 is specified, the standard error from either
the se option or the stdf option is placed in the second variable.
+--------------+
----+ More options +-----------------------------------------------------
replace specifies that the data in memory be replaced with data
containing 1 observation per cell corresponding to the table produced
by the adjust command.
label(text), selabel(text), and cilabel(text) allow you to change the
labels for the displayed predictions (from the xb, pr, or exp
option), error terms (from the se or stdf option), and confidence
intervals (from the ci option). label() and selabel() also change the
variable labels for the variables created by the generate() option.
format(%fmt) specifies the display format for presenting the numbers in
the table; see [U] 12.5 Formats: Controlling how data are displayed.
format(%8.0g) is the default. Standard errors and confidence
intervals are further formatted for output by automatic enclosure
within parentheses or square brackets.
nokey and noheader suppress the display of the table key and header
information.
center specifies that results be centered in the table's cells. The
default is to right-align the results. For centering to work well,
specify a display format, too, such as format(%9.2f).
left specifies that column labels be left-aligned. The default is to
right-align them to distinguish them from supercolumn labels, which
are left-aligned.
cellwidth(#) specifies the width of the cell in units of digit widths; 10
means the space occupied by 10 digits, which is 0123456789. The
default is not a fixed number but a number chosen to spread the table
out while presenting a reasonable number of columns across the page.
csepwidth(#) specifies the separation between columns in units of digit
widths. The default is not a fixed number but a number chosen
according to what Stata thinks looks best.
scsepwidth(#) specifies the separation between supercolumns in units of
digit widths. The default is not a fixed number but a number chosen
according to what Stata thinks looks best.
stubwidth(#) specifies the width of the left stub of the table in units
of digit widths. The default is not a fixed number but a number
chosen according to what Stata thinks looks best.
Remarks
adjust is a postestimation command; see postest. adjust is really just a
front-end process for predict. It sets up the values at which
predictions are desired and then displays the predictions in tabular
form; the data remain unchanged. adjust's options control the labeling
of the predictions, errors, and confidence intervals. tabdisp is used to
produce the final table.
If you have restricted your estimation command to a portion of the data
by using if or in, then you will generally want to use the same
conditions with adjust. This task is easily done by including if
e(sample) with the adjust command. However, there may be legitimate
reasons for using different data to perform the estimation and to obtain
adjusted predictions (i.e., out-of-sample adjusted predictions).
Examples
regress
Setup
. sysuse auto
. regress price mpg weight turn foreign
. adjust mpg weight turn, by(foreign)
. adjust mpg weight turn, by(foreign) se ci
. adjust mpg weight turn, by(foreign) stdf ci
Setting some variables to specific values instead of their mean
. adjust mpg=25 weight turn=35.2, by(foreign)
Generating variables containing the predictions and errors
. adjust mpg weight, by(foreign) gen(pred err) se
Using multiple by() variables, which need not have been used in the
estimation command
. adjust mpg weight, by(foreign rep78) se ci
Setting a variable and using it as a by() variable
. sysuse auto, clear
. regress price mpg weight turn foreign
. adjust weight foreign=0, by(foreign) se
Compare this with
. adjust weight, by(foreign) se
and this
. adjust weight foreign=1, by(foreign) se
logit
Setup
. sysuse auto
. logit foreign weight mpg
Obtain predicted probabilities for each level of rep78, setting mpg
to its mean
. adjust mpg, by(rep78) pr
anova
Setup
. webuse sysage, clear
. anova systolic drug disease drug*disease age, continuous(age)
Obtain adjusted means and standard errors by disease and drug
. adjust age, by(disease drug) se
mvreg
Setup
. sysuse auto
. mvreg weight length turn = displ foreign
Obtain statistics from various equations after fitting a multivariate
model
. adjust displ, by(foreign) equation(length) se ci
. adjust displ, by(foreign) equation(#3) se ci
Also see
Manual: [R] adjust
Help: [R] table