cochranQ | R Documentation |
Conduct Cochran's Q test assuming equal columns proportions for matched binary responses versus the alternative hypothesis of unequal column proportions.
cochranQ(X, quiet = FALSE, digits = getOption("digits"))
X |
matrix of |
quiet |
if |
digits |
for rounding |
Method returns test statistic, degrees of freedom, and p value from Cochran's Q test.
Cochran's Q test results (statistic, degrees of freedom, p-value)
J.C. Castura
Cochran, W.G. (1950). The comparison of percentages in matched samples. Biometrika, 37, 256-266, \Sexpr[results=rd]{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, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.foodqual.2013.06.010")}
mcnemarQ
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.