Learn R Programming

RVAideMemoire (version 0.9-11)

cochran.qtest: Cochran's Q test

Description

Perform the Cochran's Q test for unreplicated randomized block design experiments whith a binary response variable and paired data. If the p-value of the test is significative, the function performs pairwise comparisons by using the Wilcoxon sign test.

Usage

cochran.qtest(formula, data=NULL, alpha = 0.05, p.method = "fdr")

Arguments

formula
a formula of the form a ~ b | c, where a, b and c give the data values and corresponding groups and blocks, respectively.
data
an optional data frame containing the variables in the formula formula. By default the variables are taken from environment(formula).
alpha
significance level to compute pairwise comparisons.
p.method
method for p-values correction. See help of the p.adjust() function.

Value

  • data.namea character string giving the name(s) of the data.
  • statistictest statistics.
  • p.valuep-value of the global test.
  • tab.testdata frame of global test result.
  • alphasignificance level.
  • p.adjust.methodmethod for p-values correction.
  • multcompdata frame of pairwise comparisons result.

Examples

Run this code
response <- c(0,1,1,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,0,1,1,0,0,1,0,1,1,0,0,1)
fact <- gl(3,1,30,labels=LETTERS[1:3])
block <- gl(10,3,labels=letters[1:10])
cochran.qtest(response~fact|block)

Run the code above in your browser using DataLab