Description Usage Arguments Details Author(s) References See Also Examples
Plot the fitted values vs the studentized or standardized residuals for a glm
or lm
object.
1 2 |
model |
a regression model with any number of predictors. Must be a |
zoom |
what range of residuals you wish to show in your plot. By default, zoom is |
highlight.outliers |
logical. If |
residuals |
which type of residuals to use. Studentized residuals are used by default, but can be specified with |
A residual plot shows the fitted values of the response variable on the x-axis and the studentized or standardized residuals on the y-axis. It can be used to check for correlated residuals or non-constant variance of the residuals, both of which would violate the residual assumptions of a linear model. It can also be used to check for outliers, as a value below -3 or above 3 would indicate a residual which is more than 3 standard deviations from the mean of 0.
Jonathan Schwartz
Montgomery, D. C., Peck, E. A., Vining, G. G. (2013), Introduction to Linear Regression Analysis, Hoboken, NJ: John Wiley & Sons, Inc.
plot
,
abline
,
lm
,
glm
,
predict
,
rstudent
,
rstandard
1 2 3 4 5 6 7 8 9 10 | ##plot a residual plot to check the model assumptions for a linear
##model of iris petal length as a predicted by iris petal width
model<-lm(iris$Petal.Length~iris$Petal.Width)
resplot(model)
##highlight the one outlier
resplot(model,highlight.outliers=TRUE)
##zoom in to only show the residuals between -1 and 1
resplot(model,zoom=1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.