nonpar (version 1.0.1)

cochrans.q: Cochran's Q Test

Description

This function will perform the Cochran's Q Test to test for identical treatment effects in a two-way randomized block design with k treatments.

Usage

cochrans.q(x, alpha=NULL)

Arguments

x

A b x k matrix, where b is the number of blocking factors and k is the number of treatment factors.

alpha

The Significance level, defaults to 0.05.

Value

Q

This is the Cochran's Q Test Statistic.

Degrees of Freedom

The number of degrees of freedom used in calculating the p-value.

Significance Level

Returns the alpha value.

P-value

Returns the p-value from the Cochran's Q Test.

References

https://www.r-bloggers.com/cochran-q-test-for-k-related-samples-in-r/

http://rcompanion.org/handbook/H_07.html

Examples

Run this code
# NOT RUN {
  ## Run Cochran's Q Test on a matrix.
  cochrans.q(matrix(c(1,1,1,1,1,1,
              1,1,0,1,1,1,
              0,0,0,1,0,0,
              0,1,0,0,1,1), 6, 4))

  ## Cochran's Q Test works for any size matrix.
  cochrans.q(matrix(c(0,1,0,0,1,0,0,0,1,0,0,0,0,0,
                0,1,1,1,1,1,1,1,0,1,1,1,1,1,
                0,1,0,0,0,0,0,0,1,0,0,0,0,0,
                0,1,1,0,0,1,1,0,0,0,0,1,0,1), 14, 4), alpha=0.01)

# }

Run the code above in your browser using DataLab