Plot residuals versus predictor values after model fit
rvpplot2 varname [ , residualtype force rscale(exp) lowess[(lowess_options)] scatter_options plot(plot) ]
Description
rvpplot2 graphs a residual-versus-predictor plot (a.k.a. independent variable plot, a.k.a. carrier plot), a graph of the residuals versus the specified predictor varname from the last regression-type model. The residuals are, by default, those calculated by predict, residuals or (if the previous estimation command was glm) by predict, response.
rvpplot2 is for use after regress and similar commands; see help on the command of interest. It is a generalisation of official Stata's rvpplot.
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.
force allows you to specify a predictor variable not included in the previous model.
rscale(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 rscale(X^2) specifies squaring, to show relative contribution to residual variance; rscale(abs(X)) specifies absolute value, to set aside sign; rscale(sqrt(abs(X))) specifies root of absolute value, a useful scale on which to check for heteroscedasticity.
lowess[(lowess_options)] specifies that the residuals will be smoothed as a function of the predictor using twoway lowess (options may be specified).
scatter_options are options of twoway scatter.
plot(plot) provides a way to add other plots to the generated graph; see plot_option.
Examples
. reg width length . rvpplot2 length
. glm price weight, link(log) . rvpplot2 weight, anscombe yli(0)
Author
Nicholas J. Cox, University of Durham, U.K. n.j.cox@durham.ac.uk
Acknowledgements
Kit Baum identified an error in a previous version of this help.
Also see
On-line: help for scatter, predict, modeldiag