CochranQtest
This m-file performs the Cochran's Q test for multi-way tables which each variable has two levels, that is, for 2x2...x2 tables. It is used to test the homogeneity of the one-dimensional margins. So, Cochran's Q test is a nonparametric test examining change in a dichotomous variable across more than two observations. It can be approximate to a Chi-square statistic. When there are only two binary response variables, Cochran's Q test simplifies to McNemar's test. The test was proposed by Cochran (1950).
Then, for a NxK table where N is the number of subjects or blocks and K is the number of repeated measures or different tratments. The null hypothesis to test is,
Ho: p_1 = p_2 = . . . = p_K; j = 1,2,...,K.
p_j is the probability of a success for a case under condition/treatment j.
It needs to input X-data matrix (size of matrix must be N-by-K; binary value=column 1, treatment or repeated measure=column 2;subject or block=column 3), and alpha-significance level (default = 0.05).
The output is a table with the Cochran statistic, number of subjects or blocks, number of repeated mesures, degrees of freedom and upper-tail P-value.
Cite As
Antonio Trujillo-Ortiz (2024). CochranQtest (https://www.mathworks.com/matlabcentral/fileexchange/6431-cochranqtest), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 | Text was improved. |