checking.plots: Checking Plots

Description Usage Arguments Author(s) See Also Examples

View source: R/checkingplots.R

Description

Function that creates four graphs that can be used to help assess independence, normality, and constant variance

Usage

1
checking.plots(model, n.id = 3, COL = c("#0080FF", "#A9E2FF"))

Arguments

model

an aov or lm object

n.id

the number of points to identify

COL

vector of two colors

Author(s)

Alan T. Arnholt <arnholtat@appstate.edu>

See Also

twoway.plots, oneway.plots

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
mod.aov <- aov(stopdist ~ tire, data = TIRE)
checking.plots(mod.aov)
rm(mod.aov)

# Similar graphs using ggplot2
#
mod.aov <- aov(stopdist ~ tire, data = TIRE)
fortify(mod.aov)
# library(gridExtra) used to place all graphs on the same device
p1 <- ggplot(data = mod.aov, aes(x = 1:dim(fortify(mod.aov))[1], y = .stdresid, 
color = tire)) + geom_point() + labs(y = "Standardized Residuals", 
x = "Ordered Residuals") + geom_hline(yintercept = c(-3,-2, 2, 3), 
linetype = "dashed", col = "pink") + theme_bw()
p2 <- ggplot(data = mod.aov, aes(sample = .stdresid, color = tire)) +
stat_qq()  + geom_abline(intercept = 0, slope = 1, linetype = "dashed", col = "pink") + theme_bw()
p3 <- ggplot(data = mod.aov, aes(x = .fitted, y = .stdresid, color = tire)) + 
geom_point() + geom_hline(yintercept = 0, linetype = "dashed") + 
labs(y = "Standardized Residuals", x = "Fitted Values") + 
geom_hline(yintercept = c(-3, -2, 2, 3), linetype = "dashed", color = "pink") + 
theme_bw()
p1
p2
p3
multiplot(p1, p2, p3, cols = 1)
# Or use the following (not run) to get all graphs on the same device
# library(gridExtra)
# grid.arrange(p1, p2, p3, nrow=3)
rm(mod.aov, p1, p2, p3)

PASWR2 documentation built on Sept. 5, 2021, 5:44 p.m.