KNOWLEDGEBASE - ARTICLE #1789

How to compare observed and expected counts with GraphPad QuickCalcs

 

Example. Compare observed and expected frequencies.

This example (adapted from pages 230-232 of Intuitive Biostatistics) helps you use the chi-square calculator that is part of GraphPad QuickCalcs. Go to it.

Assume that an average of 10% of patients die during or immediately following a certain risky operation. But last month 16 of 75 patients died. You want to know whether the increase reflects a real change or whether it is just a coincidence. Statistical calculations cannot answer that question definitively, but they can answer a related one: If the probability of dying remained at 10%, what is the probability of observing 16 or more deaths out of 75 patients? If the probability of dying remained at 10%, we would expect 10% x 75 or 7.5 deaths in an average sample of 75 patients. But in a particular sample of 75 patients, we might see more or less than the expected number.

Enter the data into GraphPad's calculator like this:

Category Observed # Expected
Alive 59 67.5
Dead 16 7.5

Check the option that you entered the expected values as actual numbers expected. Or check the option that you are entering percentages and enter 90 and 10, rather than 67.5 and 7.5.

Here are the results:

P value and statistical significance: 

Chi squared equals 10.704 with 1 degrees of freedom. 

The two-tailed P value equals 0.0011 

By conventional criteria, this difference is considered to be very statistically significant. 

The P value answers this question: If the theory that generated the expected values were correct, what is the probability of observing such a large discrepancy (or larger) between observed and expected values? A small P value is evidence that the data are not sampled from the distribution you expected.

How the calculations work.

The null hypothesis is that the observed data are sampled from a populations with the expected frequencies. We need to combine together the discrepancies between the observed and expected, and then calculate a P value answering this question: If the null hypothesis were true, what is the chance of randomly selecting subjects with this large a discrepancy between observed and expected counts?

We can combine the observed and expected counts into a variable, chi-square. To calculate chi-square:

  1. For each category compute the difference between observed and expected counts.
  2. Square that difference and divide by the expected count.
  3. Add the values for all categories. In other words, compute the sum of (O-E)2/E.
  4. Use a table (or computer program) to calculate the P value. You need to know that the number of degrees of freedom equals the number of categories minus 1.

When there are only two categories, some statisticians recommend using the Yates' correction. Reduces the value of chi-square so increases the P value. With large sample sizes, this correction makes little difference. With small samples, it makes more difference. Statisticians disagree about when to use the Yates' correction, and this calculator does not apply it.

Explore the Knowledgebase

Analyze, graph and present your scientific work easily with GraphPad Prism. No coding required.