0
$\begingroup$

I am new to stats and I need to compare two groups of count data. I have two groups of participants who did X a number of times (out of 90 possible times). Group A did X 59 out of 90 times and Group B did X 74 out of 90 times. How do I set up the table to know if there is a significant difference between the two groups? Thank you in advance!

$\endgroup$
  • $\begingroup$ Is the question of interest specifically about B doing more - a one-tailed hypothesis - or is that wording just a resulting of it being higher in the observed data and the underlying question is really just about a difference? $\endgroup$ – Glen_b Nov 11 '17 at 22:49
  • $\begingroup$ The underlying question is only whether there is a significant difference or not. Sorry-my wording was unclear. $\endgroup$ – Veronica Nov 12 '17 at 11:04
  • $\begingroup$ Could you edit the question to clarify it? It's best if clarifications aren't only in the comments. $\endgroup$ – Glen_b Nov 12 '17 at 20:22
2
$\begingroup$

Welcome to the Cross Validated!

You can perform a Pearson's chi-square test as follows:

${\chi}^{2} = \sum \frac{(O - E)^2}{E}$

Where E is a set of expected values in a contingency table and O is the set of observed values (e.g. those in your question: 59, 31, 74, 16).

Your contingency table is then:

59 | 74

31 | 16

The expected values are calculated by the sum of the column (e.g. for the first column (59 + 31) divided by the total number of observations (n = 180 in your case), multiplied by the sum of the row (e.g. for the first row - 59 + 74).

Once you have these expected values, use the equation above to calculate the chi-square value. In words, you take the observed value of a cell, minus the expected value of that cell, square that number and then divide by the expected value of that cell. Then sum all the values that you get from doing this for each cell.

With your newly calculated chi-square value, use a table of critical values of the chi-square distribution to assess whether there is a significant difference.

You will need to know the 'degrees of freedom' to be able to use this table. df = number of rows minus 1, then multiplied by the number of columns minus 1.

$\endgroup$
  • $\begingroup$ Thank you so much! This is very clear. One question though...should that be 16 instead of 26? The top figure plus the bottom figure should equal 90 (total observations), is that correct? $\endgroup$ – Veronica Nov 12 '17 at 11:03
  • $\begingroup$ Yes. Corrected in the text. $\endgroup$ – Simon Nov 13 '17 at 19:35
0
$\begingroup$

It is helpful to use software to conduct a chi-square test of association.

One option is to use an online calculator. For example, this one. It provides the chi-square test result with p-value and Cramér's V as a measure of effect size.

Note that in this calculator, for a 2 x 2 table, by default it reports the chi-square and p- values with a Yate's continuity correction. (And gives you the uncorrected values in a separate box). In general it is important to understand what assumptions or corrections a piece of software uses by default for a given analysis.

As another alternative, the following code could be run in R. You can install R for free on your computer, or use an online editor like JDoodle. The code will produce the corrected and uncorrect chi-square test, and produce Cramer's V.

Matrix = matrix(c(59, 31, 74, 16), nrow=2)

Matrix

chisq.test(Matrix)

chisq.test(Matrix, correct=FALSE)

Cramer = sqrt(chisq.test(Matrix, correct=FALSE)$statistic/sum(Matrix)/(min(nrow(Matrix), ncol(Matrix))-1))

names(Cramer) = "Cramer's V"

Cramer

Finally, it is helpful to read-up on tests and alternatives. To get started, I might recommend The Handbook of Biological Statistics or Summary and Analysis of Extension Program Evaluation in R.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.