SlideShare a Scribd company logo
Chi-Square
Goodness-of-Fit Test
LOZANO, ALDRIN T.
Introduction
     The chi-square distribution can be used for
tests concerning frequency distributions, such as:

     “If a sample of buyers is given a choice of
automobile colors, will each color be selected with
the same frequency?”
Assumptions

- The data are obtained from a random sample

- The expected frequency for each category must
  be 5 or more
Test for Goodness-of-Fit
     The chi-square statistic can be used to see
whether a frequency distribution fits a specific
pattern.

      This is referred to as the chi-squared goodness-
of-fit test.
Observed Frequencies vs Expected
Frequencies
     Suppose a market analyst wished to see
whether consumers have any preference among five
flavors of a new fruit soda. A sample of 100 people
provided these data:

      Cherry   Strawberry   Orange   Lime   Grape
       32         28         16      14      10
Observed Frequencies vs Expected
Frequencies
     Since the frequencies for each flavor were
obtained from a sample, these actual frequencies
are called the observed frequencies.

     The frequencies obtained by calculation (as if
there were no preference) are called the expected
frequencies.
Observed Frequencies vs Expected
Frequencies


    Frequency   Cherry   Strawberry   Orange   Lime   Grape
    Observed     32         28         16      14      10
    Expected     20         20         20      20      20
Goodness-of-Fit Test
      The formula for the chi-square goodness-of-fit
test is:
                          (𝑂 − 𝐸)2
                   𝑋2 =
                              𝐸
Where:
   O – observed or obtained frequency
   E – expected or theoretical frquency
Goodness-of-Fit Test
    The degrees of freedom (df) is:

                𝑑𝑓 = (𝐶 − 1)(𝑅 − 1)

Where:
   C – number of columns
   R – number of rows
Example
     Is there enough evidence to reject the claim
that there is no preference in the selection of fruit
soda 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
Solution
Step 1: State the hypotheses and define the claim
     Ho: Consumers show no preference for flavors (claim)
     Ha: Consumers show a preference

Step 2: Find the critical value
     df = 4 and α = 0.05, hence, the critical value from the chi-
     square distribution table is 9.488
Solution
Step 3: Compute X2

                       (𝑂−𝐸)2
                𝑋2 =            = 18.0
                          𝐸
Solution
Step 4: Make the decision
The decision if to reject the null hypothesis, since 18.0 > 9.488
Solution
Step 5: Summarize the results
     There is enough evidence to reject the claim that consumers
show no preference for the flavors.
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.”
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.”
Chi-Square Goodness-of-Fit
Procedure Summary
Step 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.
An example in R
       Professor Bumblefuss takes a random sample of students
enrolled 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 among
students signed up for Stat 101.

            Freshman    Sophomore    Juniors     Seniors
               25          32          18          20
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
Another Example
       A new casino game involves rolling 3 dice. The winnings are
directly proportional to the total number of sixes rolled. Suppose a
gambler plays the game 100 times, with the following observed
counts:
                       Number of   Number of
                         Sixes       Rolls
                          0           48
                          1           35
                          2           15
                          3           2
Another Example continued …
      The casino becomes suspicious of the gambler and wishes to
determine whether the dice are fair. What do they conclude?
Another Example continued …
       If a die is fair, we would expect the probability of rolling a 6 on any
given toss to be 1/6. Assuming the 3 dice are independent (the roll of
one die should not affect the roll of the others), we might assume that
the number of sixes in three rolls is distributed Binomial(3,1/6).

       To determine whether the gambler's dice are fair, we may
compare 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:
Expected Binomial Distribution values
P1 = P(roll   0 sixes)   = P(X=0) = 0.58
P2 = P(roll   1 six )    = P(X=1) = 0.345
P3 = P(roll   2 sixes)   = P(X=2) = 0.07
P4 = P(roll   3 sixes)   = P(X=3) = 0.005
Expected vs Observed
       Since the gambler plays 100 times, the expected counts are the
following:

            Number of Sixes   Expected Count   Observed Count
                  0                58               48
                  1                34.5             35
                  2                 7               15
                  3                0.5               2
Visual Comparison
      The two plots shown below provide visual comparison of the
expected and observed values:
Chi-gram
       From these graphs, it is
difficult to distinguish differences
between the observed and
expected counts. A visual
representation of the differences
is the chi-gram, which plots the
observed-expected counts divided
by the square root of the expected
counts, as shown here:
Chi-Square Statistic
The chi-square statistic is the sum of the squares of the plotted
values,

(48 – 58)2/58 + (35 – 34.5)2/34.5 + (15 – 7)2/7 + (2 – 0.5)2/0.5
1.72 + 0.007 + 9.14 + 4.5 = 15.367

Given this statistic, are the observed values likely under the
assumed model?
Making a decision
        In the gambling example above, the chi-square test statistic X2 was
calculated to be 15.367. Since k = 4 in this case (the possibilities are 0,1,2, and
3 sixes) the test statistic is associated with the chi-square distribution with 3
degrees of freedom.

         If we are interested in a significance level of 0.05, we may reject the
null hypothesis (that the dice is fair) if X2 ≥ 7.815, the value corresponding to
the 0.05 significance level for the X2 distribution. Since 15.367 is clearly greater
than 7.815, we may reject the null hypothesis that the dice is fair at a 0.05
significance level.
Making a decision
Given this information, the casino can ask the gambler to take his
dice (and business) somewhere else.
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
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
Thank you!

More Related Content

What's hot

Chi – square test
Chi – square testChi – square test
Chi – square test
Dr.M.Prasad Naidu
 
NULL AND ALTERNATIVE HYPOTHESIS.pptx
NULL AND ALTERNATIVE HYPOTHESIS.pptxNULL AND ALTERNATIVE HYPOTHESIS.pptx
NULL AND ALTERNATIVE HYPOTHESIS.pptx
04ShainaSachdeva
 
Chi square test
Chi square testChi square test
Chi square test
Nayna Azad
 
F test and ANOVA
F test and ANOVAF test and ANOVA
F test and ANOVA
MEENURANJI
 
PROCEDURE FOR TESTING HYPOTHESIS
PROCEDURE FOR   TESTING HYPOTHESIS PROCEDURE FOR   TESTING HYPOTHESIS
PROCEDURE FOR TESTING HYPOTHESIS
Sundar B N
 
Anova lecture
Anova lectureAnova lecture
Anova lecture
doublem44
 
Student's T-Test
Student's T-TestStudent's T-Test
Analysis of variance
Analysis of varianceAnalysis of variance
Analysis of variance
Dr NEETHU ASOKAN
 
Regression Analysis
Regression AnalysisRegression Analysis
Regression Analysis
Birinder Singh Gulati
 
Regression ppt
Regression pptRegression ppt
Regression ppt
Shraddha Tiwari
 
Regression
Regression Regression
Regression
Ali Raza
 
Chi-square distribution
Chi-square distribution Chi-square distribution
Chi-square distribution
Habibullah Bahar University College
 
Two sample t-test
Two sample t-testTwo sample t-test
Two sample t-test
Stephen Lange
 
Statistical tests of significance and Student`s T-Test
Statistical tests of significance and Student`s T-TestStatistical tests of significance and Student`s T-Test
Statistical tests of significance and Student`s T-Test
VasundhraKakkar
 
Statistical inference: Estimation
Statistical inference: EstimationStatistical inference: Estimation
Statistical inference: Estimation
Parag Shah
 
INFERENTIAL STATISTICS: AN INTRODUCTION
INFERENTIAL STATISTICS: AN INTRODUCTIONINFERENTIAL STATISTICS: AN INTRODUCTION
INFERENTIAL STATISTICS: AN INTRODUCTION
John Labrador
 
Student t test
Student t testStudent t test
Student t test
Dr Shovan Padhy, MD
 
Hypothesis testing , T test , chi square test, z test
Hypothesis testing , T test , chi square test, z test Hypothesis testing , T test , chi square test, z test
Hypothesis testing , T test , chi square test, z test
Irfan Ullah
 

What's hot (20)

Chi – square test
Chi – square testChi – square test
Chi – square test
 
NULL AND ALTERNATIVE HYPOTHESIS.pptx
NULL AND ALTERNATIVE HYPOTHESIS.pptxNULL AND ALTERNATIVE HYPOTHESIS.pptx
NULL AND ALTERNATIVE HYPOTHESIS.pptx
 
Chi square test
Chi square testChi square test
Chi square test
 
F test and ANOVA
F test and ANOVAF test and ANOVA
F test and ANOVA
 
Non-Parametric Tests
Non-Parametric TestsNon-Parametric Tests
Non-Parametric Tests
 
PROCEDURE FOR TESTING HYPOTHESIS
PROCEDURE FOR   TESTING HYPOTHESIS PROCEDURE FOR   TESTING HYPOTHESIS
PROCEDURE FOR TESTING HYPOTHESIS
 
Anova lecture
Anova lectureAnova lecture
Anova lecture
 
Student's T-Test
Student's T-TestStudent's T-Test
Student's T-Test
 
F test
F testF test
F test
 
Analysis of variance
Analysis of varianceAnalysis of variance
Analysis of variance
 
Regression Analysis
Regression AnalysisRegression Analysis
Regression Analysis
 
Regression ppt
Regression pptRegression ppt
Regression ppt
 
Regression
Regression Regression
Regression
 
Chi-square distribution
Chi-square distribution Chi-square distribution
Chi-square distribution
 
Two sample t-test
Two sample t-testTwo sample t-test
Two sample t-test
 
Statistical tests of significance and Student`s T-Test
Statistical tests of significance and Student`s T-TestStatistical tests of significance and Student`s T-Test
Statistical tests of significance and Student`s T-Test
 
Statistical inference: Estimation
Statistical inference: EstimationStatistical inference: Estimation
Statistical inference: Estimation
 
INFERENTIAL STATISTICS: AN INTRODUCTION
INFERENTIAL STATISTICS: AN INTRODUCTIONINFERENTIAL STATISTICS: AN INTRODUCTION
INFERENTIAL STATISTICS: AN INTRODUCTION
 
Student t test
Student t testStudent t test
Student t test
 
Hypothesis testing , T test , chi square test, z test
Hypothesis testing , T test , chi square test, z test Hypothesis testing , T test , chi square test, z test
Hypothesis testing , T test , chi square test, z test
 

Viewers also liked

Null hypothesis for a chi-square goodness of fit test
Null hypothesis for a chi-square goodness of fit testNull hypothesis for a chi-square goodness of fit test
Null hypothesis for a chi-square goodness of fit test
Ken Plummer
 
Chi square goodness of fit
Chi square goodness of fitChi square goodness of fit
Chi square goodness of fit
Ken Plummer
 
The Chi-Square Statistic: Tests for Goodness of Fit and Independence
The Chi-Square Statistic: Tests for Goodness of Fit and IndependenceThe Chi-Square Statistic: Tests for Goodness of Fit and Independence
The Chi-Square Statistic: Tests for Goodness of Fit and Independence
jasondroesch
 
Chi Square Worked Example
Chi Square Worked ExampleChi Square Worked Example
Chi Square Worked Example
John Barlow
 
131 141 Chi Square Goodness Of Fit
131 141 Chi Square Goodness Of Fit131 141 Chi Square Goodness Of Fit
131 141 Chi Square Goodness Of Fit
CardinaleWay Mazda
 
Reporting Chi Square Test of Independence in APA
Reporting Chi Square Test of Independence in APAReporting Chi Square Test of Independence in APA
Reporting Chi Square Test of Independence in APA
Ken Plummer
 
Chi square goodness of fit test
Chi square goodness of fit testChi square goodness of fit test
Chi square goodness of fit test
amylute
 
Aplicação do método de rietveld para análise
Aplicação do método de rietveld para análiseAplicação do método de rietveld para análise
Aplicação do método de rietveld para análiseJosé da Silva Rabelo Neto
 
Shahid Lecture-13-MKAG1273
Shahid Lecture-13-MKAG1273Shahid Lecture-13-MKAG1273
Shahid Lecture-13-MKAG1273
nchakori
 
Data-Driven Color Palettes for Categorical Maps
Data-Driven Color Palettes for Categorical MapsData-Driven Color Palettes for Categorical Maps
Data-Driven Color Palettes for Categorical Maps
nacis_slides
 
Quantitative Methods for Lawyers - Class #12 - Chi Square Distribution and Ch...
Quantitative Methods for Lawyers - Class #12 - Chi Square Distribution and Ch...Quantitative Methods for Lawyers - Class #12 - Chi Square Distribution and Ch...
Quantitative Methods for Lawyers - Class #12 - Chi Square Distribution and Ch...
Daniel Katz
 
20121210 統計論文勉強会
20121210 統計論文勉強会20121210 統計論文勉強会
20121210 統計論文勉強会
Med_KU
 
Pulmonary Capillary Wedge Pressure 4.22.08
Pulmonary Capillary Wedge Pressure 4.22.08Pulmonary Capillary Wedge Pressure 4.22.08
Pulmonary Capillary Wedge Pressure 4.22.08
Leonard Davis Institute of Health Economics
 

Viewers also liked (20)

B.9 chi square
B.9 chi squareB.9 chi square
B.9 chi square
 
Chi square test
Chi square testChi square test
Chi square test
 
Goodness of fit (ppt)
Goodness of fit (ppt)Goodness of fit (ppt)
Goodness of fit (ppt)
 
Null hypothesis for a chi-square goodness of fit test
Null hypothesis for a chi-square goodness of fit testNull hypothesis for a chi-square goodness of fit test
Null hypothesis for a chi-square goodness of fit test
 
Chi square goodness of fit
Chi square goodness of fitChi square goodness of fit
Chi square goodness of fit
 
The Chi-Square Statistic: Tests for Goodness of Fit and Independence
The Chi-Square Statistic: Tests for Goodness of Fit and IndependenceThe Chi-Square Statistic: Tests for Goodness of Fit and Independence
The Chi-Square Statistic: Tests for Goodness of Fit and Independence
 
Chi Square Worked Example
Chi Square Worked ExampleChi Square Worked Example
Chi Square Worked Example
 
131 141 Chi Square Goodness Of Fit
131 141 Chi Square Goodness Of Fit131 141 Chi Square Goodness Of Fit
131 141 Chi Square Goodness Of Fit
 
T test
T testT test
T test
 
Reporting Chi Square Test of Independence in APA
Reporting Chi Square Test of Independence in APAReporting Chi Square Test of Independence in APA
Reporting Chi Square Test of Independence in APA
 
Chi square goodness of fit test
Chi square goodness of fit testChi square goodness of fit test
Chi square goodness of fit test
 
Chi square
Chi squareChi square
Chi square
 
Aplicação do método de rietveld para análise
Aplicação do método de rietveld para análiseAplicação do método de rietveld para análise
Aplicação do método de rietveld para análise
 
Shahid Lecture-13-MKAG1273
Shahid Lecture-13-MKAG1273Shahid Lecture-13-MKAG1273
Shahid Lecture-13-MKAG1273
 
Data-Driven Color Palettes for Categorical Maps
Data-Driven Color Palettes for Categorical MapsData-Driven Color Palettes for Categorical Maps
Data-Driven Color Palettes for Categorical Maps
 
Quantitative Methods for Lawyers - Class #12 - Chi Square Distribution and Ch...
Quantitative Methods for Lawyers - Class #12 - Chi Square Distribution and Ch...Quantitative Methods for Lawyers - Class #12 - Chi Square Distribution and Ch...
Quantitative Methods for Lawyers - Class #12 - Chi Square Distribution and Ch...
 
20121210 統計論文勉強会
20121210 統計論文勉強会20121210 統計論文勉強会
20121210 統計論文勉強会
 
Pulmonary Capillary Wedge Pressure 4.22.08
Pulmonary Capillary Wedge Pressure 4.22.08Pulmonary Capillary Wedge Pressure 4.22.08
Pulmonary Capillary Wedge Pressure 4.22.08
 
Ha n d b o o k o f
Ha n d b o o k o fHa n d b o o k o f
Ha n d b o o k o f
 
Chapter12
Chapter12Chapter12
Chapter12
 

Similar to Stat 130 chi-square goodnes-of-fit test

Chisquare Test
Chisquare Test Chisquare Test
Chisquare Test
Manas Mondal
 
Chi Square Goodness of fit test 2021 (2).pptx
Chi Square Goodness of fit test 2021 (2).pptxChi Square Goodness of fit test 2021 (2).pptx
Chi Square Goodness of fit test 2021 (2).pptx
lushomo3
 
Statistical tests
Statistical testsStatistical tests
Statistical tests
martyynyyte
 
Part 1 of 16 - Question 1 of 231.0 PointsThe data pres.docx
Part 1 of 16 - Question 1 of 231.0 PointsThe data pres.docxPart 1 of 16 - Question 1 of 231.0 PointsThe data pres.docx
Part 1 of 16 - Question 1 of 231.0 PointsThe data pres.docx
herbertwilson5999
 
Week8 Live Lecture for Final Exam
Week8 Live Lecture for Final ExamWeek8 Live Lecture for Final Exam
Week8 Live Lecture for Final Exam
Brent Heard
 
Part 1 of 16 -Question 1 of 231.0 PointsThe data presented i.docx
Part 1 of 16 -Question 1 of 231.0 PointsThe data presented i.docxPart 1 of 16 -Question 1 of 231.0 PointsThe data presented i.docx
Part 1 of 16 -Question 1 of 231.0 PointsThe data presented i.docx
odiliagilby
 
Binomial distribution good
Binomial distribution goodBinomial distribution good
Binomial distribution goodZahida Pervaiz
 
Binomial Probability Distributions
Binomial Probability DistributionsBinomial Probability Distributions
Binomial Probability Distributions
Long Beach City College
 
1. A law firm wants to determine the trend in its annual billings .docx
1. A law firm wants to determine the trend in its annual billings .docx1. A law firm wants to determine the trend in its annual billings .docx
1. A law firm wants to determine the trend in its annual billings .docx
monicafrancis71118
 
Final examexamplesapr2013
Final examexamplesapr2013Final examexamplesapr2013
Final examexamplesapr2013
Brent Heard
 
Testing a claim about a standard deviation or variance
Testing a claim about a standard deviation or variance  Testing a claim about a standard deviation or variance
Testing a claim about a standard deviation or variance
Long Beach City College
 
Week8 livelecture2010
Week8 livelecture2010Week8 livelecture2010
Week8 livelecture2010
Brent Heard
 
Week8finalexamlivelecture2011 mt
Week8finalexamlivelecture2011 mtWeek8finalexamlivelecture2011 mt
Week8finalexamlivelecture2011 mt
Brent Heard
 
statistics assignment help
statistics assignment helpstatistics assignment help
statistics assignment help
Statistics Homework Helper
 
QNT 561 Week 4 Weekly Learning Assessments
QNT 561 Week 4 Weekly Learning Assessments  QNT 561 Week 4 Weekly Learning Assessments
QNT 561 Week 4 Weekly Learning Assessments
student ehelp
 
Probability unit2.pptx
Probability unit2.pptxProbability unit2.pptx
Probability unit2.pptx
SNIGDHABADIDA2127755
 
Day 3 SPSS
Day 3 SPSSDay 3 SPSS
Day 3 SPSS
abir hossain
 
Inferences about Two Proportions
 Inferences about Two Proportions Inferences about Two Proportions
Inferences about Two Proportions
Long Beach City College
 
Chapter 5.pptx
Chapter 5.pptxChapter 5.pptx
Chapter 5.pptx
AamirAdeeb2
 

Similar to Stat 130 chi-square goodnes-of-fit test (20)

Chisquare Test
Chisquare Test Chisquare Test
Chisquare Test
 
Chi Square Goodness of fit test 2021 (2).pptx
Chi Square Goodness of fit test 2021 (2).pptxChi Square Goodness of fit test 2021 (2).pptx
Chi Square Goodness of fit test 2021 (2).pptx
 
Statistical tests
Statistical testsStatistical tests
Statistical tests
 
Part 1 of 16 - Question 1 of 231.0 PointsThe data pres.docx
Part 1 of 16 - Question 1 of 231.0 PointsThe data pres.docxPart 1 of 16 - Question 1 of 231.0 PointsThe data pres.docx
Part 1 of 16 - Question 1 of 231.0 PointsThe data pres.docx
 
Week8 Live Lecture for Final Exam
Week8 Live Lecture for Final ExamWeek8 Live Lecture for Final Exam
Week8 Live Lecture for Final Exam
 
Part 1 of 16 -Question 1 of 231.0 PointsThe data presented i.docx
Part 1 of 16 -Question 1 of 231.0 PointsThe data presented i.docxPart 1 of 16 -Question 1 of 231.0 PointsThe data presented i.docx
Part 1 of 16 -Question 1 of 231.0 PointsThe data presented i.docx
 
Binomial distribution good
Binomial distribution goodBinomial distribution good
Binomial distribution good
 
Binomial Probability Distributions
Binomial Probability DistributionsBinomial Probability Distributions
Binomial Probability Distributions
 
1. A law firm wants to determine the trend in its annual billings .docx
1. A law firm wants to determine the trend in its annual billings .docx1. A law firm wants to determine the trend in its annual billings .docx
1. A law firm wants to determine the trend in its annual billings .docx
 
Final examexamplesapr2013
Final examexamplesapr2013Final examexamplesapr2013
Final examexamplesapr2013
 
Testing a claim about a standard deviation or variance
Testing a claim about a standard deviation or variance  Testing a claim about a standard deviation or variance
Testing a claim about a standard deviation or variance
 
Week8 livelecture2010
Week8 livelecture2010Week8 livelecture2010
Week8 livelecture2010
 
Week8finalexamlivelecture2011 mt
Week8finalexamlivelecture2011 mtWeek8finalexamlivelecture2011 mt
Week8finalexamlivelecture2011 mt
 
statistics assignment help
statistics assignment helpstatistics assignment help
statistics assignment help
 
Chi square test
Chi square test Chi square test
Chi square test
 
QNT 561 Week 4 Weekly Learning Assessments
QNT 561 Week 4 Weekly Learning Assessments  QNT 561 Week 4 Weekly Learning Assessments
QNT 561 Week 4 Weekly Learning Assessments
 
Probability unit2.pptx
Probability unit2.pptxProbability unit2.pptx
Probability unit2.pptx
 
Day 3 SPSS
Day 3 SPSSDay 3 SPSS
Day 3 SPSS
 
Inferences about Two Proportions
 Inferences about Two Proportions Inferences about Two Proportions
Inferences about Two Proportions
 
Chapter 5.pptx
Chapter 5.pptxChapter 5.pptx
Chapter 5.pptx
 

Recently uploaded

FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 

Stat 130 chi-square goodnes-of-fit test

  • 2. Introduction The chi-square distribution can be used for tests concerning frequency distributions, such as: “If a sample of buyers is given a choice of automobile colors, will each color be selected with the 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 see whether a frequency distribution fits a specific pattern. This is referred to as the chi-squared goodness- of-fit test.
  • 5. Observed Frequencies vs Expected Frequencies Suppose a market analyst wished to see whether consumers have any preference among five flavors of a new fruit soda. A sample of 100 people provided these data: Cherry Strawberry Orange Lime Grape 32 28 16 14 10
  • 6. Observed Frequencies vs Expected Frequencies Since the frequencies for each flavor were obtained from a sample, these actual frequencies are called the observed frequencies. The frequencies obtained by calculation (as if there were no preference) are called the expected frequencies.
  • 7. Observed Frequencies vs Expected Frequencies 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-fit test 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 claim that there is no preference in the selection of fruit soda 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. Solution Step 1: State the hypotheses and define the claim Ho: Consumers show no preference for flavors (claim) Ha: Consumers show a preference Step 2: Find the critical value df = 4 and α = 0.05, hence, the critical value from the chi- square distribution table is 9.488
  • 12. Solution Step 3: Compute X2 (𝑂−𝐸)2 𝑋2 = = 18.0 𝐸
  • 13. Solution Step 4: Make the decision The decision if to reject the null hypothesis, since 18.0 > 9.488
  • 14. Solution Step 5: Summarize the results There is enough evidence to reject the claim that consumers show 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-Fit Procedure Summary Step 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 students enrolled 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 among students 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 are directly proportional to the total number of sixes rolled. Suppose a gambler plays the game 100 times, with the following observed counts: 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 to determine 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 any given toss to be 1/6. Assuming the 3 dice are independent (the roll of one die should not affect the roll of the others), we might assume that the number of sixes in three rolls is distributed Binomial(3,1/6). To determine whether the gambler's dice are fair, we may compare 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 values P1 = P(roll 0 sixes) = P(X=0) = 0.58 P2 = P(roll 1 six ) = P(X=1) = 0.345 P3 = P(roll 2 sixes) = P(X=2) = 0.07 P4 = P(roll 3 sixes) = P(X=3) = 0.005
  • 24. Expected vs Observed Since the gambler plays 100 times, the expected counts are the following: 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 the expected and observed values:
  • 26. Chi-gram From these graphs, it is difficult to distinguish differences between the observed and expected counts. A visual representation of the differences is the chi-gram, which plots the observed-expected counts divided by the square root of the expected counts, as shown here:
  • 27. Chi-Square Statistic The chi-square statistic is the sum of the squares of the plotted values, (48 – 58)2/58 + (35 – 34.5)2/34.5 + (15 – 7)2/7 + (2 – 0.5)2/0.5 1.72 + 0.007 + 9.14 + 4.5 = 15.367 Given this statistic, are the observed values likely under the assumed model?
  • 28. Making a decision In the gambling example above, the chi-square test statistic X2 was calculated to be 15.367. Since k = 4 in this case (the possibilities are 0,1,2, and 3 sixes) the test statistic is associated with the chi-square distribution with 3 degrees of freedom. If we are interested in a significance level of 0.05, we may reject the null hypothesis (that the dice is fair) if X2 ≥ 7.815, the value corresponding to the 0.05 significance level for the X2 distribution. Since 15.367 is clearly greater than 7.815, we may reject the null hypothesis that the dice is fair at a 0.05 significance level.
  • 29. Making a decision Given this information, the casino can ask the gambler to take his dice (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