Sei sulla pagina 1di 9

Kay Zhang This lesson explains how to conduct a chi-square goodness of fit test.

After this lesson, the student will be able to conduct a chi-square goodness of fit test without (too much) guidance. In this lesson, teaching strategies that will be used are lecture, in which I will teach the material needed, discussion, in which I will converse with my student about the material taught, case method, in which I will make problems which are relevant/applicable to the real world, and active learning, in which I will make sample problems which are interesting to my student to make them more inclined/open to learning. I will also use technology (the calculator) in this lesson to help solve the problems Ive created. Mainly, it will be used to find the chi-square value and the p-value, which will be explained later in the lesson. Chi-square goodness of fit is used to determine whether sample data are consistent with a hypothesized distribution. It is used when you have one categorical variable from a single population and you want to determine whether the sample data is consistent with a hypothesized distribution. Example: Suppose a company printed different combinations of Chinese poetry. It claimed that 30% of its copies were made up of poetry from the Song dynasty; 60% from the Zhou dynasty; and 10% from the Qing dynasty. We can gather a random sample of these copies and use a chi-square goodness of fit test to see whether our sample distribution differed significantly from the distribution claimed by the company. When performing a chi-square goodness of fit test, there are certain conditions that must be met before being able to proceed with the test:

The sampling method is simple random sampling. The population is at least 10 times as large as the sample. The variable under study is categorical. The expected values of the variable are at least 5.

There are four basic steps to performing a chi-square goodness of fit test: (1) state the hypotheses, (2) make an analysis plan, (3) analyze sample data, and (4) interpret results.

State the Hypotheses Every hypothesis test requires the tester to state a null hypothesis and an alternative hypothesis. The hypotheses are stated in such a way that they are mutually exclusive (if one is true, the other must be false). 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. Formulate an Analysis Plan The analysis plan describes how to use sample data to accept or reject the null hypothesis. The plan should have the following:

Significance level, normally .01 or .05, 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 values specified in the null hypothesis.

Analyze Sample Data Using sample data, find the degrees of freedom, expected values, 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 (s) of the categorical variable minus 1: DF = s - 1. Expected values. The expected values of the categorical variable are equal to the sample size times the hypothesized proportion from the null hypothesis Expected Value = (Given proportion)(Sample size)

Test statistic. The test statistic is a chi-square variable (2) defined by the following equation. 2 = [ (O - E)2 / E ]

where O is the observed frequency count and E is the expected frequency count.

P-value. The P-value is the probability of observing a sample statistic as extreme as the test statistic.

Interpret Results If the sample findings are unlikely, given the null hypothesis then you reject the null hypothesis. Otherwise, you state that you fail to reject. This is very important; we NEVER say that we accept the null hypothesis. Application of What you Just Learned Problem Suppose a company printed different combinations of Chinese poetry. It claimed that 30% of its copies were made up of poetry from the Song dynasty; 60% from the Zhou dynasty; and 10% from the Qing dynasty. Each combination holds 100 poems. Suppose a randomly-selected copy has 50 poems from the Song dynasty, 45 from the Zhou dynasty, and 5 from the Qing dynasty. Is this consistent with the companys claim? Use a 0.05 level of significance. Solution First, we test check the assumptions:

The sampling method is simple random sampling this is given to us in the problem. The population is at least 10 times as large as the sample the sample of one copy of a selection of poems times 10 must be less than all of the copies printed by the company. The variable under study is categorical we are looking at types of poems, which is categorical. The expected values of the variable are at least 5 the calculated expected values (see below) are all greater than 5

We are safe to move on with the test.

The solution to this problem takes four steps: (1) state the hypotheses, (2) formulate an analysis plan, (3) analyze sample data, and (4) interpret results. We work through those steps below:

State the hypotheses. The first step is to state the null hypothesis and an alternative hypothesis.
a.

Null hypothesis: The proportion of Song dynasty poems, Zhou dynasty poems,

and Qing dynasty poems is 30%, 60% and 10%, respectively. b. Alternative hypothesis: The proportion of Song dynasty poems, Zhou dynasty poems, and Qing dynasty poems is NOT 30%, 60% and 10%, respectively. Formulate an analysis plan. For this analysis, the significance level is 0.05. Using sample data, we will conduct a chi-square goodness of fit test of the null hypothesis. 3. Analyze sample data. Applying the chi-square goodness of fit test to sample data, we compute the degrees of freedom, the expected frequency counts, and the chi-square test statistic. Based on the chi-square statistic and the degrees of freedom, we determine the P-value.
2.

Degrees of freedom (Must be done by hand) DF = s - 1 = 3 - 1 = 2 Expected values (Can be entered into the LISTs [STAT -> EDIT] in the calculator with L1 being the Observed values and L2 being the Expected values)

Type of Poem Song Zhou Qing

Expected (proportion claimed * total # of poems (.3)100 = 30 (.6)100 = 60 (.1)100 = 10

Observed (given in the problem) 50 45 5

Chi-square value (Can use calculator to calculate the chi-square value [STAT -> TESTS -> 2GOF-Test] then make sure Observed is L1 and Expected is L2 and then enter the df (degrees of freedom) of 2 and then press Calculate)

2 = [ (O - E)2 / E ] 2 = [ (50 - 30)2 / 30 ] + [ (45 - 60)2 / 60 ] + [ (5 - 10)2 / 10 ] 2 = 13.33 + 3.75 + 2.50 = 19.58 The P-value is the probability that a chi-square statistic having 2 degrees of freedom is more extreme than 19.58. It is given to you by the calculator when you find the chisquare value as p = 5.5915 x 10-5 .
4.

Interpret results. Since the P-value (5.5915 x 10-5) is less than the significance level (0.05), we reject the null hypothesis. It seems that the proportion of Song dynasty poems, Zhou dynasty poems, and Qing dynasty poems is NOT 30%, 60% and 10%, respectively.

You just finished your first chi-square goodness of fit test. Now, try this problem on your own: Suppose that a sports manufacturer makes ping-pong balls. They claim that 50% of the balls made are yellow while 45% are white and 5% are a rare red. Suppose a simple random sample of 100 ping-pong balls made from this sports manufacturer gives 55 yellow balls, 42 white balls, and 3 red balls. Is this consistent with the manufacturers claim? Use a significance level of 0.05.

Solution First, we test check the assumptions:


The sampling method is simple random sampling this is given to us in the problem. The population is at least 10 times as large as the sample the sample of 100 ping-pong balls times 10 must be less than all the balls made by the company. The variable under study is categorical we are looking at colors of ping-pong balls, which is categorical. The expected values of the variable are at least 5 the calculated expected values (see below) are all greater than 5

We are safe to move on with the test. Again, the solution to this problem takes four steps: (1) state the hypotheses, (2) formulate an analysis plan, (3) analyze sample data, and (4) interpret results. We work through those steps below:

State the hypotheses. The first step is to state the null hypothesis and an alternative hypothesis.
a.

Null hypothesis: The proportion of yellow balls, white balls, and red balls is 50%,

45% and 5%, respectively. b. Alternative hypothesis: The proportion of yellow balls, white balls, and red balls is NOT 50%, 45% and 5%, respectively.

Formulate an analysis plan. For this analysis, the significance level is 0.05. Using sample data, we will conduct a chi-square goodness of fit test of the null hypothesis. Analyze sample data. Applying the chi-square goodness of fit test to sample data, we compute the degrees of freedom, the expected frequency counts, and the chi-square test statistic. Based on the chi-square statistic and the degrees of freedom, we determine the P-value. Degrees of freedom (Must be done by hand) DF = s - 1 = 3 - 1 = 2

Expected values (Can be entered into the LISTs [STAT -> EDIT] in the calculator with L1 being the Observed values and L2 being the Expected values)

Color of Ball Yellow White Red

Expected (proportion claimed * total # of poems (.5)100 = 50 (.45)100 = 45 (.05)100 = 5

Observed (given in the problem) 55 42 3

Chi-square value (Can use calculator to calculate the chi-square value [STAT -> TESTS -> 2GOF-Test] then make sure Observed is L1 and Expected is L2 and then enter the df (degrees of freedom) of 2 and then press Calculate) 2 = [ (O - E)2 / E ] 2 = [ (55 - 50)2 / 50 ] + [ (42 - 45)2 / 45 ] + [ (3 - 5)2 / 5 ] 2 = .5 + .2 + .8 = 1.5 The P-value is the probability that a chi-square statistic having 2 degrees of freedom is more extreme than 1.5. It is given to you by the calculator when you find the chi-square value as p = .47236 .

Interpret results. Since the P-value (.47236) is greater than the significance level (0.05), we fail to reject the null hypothesis. It seems that the proportion of yellow balls, white balls, and red balls is 50%, 45% and 5%, respectively.

Anticipated Questions: 1. What is the difference between observed values and expected values? The observed values are what you are given by a study while the expected values are what the observed values ought to be according to a hypothesized distribution. For example, in the problem with the ping-pong balls, the observed values were the number of each color of ball in a random sample of 100 balls while the expected values were the number of each color of ball that should occur in a sample of 100 balls according to the distribution claimed by the manufacturer. 2. Why do the expected values have to be greater than 5? This ensures that we have enough data to perform the test without too much influence by variability of the data. In other words, since the world in general is random and chaotic, we can never be sure that our samples are 100% eliminated of variance, and so we try to use larger samples to reduce the effect variability has on our data. 3. What are degrees of freedom? Degrees of freedom are the number of values in the final calculation of a statistic that are free to vary. Normally, the degrees of freedom of an estimate is equal to the number of independent scores that go into the estimate minus the number of parameters estimated 4. Clarify how you know if you reject or fail to reject a null hypothesis and how does this relate to the significance level: When your calculated p-value is less than the significance level, you reject the null hypothesis. When your calculated p-value is greater than the significance level, you fail to reject the null hypothesis. Ultimately, the significance level represents how willing you are to fail to reject a false null hypothesis. For example, if you are testing if a medication being produced is up to standards, you will want to have a larger significance level to increase your confidence that you are not failing to reject a false null hypothesis that the medication being produced is up to standards.
5. Why do we never accept a null hypothesis and only fail to reject it?

Even if the p-value is extremely large, we are never 100% sure that our sample data will match the hypothesized distribution perfectly, as there are many factors such as variability at play, so we are unable to accept and can only fail to reject. Aptitude

Potrebbero piacerti anche