```-------------------------------------------------------------------------------
help for rhetplot
-------------------------------------------------------------------------------

Plot checking for residual heteroscedasticity after model fit

rhetplot , by(byvarlist) [residualtype variance lowess_options
plot(plot) ]

rhetplot varname [, at(numlist) | group(#)] [residualtype variance
lowess_options plot(plot) ]

rhetplot [, at(numlist) | group(#)] residualtype variance
lowess_options plot(plot) ]

Description

rhetplot is for use after regress and similar commands; see help on the
command of interest.

With the first syntax, rhetplot graphs standard deviations (optionally
variances) of residuals for the distinct groups formed by combinations of
byvarlist.  If byvarlist is a single numeric variable, it is used for the
x axis; otherwise byvarlist is used as the argument to egen, group()
label to define a grouped variable. See egen.

With the second syntax, rhetplot graphs standard deviations (optionally
variances) of residuals against means of groups of varname.  Groups are
defined by the argument of either at() or cut(), used as the
corresponding option for egen, cut(). See egen.

With the third syntax, rhetplot graphs standard deviations (optionally
variances) of residuals against means of groups of fitted values from the
model.  Groups are defined by the argument of either at() or cut(), used
as the corresponding option for egen, cut().  See egen.

The residuals are, by default, those calculated by predict, residuals or
(if the previous estimation command was glm) by predict, response.

The graph is produced by lowess. The `smooth' curve shown (unless the
number of groups specified is very small) is best regarded as an informal
indication of the general pattern of variability of residuals.

The graph is restricted to the estimation sample.

Options

by(byvarlist), required with the first syntax, specifies that the plot
should be of variability of residuals among the distinct groups
defined by combinations of byvarlist.

at(numlist) or group(#), required with the second and third syntaxes,
specifies how groups of either a specified variable (second syntax)
or fitted values (third syntax) are to be determined.  at() and
group() are options of egen, cut(): see help on egen.  In brief, at()
specifies lower limits of user-defined classes and group() specifies
the number of quantile-based groups with (approximately) equal
frequency to be used. (With at(), supply one high value beyond the
maximum of the data for best results.)

residualtype specifies a type of residual other than the default.  The
following types are currently supported: anscombe, deviance,
likelihood, pearson, residuals, response, rstandard, rstudent, score,
working.

variance specifies plotting of variances rather than standard deviations.
Occasionally, especially with counted variables, the natural question
may be how far variance is constant or a function of mean fitted
values.

lowess_options are any of the options allowed with lowess.

plot(plot) provides a way to add other plots to the generated graph; see
plot_option.

Examples

. webuse systolic
. anova systolic drug disease
. rhetplot, by(drug disease) xla(1/12, valuelabel)

. sysuse auto
. glm mpg weight, link(power -1)
. rhetplot weight, g(7)

. reg turn length
. regplot
. rhetplot, g(7)
. rhetplot length, g(7)

. insheet using http://www.kgs.ku.edu/Mathgeo/Books/Stat/ASCII/OCS.TXT,
clear
. label data "petroleum reservoirs, Outer Continental Shelf, Texas and
Louisiana"
. label var mmboe "ultimate production, million barrels oil equivalent"
. label var area "area of closure, acres"
. regress mmboe area
. rhetplot area, g(7)
. regress log10mmboe log10area
. rhetplot log10area, g(7)

Author

Nicholas J. Cox, University of Durham, U.K.
n.j.cox@durham.ac.uk

Also see

On-line:  help for predict, modeldiag

```