Be the first to rate this file! 37 downloads (last 30 days) File Size: 2.48 KB File ID: #18705

Chi-square test - contingency tables

by Panagiotis Moulos

 

11 Feb 2008 (Updated 11 Feb 2008)

Code covered by BSD License  

This function performs the chi-square test for 2x2 contingency tables

Download Now | Watch this File

File Information
Description

CHISQUARECONT takes as input a 2x2 matrix that represents a 2x2 contingency table and
calculates the probability of obtaining the observed and each of the more extreme tables
based on the pearson chi square test which is based on the chi square distribution. The
chi square test might become unreliable when the total number of expected frequencies
(cell values in the contingency table) are not large enough (the total is smaller than
20 or a cell contains a value lower than 5). In such cases, the Fisher exact test should
be used instead.

Usage : p = chisquarecont(contab)
        [p,x2] = chisquarecont(contab)

Input : contab -> a 2x2 contigency table created from the frequency data
Output : p -> The p-value of the test (the probability of obtaining the observed
                   and each of the more extreme tables)
         x2 -> The value for the chi square statistic

For an example, see help inside the file.

Required Products Statistics Toolbox
MATLAB release MATLAB 7.1.0 (R14SP3)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
statistics Panagiotis Moulos 22 Oct 2008 09:47:25
probability Panagiotis Moulos 22 Oct 2008 09:47:25
chi square Panagiotis Moulos 22 Oct 2008 09:47:25
contingency table Panagiotis Moulos 22 Oct 2008 09:47:25
frequency Panagiotis Moulos 22 Oct 2008 09:47:25
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com