Monday, April 6, 2015

Chi Square candy simulation

Chi Square (X2) Modeling Using Candy
Borrowed from biologycorner.com
The Chi Square test is often used in science to determine if data you observe from an experiment is close enough to the predicted data. In genetics, for instance, you might expect to get a 75% to 25% ratio if you crossed two heterozygous tall plants (Tt x Tt). Calculating the X2 values help you determine whether the results follow the prediction and if the variations from the exact ratio are due to random chance. It's the question of "how close is close enough?" If the numbers differ greatly from your expected results, then it's possible that other factors may be influencing your results.
A chi square analysis requires a scientist to propose a null hypothesis and an alternative hypothesis. In statistics, the only way of supporting your hypothesis is to refuse the null hypothesis. In other words, rather than trying to prove your idea right, you must show that the other idea (hypothesis) is likely to be wrong. That is your NULL hypothesis.
Chi square values are used to show that the likelihood that the outcome is due to random chance is very unlikely. A null hypothesis can never be proven, data can only reject or fail to reject the null hypothesis.
Materials: several bags of colored candy, such as M & M's, Skittles, Reese's Pieces, or Gummy Bears. You will need approximately 100-200 candies.
Procedure:
1) Look into the bag and determine how many colors are present and write them into Table 1
2) Without counting, estimate the number (percentage out of 100%) of each color and write them into Table 1 under "Percentage Expected"
3) Sort the candy and write down the number of each color into Table 1 under "Number Observed"
4) Complete the table by determining the total number of candies and number expected columns
Color of Candy
Percentage Estimate
Number Observed
Number Expected
(total # of candy x percentage estimate)






















Total # of candies =

As you look at the data above, consider the two comparable numbers. The number you would expect to count if your percentage estimate was correct, and then the number you actually counted (number observed). For example, if you initially thought that you'd see 25% yellow candies, and you counted 200 pieces, you would then expect to see 50 yellow candies. You may have only counted 40 yellows.

In effect, your estimate is your hypothesis. A chi square analysis will determine if the observed number is close enough to the expected number to consider your hypothesis supported.
The Chi Square (X2) Equation








In order to complete the calculation, you sum each of the traits (colors) that you measured. To help you with this, we will break the process into steps.

Classes (colors)
Expected (e)
Observed (o)
(o-e)2/e

1




2




3




4




5





Sum (add the values from row 1-5); this is your X2 value

Use the chi square chart below to determine if your X2 supports or rejects your hypothesis.
The degrees of freedom is determined by subtracting 1 from the number of colors you analyzed. (For example, if you had 4 colors to count, the degrees of freedom is 3) 







Summary and Analysis
1) What was your initial hypothesis?

2) How do you show that your hypothesis is correct (or incorrect)?

3) Explain what is meant by a "good fit"?

4) Propose a way that a chi square analysis could be used in other experiments, such as genetics or drug trials.




Also, complete these practice problems as part of the assignment (all of this info goes into one document to turn into canvas)

No comments:

Post a Comment