Quantitative Methods for Lawyers  Class #12  Chi Square Distribution and Chi Square Test ...

Author
danielkatz 
Category
Law

view
904 
download
2
Embed Size (px)
Transcript of Quantitative Methods for Lawyers  Class #12  Chi Square Distribution and Chi Square Test ...
Quantitative Methods
for Lawyers
Chi Square ( ) Distribution
Class #12
χ 2
( ad  bc)2 (a + b + c +d)
( a + b) (c +d) (b +d) ( a + c)
Chi Square ( ) Test χ 2
@ computational
computationallegalstudies.com
professor daniel martin katz danielmartinkatz.com
lexpredict.com slideshare.net/DanielKatz
Generally  Two types of random variables numerical and categorical
“What was your college major ?” or “Do you own a bike?” are categorical because they yield data such as “Economics” or “no.”
Categorical versus Numerical Data
categorical variables yield data in categories numerical variables yield data in numerical form
Categorical variables
“How tall are you?” or “What is your G.P.A.?” are numerical. Numerical data can be either discrete or continuous.
Numerical variables
A chi square (χ 2) statistic is used to investigate whether distributions of categorical variables differ from one another
Chi Square ( ) Statistic χ 2
The Chi Square statistic compares the tallies or counts of categorical responses between two (or more) independent groups.
(note: Chi square tests can only be used on actual numbers and not on percentages, proportions, means, etc.)
There are several types of chi square tests depending on the way the data was collected and the hypothesis being tested.
Imagine the simplest case of a 2 x 2 contingency table
If we set the 2 x 2 table to the general notation shown below in Table 1, using the letters a, b, c, and d to denote the contents of the cells:
Variable 2 Data Type 1 Data Type 2 Totals
Category 1 a b a + b
Category 2 c d c + d
Total a + c b + d a+b+c+d =N
Chi Square ( ) Statistic χ 2
Variable 2 Data Type 1 Data Type 2 Totals
Category 1 a b a + b
Category 2 c d c + d
Total a + c b + d a+b+c+d =N
χ 2 = ( ad  bc)2 (a + b + c +d)( a + b) (c +d) (b +d) ( a + c)
Note: notice that the four components of the denominator are the four totals from the table columns and rows
Chi Square ( ) Statistic χ 2
Male Female Totals
Not Research Asst 319 323 642
Research Assistant 60 34 94
Total 379 357 736
In Our Prior Class We Discussed Hypothesis Testing and that is the approach we would like to use here
Chi Square is a technique to consider whether the observed gender disparity in RA positions is too large to be result of chance
Chi Square ( ) Statistic χ 2
Male Female Totals
Not Research Asst 319 323 642
Research Assistant 60 34 94
Total 379 357 736
Ho is the Null Hypothesis
H1 is the Alternative Hypothesis
In this Case, Please Describe Each of these in simple words
Chi Square ( ) Statistic χ 2
Male Female Totals
Not Research Asst 319 323 642
Research Assistant 60 34 94
Total 379 357 736
Ho: Gender Does Not Affect Probability of Being RA
Chi Square ( ) Statistic χ 2
Male Female Totals
Not Research Asst 319 323 642
Research Assistant 60 34 94
Total 379 357 736
We need to understand the Expected Value for this question as it sets our baseline expectations
Chi Square ( ) Statistic χ 2
Male Female Totals
Not Research Asst 319 323 642
Research Assistant 60 34 94
Total 379 357 736
Male Female Totals
Not Research Asst 330.6 311.4 642
Research Assistant 48.4 45.6 94
Total 379 357 736
Chi Square ( ) Statistic χ 2
We need to understand the Expected Value for this question as it sets our baseline expectations
Chi Square is all about comparing expected values to the observed/actual values
Male Female TotalsNot Research Asst 319 323 642Research Assistant 60 34 94Total 379 357 736
Male Female TotalsNot Research Asst 330.6 311.4 642Research Assistant 48.4 45.6 94Total 379 357 736
Chi Square ( ) Statistic χ 2
Male Female
Not Research Asst 0.4 0.4
Research Assistant 2.8 3
Here is the Chi Square Calculation for the Student Population :
= .4 + .4 + 2.8 + 3.0 = 6.6χ 2
Chi Square ( ) Statistic χ 2
What Does a χ 2 value of 6.6 Tell Us?
Need to Look at the P Value on Chi Square Table
Here the Degrees of Freedom are = 1 (more on D.F. later)
Thus , t here i s roughly a 1% probability that the disparity was generated by chance
Chi Square ( ) Statistic χ 2
Suppose you conducted a drug trial on a group and you hypothesize that the group receiving the drug would survive at a rate higher than those that did not receive the drug.
Ho: Group survival is independent of drug treatment
Ha: Group survival is associated with drug treatment
Chi Square ( ) Statistic χ 2
You conduct the study and collect the following data:
χ 2 = ( ad  bc)2 (a + b + c +d)( a + b) (c +d) (b +d) ( a + c)
Chi Square ( ) Statistic χ 2
Applying the formula above we get: Chi square = 105 [(36)(25)  (14)(30) ]2 / (50)(55)(39)(66) = 3.418
Chi Square ( ) Statistic χ 2
How Do We Determine How Many Degrees of Freedom? Before we can proceed we need to know how many degrees of freedom we have. When a comparison is made between one sample and another, a simple rule is that the degrees of freedom equal (number of columns minus one) x (number of rows minus one) not counting the totals for rows or columns. For our data this gives (21) x (21) = 1.
Chi Square ( ) Statistic χ 2
We now have our chi square statistic (x2 = 3.418), our predetermined alpha level of significance (0.05), and our degrees of freedom (df =1).
Entering the Chi square distribution table with 1 degree of freedom and reading along the row we find our value of x2 (3.418) lies between 2.706 and 3.841.
Chi Square ( ) Statistic χ 2
Male,
CitizenFemale, Citizen
Male, Foreign
Female, Foreign
TOTAL
Research Asst & Grant
12 9 7 9 37
Grant Only 32 62 22 44 160
Research Asst Only
33 11 8 5 57
No Grant & No Research Asst
199 112 66 105 482
TOTAL 276 194 103 163 736
Here We Have Additional Category  Foreign v. Citizen
Suppose You Learn that School Offers Student Grant and that Professor Consider this Before Hiring
Further Assume that Various Immigration Laws Make it more difficult for foreign students to get RA positions
Raw Data Expected Value
Chi Square Calculation
χ 2 = 41.2
χ 2 = 41.2
How Many Degrees of Freedom?
Rule of Thumb is Subtract 1 from # of Rows & Subtract 1 from # of Columns.
Then, Multiply the Result
(4 1 ) x ( 4  1) = 9
χ 2 = 41.2
How Many Degrees of Freedom?
Rule of Thumb is Subtract 1 from # of Rows & Subtract 1 from # of Columns.
Then, Multiply the Result
(4 1 ) x ( 4  1) = 9
41.2 > 27.88
χ 2 = 41.2
How Many Degrees of Freedom?
Rule of Thumb is Subtract 1 from # of Rows & Subtract 1 from # of Columns.
Then, Multiply the Result
(4 1 ) x ( 4  1) = 9
http://sites.stat.psu.edu/~mga/401/tables/Chisquaretable.pdf
Access the Chi Squared Table
http://www.quantpsy.org/chisq/chisq.htm
Calculating the ChiSquare Test
Daniel Martin Katz
@ computational
computationallegalstudies.com
lexpredict.com
danielmartinkatz.com
illinois tech  chicago kent college of law@