-------------------------------------------------------------------------------
help for rvfplot27                        (manual:  [R] regression diagnostics)
-------------------------------------------------------------------------------

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

rvfplot27 [, residualtype scale(exp) fscale(exp) ksm(ksm_options) graph_options]

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

Description

rvfplot27 graphs a residual-versus-fitted plot, a graph of the residuals versus the fitted values. The residuals are, by default, those calculated by predict, residuals or (if the previous estimation command was glm) by predict, response. The fitted values are those produced by predict by default after each estimation command.

rvfplot27 is offered as a generalisation of rvfplot in official Stata. It is a clone of rvfplot2 1.2.0 for users of Stata 7. Users of Stata 8 should use rvfplot2 2.0.0 or later.

Options

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.

scale(exp) specifies a transformed scale on which to show the residuals using Stata syntax and X as a placeholder for the residual variable name. Thus scale(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 and X as a placeholder for the fitted variable name. Thus for example fscale(2 * ln(X)) specifies twice the natural logarithm, which is the constant information scale for a generalised linear model with gamma error. Similarly, arguments of 2 * 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 using ksm with the options named.

graph_options are any of the options allowed with graph, 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)

Author

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

Acknowledgements

Phil Ender provided very helpful comments.

References

McCullagh, P. and Nelder, J.A. 1989. Generalized linear models. London: Chapman and Hall.

Also see

Manual: [R] regression diagnostics On-line: help for graph, regdiag; predict