Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chi Square Analyses: Comparing Frequency Distributions.

Similar presentations


Presentation on theme: "Chi Square Analyses: Comparing Frequency Distributions."— Presentation transcript:

1 Chi Square Analyses: Comparing Frequency Distributions

2

3 Chi-Square Tests test probability distributions from nominal, ordinal, or discrete data Compare data to a theoretical distribution. Compare two sets of data

4 Chi Square Tests for Goodness of Fit Two types – extrinsic and intrinsic Assumptions of both tests – Measurement on at least a nominal scale – Observations are independent – The expected frequencies for each category must be specified – The sample size must be sufficiently large so that no category has an expected frequency of < 5.

5 Chi Square Tests for Goodness of Fit Hypotheses – Null – the observed frequency distribution is the same as the hypothesized frequency distribution – Alternative - the observed and hypothesized distributions are different

6 Chi Square Tests for Goodness of Fit Test Statistic – The test statistic is based on the difference between the observed and expected frequencies. It is calculated by:

7 Chi Square Test for Goodness of Fit In an extrinsic test, no population parameters need to be estimated from the data. An intrinsic test requires an estimation of a population parameter from the data collected. – Technically, the degrees of freedom should be reduced by 1 for each parameter estimated – However, this is a minor effect and not always considered (we won’t worry about it). – An intrinsic test is commonly used when comparing a sample to a derived distribution such as the poisson or binomial distribution

8 Chi Square Test for Goodness of Fit (Extrinsic) Example – Cross of two pea plants with purple flowers. – When you do the cross, you get 80 plants with round seeds, and 20 with wrinkled. – Your biological hypotheses are that: the parents were heterozygous (since some white flowered offspring were produced) P is completely dominant to p genes segregate correctly fertilization is random zygotes have the same probability of survival with respect to this gene.

9 Example – Your biological hypotheses are that: the parents were heterozygous (since some white flowered offspring were produced) P is completely dominant to p genes segregate correctly fertilization is random zygotes have the same probability of survival with respect to this gene. GAMETES of PARENTS in = Frequency Pp PPPPp p pp Expected Ratio under THESE hypotheses: ¾ Purple offspring ¼ White offspring

10 Chi Square Test for Goodness of Fit (Extrinsic) Offspring Phenotype OBSERVEDEXPECTED by HYPOTHESIS O-E(O-E) 2 Purple8075 (3/4)525 White2025 (1/4)-525 100 SUM = 0 bummer SUM = 25 Hmmm… So, we want to see how close our observed results are to what we expect under our hypothesis. Maybe the “total difference” would be a good measure… But sample size matters….

11 Chi Square Test for Goodness of Fit (Extrinsic) Offspring Phenotype OBSERVEDEXPECTED by HYPOTHESIS O-E(O-E) 2 Purple75057500 (3/4)525 White24952500 (1/4)-525 10000 SUM = 0 bummer SUM = 25 same So, we want to see how close our observed results are to what we expect under our hypothesis. Maybe the “total difference” would be a good measure… But sample size matters….these results are a lot closer to the expected values, but give the same total. So we need to evaluate the “sum of Squares” in relation to sample size… “mean square”

12 Chi Square Test for Goodness of Fit (Extrinsic) Offspring Phenotype OBSERVEDEXPECTED by HYPOTHESIS O-E(O-E) 2 (O-E) 2 /E Purple8075 (3/4)5250.33 White2025 (1/4)-5251.00 100 1.33 So, we want to see how close our observed results are to what we expect under our hypothesis. Maybe the “total difference” would be a good measure… This = your calculated Chi-Square value, and you compare it to a Chi-Square table with df = Categories (P or W = 2) – 1 = 2-1 = 1.

13 The critical value is associated with a probability; in this case p = 0.05. This is the probability that results as deviant as yours could have occurred by chance if your null hypothesis was true. You only reject the null hypothesis if you observe a more deviant pattern. (This would make your calculated value greater than the threshold critical value).

