Your SlideShare is downloading.
×

×

Saving this for later?
Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.

Text the download link to your phone

Standard text messaging rates apply

Like this presentation? Why not share!

- Chi square test by Patel Parth 28959 views
- Chi square test by Syam C 4515 views
- The Chi-Squared Test by Stephen Taylor 39842 views
- The Chi Square Test by Max Chipulu 23187 views
- Chi-square, Yates, Fisher & McNemar by Azmi Mohd Tamil 10514 views
- Chi – square test by Narayana Medical ... 3619 views
- Chi Square Worked Example by John Barlow 164776 views
- Chi square analysis by Shameer P Hamsa 38796 views
- Chi square test by Anandapadmanabhan... 1952 views
- Chi sequare by Abuzar Tabassum 1319 views
- Chi Squared by GeoBlogs 12532 views
- Goodness of fit (ppt) by Sharlaine Ruth 1225 views

2,417

Published on

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

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

No Downloads

Total Views

2,417

On Slideshare

0

From Embeds

0

Number of Embeds

0

Shares

0

Downloads

216

Comments

0

Likes

1

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!

Be the first to comment