lineup: The line-up protocol.

Description Usage Arguments Details Examples

View source: R/protocols.r

Description

In this protocol the plot of the real data is embedded amongst a field of plots of data generated to be consistent with some null hypothesis. If the observe can pick the real data as different from the others, this lends weight to the statistical significance of the structure in the plot. The protocol is described in Buja, Cook, Hofmann, Lawrence, Lee, Swayne, Wickham (2009) Statistical inference for exploratory data analysis and model diagnostics, Phil. Trans. R. Soc. A, 367, 4361-4383.

Usage

1
lineup(method, true = NULL, n = 20, pos = sample(n, 1), samples = NULL)

Arguments

method

method for generating null data sets

true

true data set. If NULL, find_plot_data will attempt to extract it from the current ggplot2 plot.

n

total number of samples to generate (including true data)

pos

position of true data. Leave missing to pick position at random. Encryped position will be printed on the command line, decrypt to understand.

samples

samples generated under the null hypothesis. Only specify this if you don't want lineup to generate the data for you.

Details

Generate n - 1 null datasets and randomly position the true data. If you pick the real data as being noticeably different, then you have formally established that it is different to with p-value 1/n.

Examples

1
2
3
4
5
6
7
if (require('ggplot2')) {
qplot(mpg, wt, data = mtcars) %+%
  lineup(null_permute('mpg'), mtcars) +
  facet_wrap(~ .sample)
qplot(mpg, .sample, data = lineup(null_permute('cyl'), mtcars),
  colour = factor(cyl))
}

nullabor documentation built on May 29, 2017, 9:44 a.m.

Related to lineup in nullabor...