------------------------------------------------------------------------------- help forrhetplot-------------------------------------------------------------------------------

Plot checking for residual heteroscedasticity after model fit

rhetplot,by(byvarlist)[residualtypevariancelowess_optionsplot(plot)]

rhetplotvarname[, at(numlist)|group(#)] [residualtypevariancelowess_optionsplot(plot)]

rhetplot[,at(numlist)|group(#)]residualtypevariancelowess_optionsplot(plot)]

Description

rhetplotis for use afterregressand similar commands; see help on the command of interest.With the first syntax,

rhetplotgraphs standard deviations (optionally variances) of residuals for the distinct groups formed by combinations ofbyvarlist. Ifbyvarlistis a single numeric variable, it is used for thexaxis; otherwisebyvarlistis used as the argument toegen, group()labelto define a grouped variable. See egen.With the second syntax,

rhetplotgraphs standard deviations (optionally variances) of residuals against means of groups ofvarname. Groups are defined by the argument of eitherat()orcut(), used as the corresponding option foregen, cut(). See egen.With the third syntax,

rhetplotgraphs standard deviations (optionally variances) of residuals against means of groups of fitted values from the model. Groups are defined by the argument of eitherat()orcut(), used as the corresponding option foregen, cut(). See egen.The residuals are, by default, those calculated by

predict, residualsor (if the previous estimation command wasglm) bypredict, 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 ofbyvarlist.

at(numlist)orgroup(#), 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()andgroup()are options ofegen, cut(): see help on egen. In brief,at()specifies lower limits of user-defined classes andgroup()specifies the number of quantile-based groups with (approximately) equal frequency to be used. (Withat(), supply one high value beyond the maximum of the data for best results.)

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

variancespecifies 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_optionsare 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 andLouisiana". 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)

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

Also seeOn-line: help for predict, modeldiag