Learn R Programming

ANSM5 (version 1.1.1)

cochran.q: Perform Cochran Q test

Description

cochran.q() performs the Cochran Q test and is used in chapter 7 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

cochran.q(
  y,
  groups,
  blocks,
  max.exact.perms = 1e+05,
  nsims.mc = 1e+05,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE
)

Value

An ANSMtest object with the results from applying the function

Arguments

y

Binary vector of same length as groups, blocks

groups

Factor of same length as y, blocks with levels such that length(y) == nlevels(groups) * nlevels(blocks)

blocks

Factor of same length as y, groups with levels such that length(y) == nlevels(groups) * nlevels(blocks)

max.exact.perms

Maximum number of permutations allowed for exact calculations (defaults to 100000)

nsims.mc

Number of Monte Carlo simulations to be performed (defaults to 100000)

seed

Random number seed to be used for Monte Carlo simulations (defaults to NULL)

do.asymp

Boolean indicating whether or not to perform asymptotic calculations (defaults to FALSE)

do.exact

Boolean indicating whether or not to perform exact calculations (defaults to TRUE)

Examples

Run this code
# Example 7.8 from "Applied Nonparametric Statistical Methods" (5th edition)
cochran.q(ch7$outcome, ch7$climb, ch7$member, do.exact = FALSE, do.asymp = TRUE)

# Exercise 7.14 from "Applied Nonparametric Statistical Methods" (5th edition)
cochran.q(ch7$soc.media.use, ch7$participant, ch7$day, do.exact = FALSE, do.asymp = TRUE)

Run the code above in your browser using DataLab