Download Note

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
Transcript
Chapter 26
1
The goodness-of-fit test
Having discussed how to make comparisons between
two proportions, we now consider comparisons of
multiple proportions.
A common problem of this type is concerned with
determining whether the members of a population are
distributed among more than two subcategories
according to a hypothesized distribution of percentages.
To gather evidence for this, we select a sample from the
population and determine how many members of the
sample fall into each of the subcategories, and test to
see whether the data provide a good fit to the
hypothesized distribution. This is why we call this a
goodness-of-fit test.
€
Chapter 26
2
As with our earlier hypothesis tests, there are
important independence assumptions and sample size
conditions that must be met in order for the test to be
reliably carried out…
• Counted Data Condition: the relevant data are
the observed cell counts for each of the
categories; each individual in the sample is counted
in exactly one of the categories
• Randomization Condition: the sample should be
a SRS
• Independence Assumption: the counts in each
cell are independent of each other
• Expected Cell Frequency Condition: the sample
is large enough so that each cell contains at least 5
individuals
• 10% Condition: the sample is not so large that it
is more than 10% of the size of the population
Suppose that there are k different categories and that
the hypothesized distribution of percentages is: p1 for
the first category, p 2 for the second category, etc. If we
find the observed cell counts from the sample, we want
to compare them against the expected cell
€ counts
determined from the null hypothesis
€
H 0 : categories fit the distribution p 1 , p 2 ,…, p k
Chapter 26
3
Of course, the alternative hypothesis is
H A : categories don' t fit the distribution p1 , p 2 ,…, p k
If the null hypothesis is true and our sample size is n,
then the expected count in the first category should
be Exp 1 = p1 n , the expected count in the second
category should be Exp 2 = p 2 n , and so on.
€
€
The test statistic we use is called a chi-square
2
statistic (denoted
χ
). It evaluates the discrepancy
€
between the observed counts Obs1 ,Obs 2 ,…,Obs k from
the data and the expected counts Exp 1 , Exp 2 ,…, Exp k
that depend
€ on the hypothesis:
€
2
(Obs
−
Exp)
2
χ = ∑€
Exp
all cells
The chi-square variable is a random variable that
follows a special chi-square probability distribution,
€ the t distribution, depends on the number of
which, like
degrees of freedom (n − 1).
[TI-83: STAT DISTR χ2-cdf(low, high, df) ]
€
€
€
Chapter 26
4
Goodness-of-fit test:
• State hypotheses:
Null hypothesis
H 0 : categories fit the distribution p 1 , p 2 ,…, p k
Alternative hypothesis
H A : categories don' t fit the distribution p1 , p 2 ,…, p k
(Note: only one alternative option)
• Choose the model:
A SRS of size n satisfying the 10% Condition is
selected and observed counts for each category are
tallied (so that each cell count is ≥ 5), so a chisquare model applies with test statistic
(Obs − Exp) 2
2
χ = ∑
and df = (n − 1)
Exp
all cells
• Mechanics:
€
2
Compute
the
expected
counts
and
χ
; upper-tailed
€
probability associated with HA: P = P( X 2 ≥ χ 2 )
• Conclusion:
€
Assess evidence against H0 in favor of Ha
€
depending on how small P is.
[TI-84: STAT TESTS χ2-GOFTest… ]
Chapter 26
5
Test for homogeneity
A common variant of the goodness-of-fit test looks to
compare the distribution of percentages of certain
categories across multiple populations to see whether
there is evidence to claim a difference in the
distributions of the categories among the populations.
Here, the null hypothesis is an assumption of
homogeneity among the populations: that is, we
assume that the percentage distribution of the
categories is the same for each population.
The assumptions and necessary conditions for use of a
test for homogeneity are identical with those for a
goodness-of-fit test (Counted Data Condition,
Randomization Condition, Independence Assumption,
Expected Cell Frequency Condition, 10% Condition),
but now, since we need to count categories across
multiple groups, we arrange the data in a contingency
table with the categories arranged by row and the
different groups by column. Each cell records an Obs
count. If our null hypothesis – that all the groups have
the same distribution across categories – is true, then
we expect each Obs count in the table to be close to the
expected count
Exp =
€
( row total) × ( column total)
.
table total
Chapter 26
6
We then use a chi-square statistic to assess how likely
it is that the Obs data differs from their Exp values:
(Obs − Exp) 2
χ = ∑
Exp
all cells
2
Here, however, we use a number of degrees of freedom
equal to df = ( R − 1)(C − 1), where the contigency table
€ and C columns. The chi-square probability
has R rows
model now allows us to determine a P-value associated
with the test.
€
In summary, a test for homogeneity has the following
form:
€
€
Chapter 26
7
Test for homogeneity:
• State hypotheses:
Null hypothesis
H 0 :C groups have equal distributions over R categories
Alternative hypothesis
H A : groups have unequal distributions over categories
(Note: only one alternative option)
• Choose the model:
A SRS of size n satisfying the 10% Condition is
selected and observed counts for each category are
tallied (so that each cell count is ≥ 5), so a chisquare model applies with test statistic
(Obs − Exp) 2
2
χ = ∑
and df = ( R − 1)(C − 1)
Exp
all cells
• Mechanics:
€
2
Compute
the
expected
counts
and
χ
; upper-tailed
€
probability associated with HA: P = P( X 2 ≥ χ 2 )
• Conclusion:
€
Assess evidence against H0 in favor of HA
€
depending on how small P is.
[TI-83: MATRX EDIT [A], STAT TESTS χ2-Test]
Chapter 26
8
Chi-square residuals
Whenever we decide to reject the null hypothesis, it is a
good idea to examine the chi-square standardized
residuals for each cell; these can often provide
information about the underlying patterns of difference
between categories in the case of a goodness-of-fit test,
or of differences between groups in the case of a test for
homogeneity.
The residuals are the square roots of the components
that sum to χ 2 ; in particular, if a cell has observed
count Obs and expected count Exp, then its residual is
€
c=
Obs − Exp
Exp
.
Since these are standardized values, cells whose
observed counts are much larger than expected will
€
have large positive
residuals and cells whose observed
counts are much smaller than expected will have large
negative residuals.
Chapter 26
9
Test for independence
We have used contingency tables to investigate the
association between two categorical variables. We can
use a chi-square model to develop a test for
independence of the two variables. We use the
contingency table data to evaluate the hypothesis of
independence between the row categorical variable and
the column categorical variable. If this hypothesis is
true, then we should observe no association between the
variables, so that the Obs values in each cell should be
close to the Exp values (as determined for a test for
homogeneity):
Exp =
( row total) × ( column total)
table total
The same assumptions and conditions apply as for a test
for homogeneity.
€
€
€
Chapter 26
10
Test for independence of two categorical variables:
• State hypotheses:
Null hypothesis
H 0 : the two categorical variables are independent
Alternative hypothesis
H A : the two categorical variables are not independent
(Note: only one alternative option)
• Choose the model:
A SRS of size n satisfying the 10% Condition is
selected and observed counts for each category are
tallied (so that each cell count is ≥ 5), so a chisquare model applies with test statistic
(Obs − Exp) 2
2
χ = ∑
and df = ( R − 1)(C − 1)
Exp
all cells
• Mechanics:
€
2
Compute
the
expected
counts
and
χ
; upper-tailed
€
probability associated with HA: P = P( X 2 ≥ χ 2 )
• Conclusion:
€
Assess evidence against H0 in favor of HA
€
depending on how small P is.
[TI-83: MATRX EDIT [A], STAT TESTS χ2-Test]
Chapter 26
11
Deducing causation
Dependence of one variable on another means that
there is an association between them. It also suggests
that there might be a causal link between them, but it
does not prove that such a link must exist. When you
reject a null hypothesis that claims the independence of
two categorical variables, that doesn’t mean the
variables must be dependent, so it certainly does not
follow that there is a causal link between them.
Examining the residuals can help to tease out any
underlying patterns that exist.