1,286 bytes added ,  09:47, 24 May 2011
no edit summary
Line 5: Line 5:  
==Comparing a qualitative variable between different groups==
 
==Comparing a qualitative variable between different groups==
 
===Chi-square test===
 
===Chi-square test===
The chi-square test is one of the most commonly used hypothesis tests, and allows the comparison of any qualitative exposure with any qualitative outcome (given that certain assumptions are met). As a simple example, it may be used to investigate the effect of previous exposure to substance x on disease experience amongst a group of animals - as shown in the table below:
+
The chi-square test is one of the most commonly used hypothesis tests, and allows the comparison of any qualitative exposure with any qualitative outcome (given that certain assumptions are met). As a simple example, it may be used to investigate the effect of previous exposure to substance x on disease experience amongst a group of animals - as classified in the 2x2 contingency table below:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
| '''Disease status''' || '''Exposed''' || '''Unexposed''' || '''Total'''
+
| '''Disease status''' || '''Exposed to x''' || '''Unexposed to x''' || '''Total'''
 
|-
 
|-
 
| '''Diseased''' || a<sub>1</sub> || a<sub>0</sub> || m<sub>1</sub>
 
| '''Diseased''' || a<sub>1</sub> || a<sub>0</sub> || m<sub>1</sub>
Line 16: Line 16:  
| '''Total''' || n<sub>1</sub> || n<sub>0</sub> || n
 
| '''Total''' || n<sub>1</sub> || n<sub>0</sub> || n
 
|}
 
|}
A chi-square test could also be used to investigate whether the body condition score of a horse was associated its lameness score, for example:
+
A chi-square test could also be used to investigate whether the body condition score of a horse was associated its lameness score, as classified in the rxc contingency table below:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 33: Line 33:  
| '''Total''' || n<sub>1</sub> || n<sub>2</sub> || n<sub>3</sub> || n
 
| '''Total''' || n<sub>1</sub> || n<sub>2</sub> || n<sub>3</sub> || n
 
|}
 
|}
 +
In either case, the chi-square test is based upon the comparison of the '''observed''' results, with those results which would be '''expected''' if there was no association between the exposure and outcome of interest. For each individual cell, this 'expected' value is calculated, is subtracted from the observed value and the answer is squared. This is then divided by the expected value and the process is repeated for all other cells. These results are then summed to give a '''test statistic''', which can be interpreted using a table of the chi-squared distribution (or by using a computer program) in order to give a p-value. The number of cells involved in the calculation of the test statistic will have an impact upon its magnitude, and this is accounted for in the calculation in the form of 'degrees of freedom' (which can be a difficult concept to understand, but relate in this context to the number of cells which are free to take any value, given that the test statistic is known). The number of degrees of freedom can be calculated by subtracting 1 from the number of rows, subtracting 1 from the number of columns, and multiplying these together - meaning that a 2x2 table has one degree of freedom.
    
===Fisher's exact test===
 
===Fisher's exact test===
700

edits