Learn R Programming

randomizationInference (version 1.0.4)

randInterval: Randomization-Based Null Interval

Description

Calculates randomization-based intervals under the null hypothesis for the specified test statistics and coverage levels.

Usage

randInterval(results, coverage = 0.95)

Arguments

results

a resultant object of the randTest function.

coverage

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

Value

A randomization-based interval (or multiple intervals) for the test statistic(s) under the null hypothesis with the specified coverage level.

Details

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

See Also

randTest, randPlot

Examples

Run this code
# NOT RUN {
# 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)
randInterval(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)
)
randInterval(readingTest)
# }

Run the code above in your browser using DataLab