.- help for ^adjust^ (STB-46: sg89.2) .-Adjusted predictions and probabilities after estimation -------------------------------------------------------

^adjust^ var[^=^ #] [var[^=^ #] ...] [^if^ exp] [^in^ range]^,^ ^by(^varli > st^)^ [{^xb^|^p^r} {^stdp^|^stdf^|^noe^rror} ^g^enerate^(^newvar1 [newvar2]^)^ ^xblab^el > ^(^["]text["]^)^ ^prlab^el^(^["]text["]^)^ ^stdplab^el^(^["]text["]^)^ ^stdflab^el^(^[ > "]text["]^)^ <tabdisp_options>]

Where allowed @tabdisp@ options are: ^f^ormat^(%^fmt^)^, ^cen^ter, ^l^eft, ^cel > lw^idth^(^#^)^, ^csep^width^(^#^)^, ^scsep^width^(^#^)^, and ^stubw^idth^(^#^)^. See @tabdisp@ > for help.

Description -----------

After an estimation command ^adjust^ provides adjusted predictions of xbeta (th > e 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 o > r probability for each level of the ^by^ variables.

Options -------

^by(^varlist^)^ is required and specifies the variable(s) whose levels determin > e 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 t > o 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 e > ach mean. ^stdp^, the default, uses the standard error of the linear predictio > n 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 line > ar- regression estimation commands (@boxcox@, @corc@, @fit@, @hlu@, @prais@, @r > egdw@, @regress@, and @rreg@). ^noerror^ specifies that no error term is to be us > ed 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 mean > s 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 ^adju > st^. 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 comm > and. Another interesting use of ^adjust^ is to specify a categorical variable both i > n the variable list being set to a specific value and as a ^by^ variable. This i > s 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 @xt > pred@.

^adjust^ is similar to ^adjmean^ and ^adjprop^ written by Joanne Garrett (see S > TB-43 sg33.1). There are some differences between this command and those. First, ^adjmean^ and ^adjprop^ internally use @regress@ and @logistic@ and are not ava > ilable 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 estimati > on 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 i > s a front end process for @predict@. It sets up the values at which predictions ar > e desired and then displays them using @tabdisp@. This means that ^adjust^ does > not provide confidence intervals directly, but will provide ^stdp^ or ^stdf^ estima > tes 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 i > n 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^