Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

- B.9 chi square by Ulster BOCES 1055 views
- Chi square test by Patel Parth 64391 views
- Chi square goodness of fit by Ken Plummer 556 views
- Chi β square test by Narayana Medical ... 14054 views
- 131 141 Chi Square Goodness Of Fit by CardinaleWay Mazda 2500 views
- Null hypothesis for a chi-square go... by Ken Plummer 3650 views

3,369 views

Published on

this is my stat 130 report about the chi-square goodness-of-fit test

No Downloads

Total views

3,369

On SlideShare

0

From Embeds

0

Number of Embeds

1

Shares

0

Downloads

281

Comments

0

Likes

4

No embeds

No notes for slide

- 1. Chi-SquareGoodness-of-Fit TestLOZANO, ALDRIN T.
- 2. Introduction The chi-square distribution can be used fortests concerning frequency distributions, such as: βIf a sample of buyers is given a choice ofautomobile colors, will each color be selected withthe same frequency?β
- 3. Assumptions- The data are obtained from a random sample- The expected frequency for each category must be 5 or more
- 4. Test for Goodness-of-Fit The chi-square statistic can be used to seewhether a frequency distribution fits a specificpattern. This is referred to as the chi-squared goodness-of-fit test.
- 5. Observed Frequencies vs ExpectedFrequencies Suppose a market analyst wished to seewhether consumers have any preference among fiveflavors of a new fruit soda. A sample of 100 peopleprovided these data: Cherry Strawberry Orange Lime Grape 32 28 16 14 10
- 6. Observed Frequencies vs ExpectedFrequencies Since the frequencies for each flavor wereobtained from a sample, these actual frequenciesare called the observed frequencies. The frequencies obtained by calculation (as ifthere were no preference) are called the expectedfrequencies.
- 7. Observed Frequencies vs ExpectedFrequencies Frequency Cherry Strawberry Orange Lime Grape Observed 32 28 16 14 10 Expected 20 20 20 20 20
- 8. Goodness-of-Fit Test The formula for the chi-square goodness-of-fittest is: (π β πΈ)2 π2 = πΈWhere: O β observed or obtained frequency E β expected or theoretical frquency
- 9. Goodness-of-Fit Test The degrees of freedom (df) is: ππ = (πΆ β 1)(π β 1)Where: C β number of columns R β number of rows
- 10. Example Is there enough evidence to reject the claimthat there is no preference in the selection of fruitsoda flavors, using the data shown previously? Let Ξ± = 0.05. Frequency Cherry Strawberry Orange Lime Grape Observed 32 28 16 14 10 Expected 20 20 20 20 20
- 11. SolutionStep 1: State the hypotheses and define the claim Ho: Consumers show no preference for flavors (claim) Ha: Consumers show a preferenceStep 2: Find the critical value df = 4 and Ξ± = 0.05, hence, the critical value from the chi- square distribution table is 9.488
- 12. SolutionStep 3: Compute X2 (πβπΈ)2 π2 = = 18.0 πΈ
- 13. SolutionStep 4: Make the decisionThe decision if to reject the null hypothesis, since 18.0 > 9.488
- 14. SolutionStep 5: Summarize the results There is enough evidence to reject the claim that consumersshow no preference for the flavors.
- 15. A good fit When the observed values and expected values are close together, the chi-square test value will be small. Then the decision will be not to reject the null hypothesisβ hence, there is a βgood fit.β
- 16. Not a good fit When the observed values and the expected values are far apart, the chi-square test value will be large. Then, the null hypothesis will be rejectedβhence, there is βnot a good fit.β
- 17. Chi-Square Goodness-of-FitProcedure SummaryStep 1: State the hypotheses and define the claim.Step 2: Find the critical value. (test is always right tailed)Step 3: Compute the test value.Step 4: Make the decision.Step 5: Summarize the results.
- 18. An example in R Professor Bumblefuss takes a random sample of studentsenrolled in Statistics 101 at ABC University. He finds the following:there are 25 freshman in the sample, 32 sophomores, 18 juniors,and 20 seniors. Test the null hypothesis that freshman,sophomores, juniors, and seniors are equally represented amongstudents signed up for Stat 101. Freshman Sophomore Juniors Seniors 25 32 18 20
- 19. R Implementation chisq.test(x, y = NULL, correct = TRUE, p = rep(1/length(x), length(x)), rescale.p = FALSE, simulate.p.value = FALSE, B = 2000) > chisq.test(c(25,32,18,20)) Chi-squared test for given probabilities data: c(25, 32, 18, 20) X-squared = 4.9158, df = 3, p-value = 0.1781
- 20. Another Example A new casino game involves rolling 3 dice. The winnings aredirectly proportional to the total number of sixes rolled. Suppose agambler plays the game 100 times, with the following observedcounts: Number of Number of Sixes Rolls 0 48 1 35 2 15 3 2
- 21. Another Example continued β¦ The casino becomes suspicious of the gambler and wishes todetermine whether the dice are fair. What do they conclude?
- 22. Another Example continued β¦ If a die is fair, we would expect the probability of rolling a 6 on anygiven toss to be 1/6. Assuming the 3 dice are independent (the roll ofone die should not affect the roll of the others), we might assume thatthe number of sixes in three rolls is distributed Binomial(3,1/6). To determine whether the gamblers dice are fair, we maycompare his results with the results expected under this distribution.The expected values for 0, 1, 2, and 3 sixes under the Binomial(3,1/6)distribution are the following:
- 23. Expected Binomial Distribution valuesP1 = P(roll 0 sixes) = P(X=0) = 0.58P2 = P(roll 1 six ) = P(X=1) = 0.345P3 = P(roll 2 sixes) = P(X=2) = 0.07P4 = P(roll 3 sixes) = P(X=3) = 0.005
- 24. Expected vs Observed Since the gambler plays 100 times, the expected counts are thefollowing: Number of Sixes Expected Count Observed Count 0 58 48 1 34.5 35 2 7 15 3 0.5 2
- 25. Visual Comparison The two plots shown below provide visual comparison of theexpected and observed values:
- 26. Chi-gram From these graphs, it isdifficult to distinguish differencesbetween the observed andexpected counts. A visualrepresentation of the differencesis the chi-gram, which plots theobserved-expected counts dividedby the square root of the expectedcounts, as shown here:
- 27. Chi-Square StatisticThe chi-square statistic is the sum of the squares of the plottedvalues,(48 β 58)2/58 + (35 β 34.5)2/34.5 + (15 β 7)2/7 + (2 β 0.5)2/0.51.72 + 0.007 + 9.14 + 4.5 = 15.367Given this statistic, are the observed values likely under theassumed model?
- 28. Making a decision In the gambling example above, the chi-square test statistic X2 wascalculated to be 15.367. Since k = 4 in this case (the possibilities are 0,1,2, and3 sixes) the test statistic is associated with the chi-square distribution with 3degrees of freedom. If we are interested in a significance level of 0.05, we may reject thenull hypothesis (that the dice is fair) if X2 β₯ 7.815, the value corresponding tothe 0.05 significance level for the X2 distribution. Since 15.367 is clearly greaterthan 7.815, we may reject the null hypothesis that the dice is fair at a 0.05significance level.
- 29. Making a decisionGiven this information, the casino can ask the gambler to take hisdice (and business) somewhere else.
- 30. R Implementation > expected <- c(58,34.5,7,0.5) > observed <- c(48,35,15,2) > chisq.test(observed, p = (expected/100)) Chi-squared test for given probabilities data: observed X-squared = 15.3742, df = 3, p-value = 0.001523
- 31. References http://www.stat.yale.edu/Courses/1997-98/101/chigf.htm http://www.scribd.com/doc/101960970/10/CHI-SQUARE- GOODNESS-OF-FIT-PROCEDURE-SUMMARY
- 32. Thank you!

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment