Description Usage Arguments Methods (by class) See Also Examples
Plots two plots side by side. Firstly it draws a Normal QQplot of the
residuals, along with a line which has an intercept at the mean of the
residuals and a slope equal to the standard deviation of the residuals. If
shapiro.wilk = TRUE
then, in the top left hand corner of the QQ
plot, the Pvalue from the ShapiroWilk test for normality is given.
Secondly, it draws a histogram of the residuals. A normal distribution is
fitted and superimposed over the histogram. NOTE: if you want to leave the
xaxis blank in the histogram then, use xlab = c("Theoretical Quantiles", " ")
, i.e. leave a space between the quotes. If you don't leave a space, then information
will be extracted from x
.
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 29 30 31 32 33 34 35  normcheck(x, ...)
## Default S3 method:
normcheck(
x,
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,
...
)
## S3 method for class 'lm'
normcheck(
x,
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,
...
)

x 
the residuals from fitting a linear model. Alternatively, a fitted 
... 
additional arguments which are passed to both 
xlab 
a title for the xaxis of both the QQ plot and the histogram: see 
ylab 
a title for the yaxis of both the QQ plot and the histogram: see 
main 
a title for both the QQ plot and the histogram: see 
col 
a color for the bars of the histogram. 
bootstrap 
if 
B 
the number of bootstrap samples to take. Five should be sufficient, but hey maybe you want more? 
bpch 
the plotting symbol used for the bootstrap samples. Legal values are the same as any legal
value for 
bcol 
the plotting colour used for the bootstrap samples. Legal values are the same as any legal
value for 
shapiro.wilk 
if 
whichPlot 
legal values are 
usePar 
if 
default
: Testing for normality plot
lm
: Testing for normality plot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  # An exponential growth curve
e = rnorm(100, 0, 0.1)
x = rnorm(100)
y = exp(5 + 3 * x + e)
fit = lm(y ~ x)
normcheck(fit)
# An exponential growth curve with the correct transformation
fit = lm(log(y) ~ x)
normcheck(fit)
# Same example as above except we use normcheck.default
normcheck(residuals(fit))
# Peruvian Indians data
data(peru.df)
normcheck(lm(BP ~ weight, data = peru.df))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.