14 Chi Square Test for Goodness of Fit (Intrinsic) Example – In the 98 year period from 1900-1997, there were 159 U.S. landfalling hurricanes. Does the number of landfalling hurricanes per year follow a Poisson distribution? – Calculate the expected frequencies – Calculate the expected number by multiplying the frequency by the number of categories (here, years = 98) Formula: p(x) = X x e -x x!

15 Chi Square Test for Goodness of Fit (Intrinsic) Hurricanes per year Observed # Expected freq Expected # 0180.19819.4 1340.32031.36 2240.26025.48 3160.14013.72 430.0575.59 510.0181.76 620.0070.69 159

16 Chi Square Test for Goodness of Fit (Intrinsic) Hurricanes per year Observed # Expected freq Expected # 0180.19819.4 1340.32031.36 2240.26025.48 3160.14013.72 >468.040.518 Since we had an expected value <5, we combined categories to fix this problem.

17 Chi Square Test for Goodness of Fit (Intrinsic) Calculate the chi square statistic in the same way as before, and look up on table. Here: – X 2 = 1.306 – Tabled value for  = 0.05 = 7.81 – Thus, we fail to reject the null hypothesis, supporting the claim that the annual number of landfalling U.S. hurricanes follows a Poisson distribution (rare, independent, random).

18 Chi Square Test of Independence Also called the Chi Square Test for Contingency Tables This test is performed to see if two variables, both measured on a nominal scale, are related in some way. The question asked here is if there is a relationship between the variables; the null hypothesis is that no relationship exists – they are “independent”.

19 Chi Square Test of Independence Steps in doing the test – 1. Form a table, or matrix, from the data collected – 2. Calculate row, column, and grand totals for the matrix – 3. Use these totals to calculate expected values (frequencies) for each cell in the matrix Calculated by: [(row total) x (column total)]/grand total Based on the product rule – the probability of two independent events occurring together is the product of their independent probabilities.

20 Chi Square Test of Independence Classic Example: Testing for Linkage or Independent Assortment between two loci Suppose we cross two pea plants: PpTt x pptt - Purple is completely dominant to white - Tall is completely dominant to short Produce the following results in the offspring: PT = 32 Pt = 22 pT = 23 Pt = 36 113 ARE THE GENES ASSORTING INDEPENDENTLY, OR ARE THEY LINKED?

21 Chi Square Test of Independence ARE THE GENES ASSORTING INDEPENDENTLY, OR ARE THEY LINKED? PT = 32 Pt = 22 pT = 23 Pt = 36 113 Tt P322254 p233659 5558113 CONTINGENCY TABLE IF these events (flower color and plant height) are inherited independently, THEN the frequency of any combined outcome should be = to the product of their independent probabilities: IF IA, THEN f(PT) = f(P) x f(T) x N = 54/113 x 55/113 x 113 = 26.28318 Reduces to: f(PT) = f(P) x f(T) x N = 54 x 55/113 = 26.28318 = RT x CT/GT

22 Chi Square Test of Independence ARE THE GENES ASSORTING INDEPENDENTLY, OR ARE THEY LINKED? PT = 32 Pt = 22 pT = 23 Pt = 36 113 Texpt P3226.282227.7254 p2328.723630.2859 5558113 CONTINGENCY TABLE IF these events (flower color and plant height) are inherited independently, THEN the frequency of any combined outcome should be = to the product of their independent probabilities: IF IA, THEN f(PT) = f(P) x f(T) x N = 54/113 x 55/113 x 113 = 26.28318 Reduces to: f(PT) = f(P) x f(T) x N = 54 x 55/113 = 26.28318 = RT x CT/GT

23 Texpt P3226.282227.7254 p2328.723630.2859 5558113 ObsExpO-E(O-E) 2 /E PT3226.285.721.24 Pt2227.72-5.721.18 pT2328.72-5.721.14 pt3630.285.721.08 4.64 Df = (R-1)(C-1) in contingency table (1)(1) = 1, p = 0.05, critical = 3.84…. Reject Ho.

24


Download ppt "Chi Square Analyses: Comparing Frequency Distributions."

Similar presentations


Ads by Google