sim.qqnorm: Simulation of QQ plots for the Normal distribution

Description

This demo shows the possible QQ plots created by random numbers generated from a Normal distribution so that users can get a rough idea about how QQ plots really look like.

Usage

1
sim.qqnorm(n = 20, last.plot = NULL, ...)

Arguments

n

integer: sample size

last.plot

an expression to be evaluated after the plot is drawn, e.g. expression(abline(0, 1)) to add the diagonal line

...

other arguments passed to qqnorm

Details

When the sample size is small, it is hard to get a correct inference about the distribution of data from a QQ plot. Even if the sample size is large, usually there are outliers far away from the straight line. Therefore, don't overinterpret the QQ plots.

Value

NULL

Author(s)

Yihui Xie

See Also

qqnorm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
oopt = ani.options(interval = 0.1, nmax = ifelse(interactive(), 100, 
    2))
par(mar = c(3, 3, 2, 0.5), mgp = c(1.5, 0.5, 0), tcl = -0.3)

sim.qqnorm(n = 20, last.plot = expression(abline(0, 1)))

## HTML animation pages
saveHTML({
    par(mar = c(3, 3, 1, 0.5), mgp = c(1.5, 0.5, 0), tcl = -0.3)
    ani.options(interval = 0.1, nmax = ifelse(interactive(), 100, 2))
    sim.qqnorm(n = 15, pch = 20, main = "")
}, img.name = "sim.qqnorm", htmlfile = "sim.qqnorm.html", ani.height = 500, 
    ani.width = 500, title = "Demonstration of Simulated QQ Plots", 
    description = c("This animation shows the QQ plots of random numbers", 
        "from a Normal distribution. Does them really look like normally", 
        "distributed?"))

ani.options(oopt)

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.