randPlot | R Documentation |
Plots observed test statistics against their randomization distributions and against the randomization-based intervals for their corresponding estimands.
randPlot( results, coverage = 0.95, breaks = 10, plotDim = c(length(results$obs_stat), 1) )
results |
a resultant object of the |
coverage |
a number specifying the desired coverage level (defaults to |
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 |
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).
The plot(s) described in details will be displayed.
Joseph J. Lee and Tirthankar Dasgupta
randTest
, randInterval
# 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.