------------------------------------------------------------------------------- help forrvfplot27(manual:[R] regression diagnostics) -------------------------------------------------------------------------------

Graph residual-versus-fitted plot after regression-type command

rvfplot27[,residualtypescale(exp)fscale(exp)ksm(ksm_options)graph_options]

rvfplot27is for use afterregressand similar commands; see help on the command of interest.

Description

rvfplot27graphs a residual-versus-fitted plot, a graph of the residuals versus the fitted values. The residuals are, by default, those calculated bypredict,residualsor (if the previous estimation command wasglm) bypredict, response. The fitted values are those produced bypredictby default after each estimation command.

rvfplot27is offered as a generalisation ofrvfplotin official Stata. It is a clone ofrvfplot21.2.0 for users of Stata 7. Users of Stata 8 should uservfplot22.0.0 or later.

Options

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.

scale(exp)specifies a transformed scale on which to show the residuals using Stata syntax andXas a placeholder for the residual variable name. Thusscale(X^2)specifies squaring, to show relative contribution to residual variance;scale(abs(X))specifies absolute value, to set aside sign;scale(sqrt(abs(X)))specifies root of absolute value, a useful scale on which to check for heteroscedasticity.

fscale(exp)specifies a transformed scale on which to show the fitted values using Stata syntax andXas a placeholder for the fitted variable name. Thus for examplefscale(2 * ln(X))specifies twice the natural logarithm, which is the constant information scale for a generalised linear model with gamma error. Similarly, arguments of2 * sqrt(X),2 * asin(sqrt(X)), and-2/ sqrt(X)specify the constant information scale for Poisson, binomial and inverse Gaussian errors respectively. See McCullagh and Nelder (1989, p.398) for background.

ksm(ksm_options)specifies that the residuals will be smoothed as a function of the fitted usingksmwith the options named.

graph_optionsare any of the options allowed withgraph, twoway; see help grtwoway.

Examples. gen forxmpg = foreign * mpg

. regress price weight mpg forxmpg foreign . rvfplot27

. anova price rep foreign rep*foreign weight, cont(weight) . rvfplot27, scale(sqrt(abs(X)))

. glm price weight, link(log) . rvfplot27, anscombe yli(0)

. glm price weight, link(log) . rvfplot27, anscombe yli(0) ksm(lowess)

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

AcknowledgementsPhil Ender provided very helpful comments.

ReferencesMcCullagh, P. and Nelder, J.A. 1989.

Generalized linear models.London: Chapman and Hall.

Also seeManual:

[R] regression diagnosticsOn-line: help for graph, regdiag; predict