Last data update: 2014.03.03

R: Randomization-Based Plot
randPlotR Documentation

Randomization-Based Plot

Description

Plots observed test statistics against their randomization distributions and against the randomization-based intervals for their corresponding estimands.

Usage

randPlot(results, coverage = 0.95, breaks = 10,
    plotDim = c(length(results$obs_stat), 1))

Arguments

results

a resultant object of the randTest function.

coverage

a number specifying the desired coverage level (defaults to 0.95).

breaks

a value specifying the histogram break pattern (defaults to 10).

plotDim

a numeric vector (of length 2) specifying the desired plot dimensions (if necessary, defaults to c(length(results$obs_stat), 1)).

Details

One plot will be displayed for each test statistic specified by results.

Observed test statistic values are demarcated by solid red lines. Comparison values under the null hypothesis are demarcated by solid black lines. Randomization-based interval bounds for the specified coverage level are demarcated by dotted blue lines.

Setting plotDim = c(a, b) is equivalent to specifying par(mfrow=c(a, b)). Plot dimensions are automatically reset to c(1, 1) afterward. If multiple test statistics are tested simultaneously, plotDim may need to be specified suitably for the plots to be displayed.

If multiple tests are conducted simultaneously, users should be wary of multiple comparisons and make adjustments accordingly (e.g., Bonferroni corrections).

Value

The plot(s) described in details will be displayed.

Author(s)

Joseph J. Lee and Tirthankar Dasgupta

See Also

randTest, randInterval

Examples

## Completely randomized design example
## with one treatment factor at two levels
w = c(rep(0,5), rep(1,5))
y = rnorm(10, mean = 0, sd = 1)
## Two-sided test
twoSidedTest = randTest(y, w, nrand = 50, calcTestStat = diffMeans)
randPlot(twoSidedTest)

## Reading comprehension pre- and post-test example
data(reading)
## Testing within-block pairwise effects
readingTest=randTest(y = reading$Diff1, w = reading$Group, nrand = 50,
    calcTestStat = withinBlockEffects,
    calcOptions = list(block = reading$Block,
        pairs = rbind(c("Basal", "DRTA"), c("Basal", "Strat"),
            c("DRTA", "Strat"), c("Basal", "DRTA"),
            c("Basal", "Strat"), c("DRTA", "Strat")),
        blockindex = c(rep(1,3), rep(2,3))),
    randOptions = list(type = "block", block = reading$Block))
randPlot(readingTest, breaks = 20, plotDim = c(2,3))

Results