Learn R Programming

cata (version 0.1.0.27)

cochranQ: Cochran's Q test

Description

Conduct Cochran's Q test assuming equal columns proportions for matched binary responses versus the alternative hypothesis of unequal column proportions.

Usage

cochranQ(X, quiet = FALSE, digits = getOption("digits"))

Value

Cochran's Q test results (statistic, degrees of freedom, p-value)

Arguments

X

matrix of \(I\) assessors (rows) and \(J\) products (columns) where values are 0 (not checked) or 1 (checked)

quiet

if FALSE (default) then it prints information related to the test; if TRUE it returns only the test statistic (Q)

digits

for rounding

Author

J.C. Castura

Details

Method returns test statistic, degrees of freedom, and p value from Cochran's Q test.

References

Cochran, W.G. (1950). The comparison of percentages in matched samples. Biometrika, 37, 256-266, tools:::Rd_expr_doi("10.2307/2332378")

Meyners, M., Castura, J.C., & Carr, B.T. (2013). Existing and new approaches for the analysis of CATA data. Food Quality and Preference, 30, 309-319, tools:::Rd_expr_doi("10.1016/j.foodqual.2013.06.010")

See Also

mcnemarQ

Examples

Run this code
data(bread)

# Cochran's Q test on the first 50 consumers on the first attribute ("Fresh")
cochranQ(bread$cata[1:50, , 1], digits=3)

# Same, returning only test statistics for the first 4 attributes
t(res <- apply(bread$cata[1:50, , 1:4], 3, cochranQ, quiet=TRUE, digits=3))

Run the code above in your browser using DataLab