Professional Documents
Culture Documents
1
Goals for this Lecture
2
Classical Statistical Assumptions…
Population
• Each respondent gives one
of k responses (or put in Random sample
one of k categories) of size n
4
One-Way Goodness-of-Fit Test
counts
• To do a statistical test, must assess how
“far away” the ei expected counts are from
the xi observed counts
6
Chi-squared Test
i =1 expected
k
( xi - n / k ) 2
=∑
i =1 n/k
7
Alternate Test Statistics
• χ 2
is the chi-squared distribution with
k −1
k-1 degrees of freedom
• Reject null if p-value < α, for some pre-
determined significance level α
9
p-value Calculation for
Chi-square Goodness-of-Fit Tests
Simple Example
– Expected Strongly
Agree Agree Neutral Disagree
Strongly
Disagree
– Pearson 5
( xi - 18.4) 2
test statistic: X =∑
2
= 1.26
i =1 18.4
Strongly Strongly
Agree Agree Neutral Disagree Disagree
– Expected Strongly
Agree Agree Neutral Disagree
Strongly
Disagree
– Pearson 5
( xi - ei ) 2
test statistic: X = ∑
2
= 5.42
i =1 ei
14
A Couple of Notes
15
Chi-square Test of Independence
Computer?
Yes No
Yes 119 188 307
Cable?
No 88 105 193
207 293 500
Some Notation for
Two-Way Contingency Tables
∑∑ x
i =1 j =1
ij =n
c
• Denote row sums: xi + = ∑ xij , i = 1,..., r
j =1
r
• Denote column sums: x+ j = ∑ xij , j = 1,..., c
i =1
17
The Hypotheses
• Test statistic:
2
r c ( xij - eij )
X = ∑∑
2
i =1 j =1 eij
• Under the null, the expected count is
calculated as
xi + x+ j
eij = npˆ ij = npˆ i + pˆ + j = n
n n
xi + × x+ j
=
n 19
Back to the Example
21
Conducting the Test in JMP
p-values
22
Complex Surveys:
What’s the Problem?
All expected
cells
25
Effects of Stratified Sampling Design
on Hypothesis Tests and CIs (1)
27
Effects of Clustered Sampling Design
on Hypothesis Tests and CIs
28
Corrections to Chi-square Tests
29
Think of Problem
in Terms of Cell Probabilities (1)
where ∑w
k∈S
k
⎛ observed ⎞ ⎛ pˆ ij ⎞
G = 2∑ observed × ln ⎜
2
⎟ = 2n∑ pˆ ij ln ⎜⎜ ⎟⎟
All ⎝ expected ⎠ All ⎝ pij ⎠
cells cells
31
Wald Tests (1)
32
Wald Tests (2)
34
Example:
Survey of Youth in Custody (2)
35
Example:
Survey of Youth in Custody (3)
T
• Let θ = ⎡⎣θ11 , θ12 ,...,θ ( r −1)( c −1) ⎤⎦
• Hypotheses are
H0 : θ = 0
H a : θ ≠ 0 for one or more cells
• Wald test statistic is X W2 = θˆ T V̂(θˆ ) −1 θˆ where V̂(θˆ )
is the estimated covariance matrix
• Problem is, need a large number of PSUs to
estimate covariance matrix
– E.g., 4x4 table results in 9x9 covariance matrix that
requires estimation of 45 variance/covariances
37
Bonferroni Tests (1)
• Specifically, reject H 0 : θ = 0 if
θˆij ( )
V̂ θˆij > tα / 2 m,κ
40
Example:
Survey of Youth in Custody (2)
i =1 j =1 pˆ i + pˆ + j
which gives an (incorrect) p-value of ~0
• Compare to a Bonferroni test…
41
Example:
Survey of Youth in Custody (3)
( )
s.e. θˆ12 = 0.0035
• Thus
θˆ11 θˆ12
= 1.8, = 3.4 and t0.05/ 2×2,ν =6 = 2.97
( )
s.e. θˆ11 ( )
s.e. θˆ12
Reject null (more appropriately) 42
Using SAS to Conduct the Tests
• See http://support.sas.com/onlinedoc/913/docMainpage.jsp
43
Using Stata to Conduct the Tests
45
What We Have Just Learned
46