modcheck {s20x} | R Documentation |
Model checking plots
Description
Plots four model checking plots: an pred-res plot (residuals against predicted values), a Normal Quantile-Quantile (Q-Q) plot, a histogram of the residuals with a normal distribution super-imposed and a Cook's Distance plot.
Usage
modcheck(x, ...)
## S3 method for class 'lm'
modcheck(
x,
plotOrder = 1:4,
args = list(eovcheck = list(smoother = FALSE, twosd = FALSE, levene = FALSE, ...),
normcheck = list(xlab = c("Theoretical Quantiles", ""), ylab = c("Sample Quantiles",
""), main = c("", ""), col = "light blue", bootstrap = FALSE, B = 5, bpch = 3, bcol =
"lightgrey", shapiro.wilk = FALSE, whichPlot = 1:2, usePar = TRUE, ...), cooks20x =
list(main = "Cook's Distance plot", xlab = "observation number", ylab =
"Cook's distance", line = c(0.5, 0.1, 2), cex.labels = 1, axisOpts = list(xAxis =
TRUE), ...)),
parVals = list(mfrow = c(2, 2), xaxs = "r", yaxs = "r", pty = "s", mai = c(0.2, 0.2,
0.05, 0.05)),
...
)
Arguments
x |
a vector of observations, or the residuals from fitting a linear model. Alternatively, a fitted |
plotOrder |
the order of the plots. 1: pred-res plot, 2: normal Q-Q plot, 3: histogram, 4: Cooks's Distance plot. |
args |
a list containing three additional lists |
parVals |
the values that are set via |
... |
additional paramaters. Included for future flexibility, but unsure how this might be used currently. |
Methods (by class)
-
modcheck(lm)
: Model checking plots
Examples
# An exponential growth curve
e = rnorm(100, 0, 0.1)
x = rnorm(100)
y = exp(5 + 3 * x + e)
fit = lm(y ~ x, data = data.frame(x, y))
modcheck(fit)
# An exponential growth curve with the correct transformation
fit = lm(log(y) ~ x, data = data.frame(x, y))
modcheck(fit)
# Peruvian Indians data
data(peru.df)
modcheck(lm(BP ~ weight, data = peru.df))