📄 adjust.hlp
字号:
{smcl}
{* 03mar2005}{...}
{cmd:help adjust} {right:dialog: {bf:{dialog adjust}}}
{hline}
{title:Title}
{p2colset 5 19 21 2}{...}
{p2col :{hi:[R] adjust} {hline 2}}Tables of adjusted means and proportions{p_end}
{p2colreset}{...}
{title:Syntax}
{p 8 15 2}
{cmd:adjust}
[{it:var}[{opt =} {it:#}] {it:...}]
{ifin}
[{cmd:,} {it:options}]
{p2colset 5 36 38 2}{...}
{p2col :{it:options}}description{p_end}
{p2line}
{p2col 3 36 38 2:Main}{p_end}
{p2col :{opth by(varlist)}}compute and display predictions for each level of variables{p_end}
{p2col 3 36 38 2:Options}{p_end}
{p2col :{opt xb}}linear prediction; the default{p_end}
{p2col :{opt p:r}}predicted probabilities{p_end}
{p2col :{opt exp}}exponentiated linear prediction{p_end}
{p2col :{opt se}}display standard error of the prediction; default is none{p_end}
{p2col :{opt stdf}}display standard error of the forecast; default is none{p_end}
{p2col :{opt ci}}display confidence or prediction intervals{p_end}
{p2col :{opt l:evel(#)}}set confidence level; default is {cmd:level(95)}{p_end}
{p2col :{opt vert:ical}}stack confidence intervals{p_end}
{p2col :{opt eq:uation(eqno)}}use {it:eqno} equation in a multiple-equation system{p_end}
{p2col :{opt nooff:set}}ignore {opt offset} or {opt exposure} variable (if any) when making predictions{p_end}
{p2col :{opth g:enerate(newvar:newvar1 [newvar2])}}generate prediction variable, error variable{p_end}
{p2col 3 36 38 2:More options}{p_end}
{p2col :{opt replace}}replace data in memory with table{p_end}
{p2col :{opt lab:el(text)}}prediction label{p_end}
{p2col :{opt selab:el(text)}}error-term label{p_end}
{p2col :{opt cilab:el(text)}}confidence-interval label{p_end}
{p2col :{opth f:ormat(%fmt)}}display format for numbers in table{p_end}
{p2col :{opt nokey}}suppress table key{p_end}
{p2col :{opt nohead:er}}suppress table header{p_end}
{p2col :{opt cen:ter}}center numbers in cells; default is to right-align{p_end}
{p2col :{opt l:eft}}left-align column labels; default is to right-align{p_end}
{p2col :{opt cellw:idth(#)}}cell width{p_end}
{p2col :{opt csep:width(#)}}column separation{p_end}
{p2col :{opt scsep:width(#)}}supercolumn separation{p_end}
{p2col :{opt stubw:idth(#)}}left stub width{p_end}
{p2line}
{p2colreset}{...}
{title:Description}
{pstd}
After an estimation command (see {help estimation commands}), {cmd:adjust}
provides adjusted predictions of xbeta (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 {opt by()} variables, setting the variables specified in
[{it:var}[{opt =} {it:#}] {it:...}] to their mean or to the specified number
if the {opt =} {it:#} part is specified. If {opt by()} is not specified,
{cmd:adjust} produces results as if {opt by()} defined a single group.
Variables used in the estimation command
but not included in either the {opt by()} variable list or the {cmd:adjust}
variable list are left at their current values, observation by observation.
In this case, {cmd: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 {opt by()} option.
{title:Options}
{dlgtab:Main}
{phang}
{opth by(varlist)} specifies the variables whose
levels determine the subsets of the data for which adjusted predictions are to
be computed. The variables in {opt by()} are not required to be
involved in the original estimation command. A maximum of seven variables may
be specified in the {opt by()} option. If {opt by()} is not specified, the
results are computed treating all the data as a single group.
{dlgtab:Options}
{phang}
{opt xb} specifies that the linear prediction from the estimation
command be displayed. This produces predicted values (means in the
linear-regression setting) and is equivalent to the {opt xb} option of
{helpb predict}. Depending on the estimation command, the {opt xb}
values may not be in the original units of the dependent variable. The
default is {opt xb} if {opt pr} or {opt exp} are not specified.
{phang}
{opt pr} is an alternative to {opt xb} that specifies that predicted
probabilities be displayed. The {opt pr} option is not available after
all commands.
{phang}
{opt exp} is an alternative to {opt xb} that specifies that
exponentiated linear predictions, exp(xbeta), be displayed. Depending
on the estimation command, the resulting quantities might be called "incidence
rates", "hazard ratios", etc.
{phang}
{opt se} specifies that the standard error of the linear prediction be
displayed. This is equivalent to the {opt stdp} option of {helpb predict}.
{phang}
{opt stdf} specifies that the standard error of the forecast of the
linear prediction be displayed. This is equivalent to the {opt stdf}
option of {helpb predict} and is available only after estimation commands
that support the {opt stdf predict} option.
{phang}
{opt ci} specifies that confidence intervals be displayed. The
confidence intervals are for the displayed estimates as determined by the
{opt xb}, {opt pr}, or {opt exp} options{hline 2}producing intervals for
the adjusted linear predictions, probabilities, or exponentiated linear
predictions. When {opt stdf} is specified, prediction intervals are produced.
These are, by definition, wider than the corresponding confidence intervals.
{phang}
{opt level(#)} specifies the confidence level, as a percentage,
for confidence or prediction intervals. The default is
{cmd:level(95)} or as set by {helpb set level}.
{phang}
{opt vertical} requests that the endpoints of confidence or prediction
intervals be stacked vertically on display.
{phang}
{opt equation(eqno)} specifies the equation in a
multiple-equation system that is to be used in the {cmd:adjust} command. This
option is allowed only after multiple-equation estimation commands.
{phang}
{opt nooffset} is relevant only if you specified
{opt offset(varname)} or
{opt exposure(varname)} when you fitted your model. It
modifies the calculations made by {cmd:adjust} so that they ignore the offset
or exposure variable.
{phang}
{opth "generate(newvar:newvar1 [newvar2])"} generates one or two
new variables. If one variable is specified, the adjusted linear predictions
for each observation are generated in {it:newvar1} (holding the appropriate
variables to their means or to other specified values). If {opt pr} is
specified, the adjusted linear predictions are transformed to probabilities.
If {opt exp} is specified, the exponentiated predictions are returned. If
{it:newvar2} is specified, the standard errors from either the {opt se} option
or the {opt stdf} option are placed in the second variable.
{dlgtab:More options}
{phang}
{opt replace} specifies that the data in memory be replaced with
data containing one observation per cell corresponding to the table produced
by the {cmd:adjust} command.
{phang}
{opt label(text)}, {opt selabel(text)}, and {opt cilabel(text)} allow you to
change the labels for the displayed predictions (from the {opt xb}, {opt pr},
or {opt exp} options), error terms (from the {opt se} or {opt stdf} options),
and confidence intervals (from the {opt ci} option). {opt label()} and
{opt selabel()} also change the variable labels for the variables created by
the {opt generate()} option.
{phang}
{opth format(%fmt)} specifies the display format for presenting the numbers in
the table; see {bf:[U] 12.5 Formats: controlling how data are displayed}.
{cmd:format(%8.0g)} is the default. Standard errors and confidence intervals
are further formatted for output by automatic enclosure within parentheses or
square brackets.
{phang}
{opt nokey} and {opt noheader} suppress the display of the table key
and header information.
{phang}
{opt 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 {cmd:format(%9.2f)}.
{phang}
{opt 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.
{phang}
{opt cellwidth(#)} specifies the width of the cell in units of
digit widths; 10 means the space occupied by ten 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.
{phang}
{opt csepwidth(#)} specifies the separation between columns in units of digits
widths. The default is not a fixed number but a number chosen according to
what Stata thinks looks best.
{phang}
{opt 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.
{phang}
{opt 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.
{title:Remarks}
{pstd}
{cmd:adjust} is a postestimation command; see {help postest}.
{cmd:adjust} is really just a front-end process for {helpb predict}. It
sets up the values at which predictions are desired and then displays the
predictions in tabular form; the data remain unchanged. {cmd:adjust}'s
options control the labeling of the predictions, errors, and confidence
intervals. {helpb tabdisp} is used to produce the final table.
{pstd}
If you have restricted your estimation command to a portion of the data
using {opt if} or {opt in}, then you will generally want to use the same
conditions with {cmd:adjust}. This is easily done by including
{cmd:if e(sample)} with the {cmd: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).
{title:Examples}
{pstd}
After a regression, type
{phang2}{cmd:. regress price mpg weight turn foreign}{p_end}
{phang2}{cmd:. adjust mpg weight turn, by(foreign)}{p_end}
{phang2}{cmd:. adjust mpg weight turn, by(foreign) se ci}{p_end}
{phang2}{cmd:. adjust mpg weight turn, by(foreign) stdf ci}
{pstd}
This time we set some variables to specific values instead of their mean.
{phang2}{cmd:. adjust mpg=25 weight turn=35.2, by(foreign)}
{pstd}
We can generate variables containing the predictions and errors.
{phang2}{cmd:. adjust mpg weight, by(foreign) gen(pred err) se}
{pstd}
We can use multiple {opt by()} variables, and they are not required to have
been used in the estimation command.
{phang2}{cmd:. adjust mpg weight, by(foreign rep78) se ci}
{pstd}
After a {helpb logit} estimation command, type
{phang2}{cmd:. logit foreign weight mpg}{p_end}
{phang2}{cmd:. adjust mpg, by(rep78) pr}{p_end}
{phang2}{cmd:. adjust mpg, by(rep78)}
{pstd}
After a {helpb probit} estimation command, type
{phang2}{cmd:. probit foreign weight mpg}{p_end}
{phang2}{cmd:. adjust mpg, by(rep78) pr}{p_end}
{phang2}{cmd:. adjust mpg, by(rep78) gen(xb ee) xb se}
{pstd}
After {helpb anova}, type
{phang2}{cmd:. anova y a b a*b x1 x2}{p_end}
{phang2}{cmd:. adjust x1 x2, by(a b) se ci}
{pstd}
After {helpb mvreg}, type
{phang2}{cmd:. mvreg weight length turn = displ foreign}{p_end}
{phang2}{cmd:. adjust displ, by(foreign) equation(length) se ci}{p_end}
{phang2}{cmd:. adjust displ, by(foreign) equation(#3) se ci}
{pstd}
Using {helpb xi} with the estimation command followed by {cmd:adjust}:
{phang2}{cmd:. xi: regress price I.rep78 mpg weight turn}{p_end}
{phang2}{cmd:. adjust mpg weight turn, by(rep78) se}
{pstd}
Both set a variable and use it as a {opt by()} variable:
{phang2}{cmd:. regress price mpg weight turn foreign}{p_end}
{phang2}{cmd:. adjust weight foreign=0, by(foreign) se}
{pstd}
Compare this with
{phang2}{cmd:. adjust weight, by(foreign) se}
{pstd}
and this
{phang2}{cmd:. adjust weight foreign=1, by(foreign) se}
{title:Also see}
{psee}
Manual: {bf:[R] adjust}
{psee}
Online: {help epitab},
{helpb "svy:tabulate oneway"},
{helpb "svy:tabulate twoway"},
{helpb table}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -