Download When to Use the Chi-Square Goodness of Fit Test

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
Ch 13
GOF, Homogeneity, Independence. (hypothesis testing for
comparing populations or categories within a population)
comparing proportions (mean)
Source https://onlinecourses.science.psu.edu/stat200/node/73
When to Use the Chi-Square Goodness of Fit Test
1. Conditions The chi-square goodness of fit test is appropriate when the following
conditions are met:



The sampling method is simple random sampling.
The variable under study is categorical.
The expected value of the number of sample observations in each level of the variable is
at least 5. (thus enabling us to use normal approximation… aka “z”
2. State the Hypotheses
Every hypothesis test requires the analyst to state a null hypothesis (H0) and an alternative
hypothesis (Ha). The hypotheses are stated in such a way that they are mutually exclusive. That
is, if one is true, the other must be false; and vice versa.
For a chi-square goodness of fit test, the hypotheses take the following form.
H0: The data are consistent with a specified distribution.
Ha: The data are not consistent with a specified distribution.
Typically, the null hypothesis (H0) specifies the proportion of observations at each level of the
categorical variable. The alternative hypothesis (Ha) is that at least one of the specified
proportions is not true.
3. Formulate an Analysis Plan
The analysis plan describes how to use sample data to accept or reject the null hypothesis. The
plan should specify the following elements.

Significance level. Often, researchers choose significance levels equal to 0.01, 0.05, or 0.10; but
any value between 0 and 1 can be used.

Test method. Use the chi-square goodness of fit test to determine whether observed sample
frequencies differ significantly from expected frequencies specified in the null hypothesis.
4. Analyze Sample Data
Using sample data, find the degrees of freedom, expected frequency counts, test statistic, and the
P-value associated with the test statistic.

Degrees of freedom. The degrees of freedom (DF) is equal to the number of levels (k) of the
categorical variable minus 1: DF = k - 1 .

Expected frequency counts. The expected frequency counts at each level of the categorical
variable are equal to the sample size times the hypothesized proportion from the null
hypothesis
Ei = npi
where Ei is the expected frequency count for the ith level of the categorical variable, n is the
total sample size, and pi is the hypothesized proportion of observations in level i.

Test statistic. The test statistic is a chi-square random variable (Χ2) defined by the following
equation.
Χ2 = Σ [ (Oi - Ei)2 / Ei ]
where Oi is the observed frequency count for the ith level of the categorical variable, and Ei is
the expected frequency count for the ith level of the categorical variable.

P-value. The P-value is the probability of observing a sample statistic as extreme as the test
statistic. Since the test statistic is a chi-square, use the Chi-Square Distribution Calculator to
assess the probability associated with the test statistic. Use the degrees of freedom computed
above.
5. Interpret Results
If the sample findings are unlikely, given the null hypothesis, the researcher rejects the null
hypothesis. Typically, this involves comparing the P-value to the significance level, and rejecting
the null hypothesis when the P-value is less than the significance level.
Test For Independence.
1. Check any necessary assumptions and write null and alternative hypotheses.
The assumptions are that the sample is randomly drawn from the population and that all
expected values are at least five (we will see what expected values are later). Show the
numbers or at least mention the math.
Our hypotheses are:
H0: There is not a relationship between the two variables (they are independent)
Ha: There is a relationship between the two variables (they are dependent)
2. Check any necessary assumptions and write null and alternative hypotheses.
The assumptions are that the sample is randomly drawn from the population and that all expected
values are at least five (we will see what expected values are later). Helpful to show you know
what the calculation is.
3.
Determine a p-value associated with the test statistic.
The p-value can be found using Minitab or Minitab Express. Look up the area beyond your chisquare test statistic on a chi-square distribution with the correct degrees of freedom.
4.  Decide between the null and alternative hypotheses.
If p≤α reject the null hypothesis. p>α fail to reject the null hypothesis. (make sure you mention
why you made the decision. Since the p-value of .2356 is greater than the alpha level of .05 ….
there is not significant evidence to reject the null hypothesis of…
5. State a "real world" conclusion.
Based on your decision in step 4, write a conclusion in terms of the original research question.
Source http://stattrek.com/chi-square-test/homogeneity.aspx?tutorial=ap
When to Use Chi-Square Test for Homogeneity
The test is applied to a single categorical variable from two
different populations. It is used to determine whether frequency
counts are distributed identically across different populations.
1. The test procedure described in this lesson is appropriate when the following
conditions are met:

For each population, the sampling method is simple random sampling.


The variable under study is categorical.
If sample data are displayed in a contingency table (Populations x Category levels), the expected
frequency count for each cell of the table is at least 5.
This approach consists of four steps: (1) state the hypotheses, (2) formulate an analysis plan, (3)
analyze sample data, and (4) interpret results.
If you use this approach on an exam, you may also want to mention why this approach is appropriate.
Specifically, the approach is appropriate because the sampling method was simple random sampling,
the variable under study was categorical, and the expected frequency count was at least 5 in each
population at each level of the categorical variable.
2. State the Hypotheses
Every hypothesis test requires the analyst to state a null hypothesis and an alternative hypothesis.
The hypotheses are stated in such a way that they are mutually exclusive. That is, if one is true,
the other must be false; and vice versa.
Suppose that data were sampled from r populations, and assume that the categorical variable had
c levels. At any specified level of the categorical variable, the null hypothesis states that each
population has the same proportion of observations. Thus,
H0: Plevel 1 of population 1 = Plevel 1 of population 2 = . . . = Plevel 1 of population r
H0: Plevel 2 of population 1 = Plevel 2 of population 2 = . . . = Plevel 2 of population r
...
H0: Plevel c of population 1 = Plevel c of population 2 = . . . = Plevel c of population r
The alternative hypothesis (Ha) is that at least one of the null hypothesis statements is false.
Formulate an Analysis Plan
3.


The analysis plan describes how to use sample data to accept or reject the null
hypothesis. The plan should specify the following elements.
Significance level. Often, researchers choose significance levels equal to 0.01, 0.05, or
0.10; but any value between 0 and 1 can be used.
Test method. Use the chi-square test for homogeneity to determine whether observed
sample frequencies differ significantly from expected frequencies specified in the null
hypothesis. The chi-square test for homogeneity is described in the next section.
4. Analyze Sample Data
Using sample data from the contingency tables, find the degrees of freedom, expected frequency
counts, test statistic, and the P-value associated with the test statistic. The analysis described in
this section is illustrated in the sample problem at the end of this lesson.

Degrees of freedom. The degrees of freedom (DF) is equal to:
DF = (r - 1) * (c - 1)
where r is the number of populations, and c is the number of levels for the categorical variable.

Expected frequency counts. The expected frequency counts are computed separately for each
population at each level of the categorical variable, according to the following formula.
Er,c = (nr * nc) / n
where Er,c is the expected frequency count for population r at level c of the categorical variable,
nr is the total number of observations from population r, nc is the total number of observations
at treatment level c, and n is the total sample size.

Test statistic. The test statistic is a chi-square random variable (Χ2) defined by the following
equation.
Χ2 = Σ [ (Or,c - Er,c)2 / Er,c ]
where Or,c is the observed frequency count in population r for level c of the categorical variable,
and Er,c is the expected frequency count in population r for level c of the categorical variable.

P-value. The P-value is the probability of observing a sample statistic as extreme as the test
statistic. Since the test statistic is a chi-square, use the Chi-Square Distribution Calculator to
assess the probability associated with the test statistic. Use the degrees of freedom computed
above.
6. Interpret Results
If the sample findings are unlikely, given the null hypothesis, the researcher rejects the null
hypothesis. Typically, this involves comparing the P-value to the significance level, and rejecting
the null hypothesis when the P-value is less than the significance level.