***/
webdoc toc 2 2
/***

By default, coefplot displays the results as they have been stored by
the estimation command in `e(b)`

. These raw coefficients may not
always be what you want to see. For example, in case of a
`logit`

model,
you may want to use the
`eform`

option to
transform the raw log odds to odds ratios:

Similarly, `eform`

computes hazard ratios after
`stcox`

,
relative-risk ratios after
`mlogit`

,
or incidence-rate ratios after
`poisson`

.
You can also transform just a selection of coefficients; see
`eform()`

in the help file.

The
`rescale()`

option allows you to rescale the estimates by a multiplicative factor.
For example, to plot percentages instead of fractions after
`proportion`

,
type:

Note that option `citype(logit)`

was
specified to compute the confidence limits using a logit transformation, as
this is the default method used by
`proportion`

.

You can also rescale single coefficients, as in the following example:

***/ webdoc stlog rescale2 sysuse auto, clear generate gpm = 1 / mpg regress price weight gpm turn coefplot, drop(_cons) xline(0) rescale(weight = 100 gpm = .01) /// coeflabels(weight = "Weight (in 100 lbs.)" gpm = "Gallon per 100 miles") webdoc stlog close webdoc graph estimates clear /***Or here is an example in which the effects are rescaled by the standard deviations of the predictors (semi-standardized effects):

***/ webdoc stlog rescale3 sysuse auto, clear webdoc stlog oom /// regress price mpg weight length turn foreach v of var mpg weight length turn { quietly summarize `v' local sd_`v' = r(sd) } coefplot, drop(_cons) xline(0) /// rescale(mpg = `sd_mpg' /// weight = `sd_weight' /// length = `sd_length' /// turn = `sd_turn') webdoc stlog close webdoc graph estimates clear /*** @topofpage
More generally, you can use the
`transform()`

option to apply arbitrary transformations (using endpoint transformation
for confidence limits). Within the expressions in
`transform()`

, use
`@`

as a placeholder for the value to be transformed. For example,
`transform(* = exp(@))`

does the same as the `eform`

option discussed above:

Likewise, to plot standard deviations and correlations of
random effects after a mixed-effects model
(`mixed`

),
type:

Note that
`eform`

,
`rescale()`

,
and `transform()`

operate independently from each other. If all three are specified,
`eform`

is applied first, then
`rescale()`

, then
`transform()`

.

There are a number of
temporary variables
you can refer to within the
`transform()`

option. Here is an example in which the lower and upper parts of the
confidence intervals are displayed in different colors:

The `keep()`

and `drop()`

options determine the equations and
coefficients that will be included in the graph based on their names (see
the examples in Getting started). Sometimes,
however, it is useful to select coefficients based on their values. In
this case, the `if()`

option can be employed. For example, suppose you
want to use a different plot style for significant and nonsignificant
coefficients. You could type:

`@ll`

and `@ul`

are internal variables
containing the lower and upper limits of confidence intervals (see
here).

coefplot does not support standardizing coefficients. If you want to plot standardized coefficients, you have to compute the standardized coefficients before applying coefplot. An approach that works for linear regression is to standardize all variables before estimating the model, as in the following example:

***/ webdoc stlog std sysuse auto, clear preserve center price mpg weight length turn foreign, inplace standardize webdoc stlog oom /// regress price mpg weight length turn, noconstant restore coefplot, xline(0) xtitle(Standardized Coefficients) webdoc stlog close webdoc graph estimates clear /***
Command `center`

from the SSC Archive
has been used to standardize the variables (type ```
ssc install
center
```

to install the command). When standardizing the variables,
make sure to use the same set of observations as are used in the model. The
`noconstant`

option has been added to the regression command,
because the constant is zero by construction in the standardized model.

Another approach is to use
`sem`

to estimate the model,
which stores standardized coefficients and variances in
`e(b_std)`

and `e(V_std)`

(results for the
confidence intervals will be
slightly different). In coefplot, use options
`b()`

and
`v()`

to refer to these results:

Yet another solution is to manually specify scaling factors for the
different coefficients using the
`rescale()`

option (see `above`

).

coefplot can plot results computed by
`margins`

if it is specified with the `post`

option.
For example, if you want to plot average marginal effects instead of log odds or
odds ratios from a `logit`

model, you can apply `margins`

as follows:

It is essential to specify the `post`

option with
`margins`

so
that it posts its results in `e()`

from where coefplot collects
the results to be displayed. If you do not specify the `post`

option,
then `margins`

leaves `e()`

unchanged and coefplot uses
the raw coefficients from the
`logit`

model that still reside in `e()`

.

Here is an example for plotting average marginal effects for all equations
of an `mlogit`

.
The code is a bit involved because
`margins`

has a complicated way of naming things:

In Stata 13 or older, `margins`

did not support computing marginal effects for all equations in one run. Here is an
example that shows you how to compute the results by looping over the outcomes: