Quantitative MethodsPartly based on materials by Sherry O’Sullivan
Part 3
Chi - Squared Statistic
Recap on T-Statistic
It used the mean and standard error of apopulation sample
The data is on an “interval” or scale
Mean and standard error are the parameters
This approach is known as parametric
Another approach is non-parametric testing
Introduction to Chi-Squared
It does not use the mean and standard error of a populationsample
Each respondent can only choose one category (unlike scale int-Statistic)
The expected frequency must be greater than 5 in eachcategory for the test to succeed.
If any of the categories have less than 5 for the expectedfrequency, then you need to increase your sample size
Or merge categories
Example using Chi-Squared
“Is there a preference amongst the UWstudent population for a particular webbrowser? “ (Dr C Price’s Data)
They could only indicate one choice
These are the observed frequencies responsesfrom the sample
This is called a ‘contingency table’
Firefox
IExplorer
Safari
Chrome
Opera
Observedfrequencies
30
6
4
8
2
Was it just chance?
How confident am I?
Was the sample representative of all UWstudents?
Was the variation  in the measurements justchance?
Chi-Squared test for significance
Several ways to use the test
Simplest is Null Hypothesis
H0The students show “no preference” for aparticular browser
Chi-Squared:   “Goodness of fit”(No preference)
H0: The students show “no preference”for a particular browser
This leads to Hypothetical or Expecteddistribution of frequency
We would expect an equal number ofrespondents per category
We had 50 respondents and 5 categories
Firefox
IExplorer
Safari
Chrome
Opera
Expectedfrequencies
10
10
10
10
10
Expected frequency table
Stage1: Formulation of Hypothesis
H0:  There is no preference in the underlyingpopulation for the factor suggested.
H1:  There is a preference in the underlyingpopulation for the factors suggested.
The basis of the chi-squared test is tocompare the observed frequencies againstthe expected frequencies
Stage 2: Expected Distribution
As our “null- hypothesis” is no preference,we need to work out the expectedfrequency:
You would expect each category to have thesame amount of respondents
Show this in “Expected frequency” table
Each expected frequency must be more than5 to be valid
Firefox
IExplorer
Safari
Chrome
Opera
Expectedfrequencies
10
10
10
10
10
Stage 3a: Level of confidence
Choose the level of confidence (often 0.05;sometimes 0.01)
0.05 means that there is 5% chance thatconclusion is chance
95% chance that our conclusions are accurate
Stage 3b: Degree of freedomStage 3b: Degree of freedom
We need to find the degree of freedom
This is calculated with the number ofcategories
We had 5 categories, df = 5-1 (4)
Stage 3b: Critical value of Chi-Squared
In order to compare our calculated chi-square value with the “critical value” in thechi-squared table we need:
Level of confidence (0.05)
Degree of freedom (4)
Our critical value from the table = 9.49
Chi-Squared Table fromhttp://ourwayit.com/CA517/LearningActivities.htm
ChiSquare3Interpret.jpg
Stage 4: Calculate statistics
We find the differences between the observedand the expected values for each category
We square each difference, and divide theanswer by its expected frequency
We add all of them up
Firefox
IExplorer
Safari
Chrome
Opera
Observed
30
6
4
8
2
Expected
10
10
10
10
10
= 52
Stage 5: Decision
Can we reject the H0 that students show nopreference for a particular browser?
Our value of 52 is way beyond 9.49. We are (at least)95% confident the value did not occur by chance
And probably much more confident than that
So yes we can safely reject the null hypothesis
Which browser do they prefer?
Firefox as it is way above expected frequency of 10
Alternative Method
Outline: Calculate chi-squared, and use thetable to find the confidence
In this case, calculated Χ2 = 52
Go to the appropriate row of the table, andlook across for the highest value that isLOWER than the measured value
The top of that column gives our confidencethat the effect is real
Chi-Squared Table fromhttp://ourwayit.com/CA517/LearningActivities.htm
ChiSquare3Interpret.jpg
The probability of this result happening by chance is lessthan 0.001
We can be at least 99.9% confident of our result
Chi-Squared: “No Difference from aComparison Population”.
 RQ: Are drivers of high performance carsmore likely to be involved in accidents?
Sample n = 50 and Market Research data ofproportion of people driving these categories
HighPerformance
Compact
Midsize
Fullsize
F = observedaccidentfrequency
20
14
9
9
Ownership (%)
10%
40%
30%
20%
Contingency Table
Null hypothesis H0: type of car has no effect onaccident frequency
Once the expected frequencies (under the nullhypothesis) have been calculated, the analysis is thesame as the  ‘no preference’ calculation
HighPerformance
Compact
Midsize
Fullsize
F = observed accidentfrequency
20
14
9
9
Ownership (%)
10%
40%
30%
20%
F = expected accidentfrequency
5 (10% of 50)
20
15
10
Chi-Squared test for “Independence”.
 What makes computer games fun?
Review found the following
Factors (Mastery, Challenge and Fantasy)
Is there a different opinion depending ongender?
Research sample of 50 males and 50 females
Mastery
Challenge
Fantasy
Male
10
32
8
Female
24
8
18
Observed frequency table
What is the research question?
1.A single sample with individualsmeasured on 2 variables
RQ: ”Is there a relationship between fun factorand gender?”
HO : “There is no such relationship”
2.Two separate samples representing 2populations (male and female)
RQ: ““Do male and female players have differentpreferences for fun factors?”
 HO : “Male and female players do not havedifferent preferences”
Chi-Squared analysis for“Independence”.
Establish the null hypothesis (previous slide)
Determine the critical value of chi-squareddependent on the confidence limit (0.05) andthe degrees of freedom.
df = (Rows – 1)*(Columns – 1) = 1 * 2 = 2 (R=2, C=3)
Look up in chi-squared table
Critical chi-squared value = 5.99
Mastery
Challenge
Fantasy
Male
10
32
8
Female
24
8
18
Chi-Squared Table fromhttp://ourwayit.com/CA517/LearningActivities.htm
ChiSquare3Interpret.jpg
Chi-Squared analysis for“Independence”.
Calculate the expected frequencies
Add each column and divide by types (in this case 2)
Easier if you have equal number for each gender (ifnot come and see me)
Mastery
Challenge
Fantasy
Respondents
Male (FObs)
10
32
8
50
Female (FObs)
24
8
18
50
Cat total
34
40
26
Male (FExp)
17
20
13
Female (FExp)
17
20
13
Chi-Squared analysis for“Independence”.
Calculate the statistics using the chi-squaredformula
Ensure you include both male and female data
Mastery
Challenge
Fantasy
Male (FObs)
10
32
8
Female (FObs)
24
8
18
Male (FExp)
17
20
13
Female (FExp)
17
20
13
Stage 5: Decision
Can we reject the null hypothesis?
Our value of 24.01 is way beyond 5.99. We are 95%confident the value did not occur by chance
Conclusion: We are 95% confident that there is arelationship between gender and fun factor
But else can we get from this?
Significant fun factor for males = Challenge
Significant fun factor for females = Mastery and Fantasy
Mastery
Challenge
Fantasy
Male (FObs)
10
32
8
Female (FObs)
24
8
18
Male (FExp)
17
20
13
Female (FExp)
17
20
13
Alternative Method:
Outline: Calculate chi-squared, and use thetable to find the confidence
In this case, calculated Χ2 = 24.01
Go to the appropriate row of the table, andlook across for the highest value that isLOWER than the measured value
The top of that column gives our confidencethat the effect is real
Chi-Squared Table fromhttp://ourwayit.com/CA517/LearningActivities.htm
ChiSquare3Interpret.jpg
The probability of this result happening by chance is lessthan 0.001
We can be at least 99.9% confident of our result
Computers
A computer can be used to calculate theexpected values – but you have to tell it how
Use formulae in Excel
Then the computer will calculate the p valuefor you
p = probability that the observed difference is dueto chance
There is a nice command in Excel that will do this
End