Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

residual.plot

residual plot for the observed values


Description

Plots the residual of observed variable.

Usage

residual.plot(Expected, Residuals, sigma, main = deparse(substitute(Expected)), 
  col.pts = "blue", col.ctr = "red", col.sgm = "black", cex = 0.5, 
  gray.scale = FALSE, xlab = "Predicted", ylab = "Residuals", ...)

Arguments

Expected

Expected value.

Residuals

Residual value.

sigma

Standard error.

main

main for the plot. See plot for detail.

col.pts

Color of the points.

col.ctr

Color of the line at zero.

col.sgm

Color of standard error line.

cex

A numerical value giving the amount by which plotting text and symbols should be magnified relative to the default. See par for detail.

gray.scale

If TRUE, makes the plot into black and white. This option overwrites the color specification. Default is FALSE.

xlab

Label for x axis.

ylab

Label for y axis.

...

Additional parameters passed to plot function.

Value

Plot to visualize pattern of residulal value for the expected value.

Author(s)

Masanao Yajima yajima@stat.columbia.edu, M.Grazia Pittau grazia@stat.columbia.edu

Examples

old.par <- par(no.readonly = TRUE)

x <- rnorm(100)
y <- rnorm(100)
fit <- lm(y~x)
y.hat <- fitted(fit)
u <- resid(fit)
sigma <- sigma.hat(fit)
residual.plot(y.hat, u, sigma)

par(old.par)

arm

Data Analysis Using Regression and Multilevel/Hierarchical Models

v1.11-2
GPL (> 2)
Authors
Andrew Gelman [aut], Yu-Sung Su [aut, cre], Masanao Yajima [ctb], Jennifer Hill [ctb], Maria Grazia Pittau [ctb], Jouni Kerman [ctb], Tian Zheng [ctb], Vincent Dorie [ctb]
Initial release
2020-7-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.