Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 1 Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 1) Testing The Population Proportion π Let’s walk through one example, put the pieces into a testing procedure for proportions and then use the procedure in another example EXAMPLE Parents of autistic children are often told that their child is autistic around 1-2 years of age, approximately the same age that children receive their MMR vaccinations (mumps, measles and rubella). As a result, some parents claim that the vaccine caused the autism. To test this, a study was done to compare the rate of autism in children who receive the MMR vaccine to the known population rate for children who do not receive the vaccine. Among those who did not receive the vaccine, the proportion of children with autism is 0.0021. In a sample of 8,500 randomly selected children who did receive the MMR vaccine, the proportion with autism was .0028. Is this sufficient evidence to indicate that the vaccine is related to autism? Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 2 H0: π = 0.0021 HA: π > 0.0021 1. Hypotheses: 2. Significance level: α = 0.03 3. If the Null Hypothesis is true, then the sampling distribution of the sample proportion, p, obtained from the experiment has a mean of µ p = π = 0.0021 and a standard deviation of σp = π (1 − π ) = 0.00049567 n Further the Central Limit Theorem says that p is approximately Normally distributed if the sample size is big enough. The sample size is certainly big enough: nπ = 8500(0.0021) = 17.85 n(1 − π ) = 8500 − 17.85 = 8472.15 So, let’s convert the observed sample proportion to a z-score (we can interpret the difference more easily): Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE z= p − µp σp = 12 - 3 0.0028 − 0.0021 = 1.4122 0.00049567 This says that 0.0028 is 1.41 standard deviation units above the hypothesized value of 0.0021. Is this very likely if the null hypothesis is true? Is it supportive of H0 or HA? What is the probability that if we repeated the experiment we’d see a z-score as unusual as this one, i.e. one even more contradictory of Ho and supportive of HA, when the null hypothesis is true. I.e. How likely is it we’d get an even larger z-score just by chance when the null hypothesis is true? To do this we calculate Pr(Z>1.41). Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 4 Pr(Z > 1.41)=1-Pr(Z ≤ 1.41)=1–0.9207 =0.0793 The probability that a random sample would yield a sample proportion of 0.0028 or more by chance alone when the null hypothesis is true is approximately 8%. So, are the data sufficiently contradictory of H0 for us to reject it? Hold off an answer and get a few definitions first. Defn: A TEST STATISTIC is the calculated number on which the statistical test is based. The P-VALUE (aka the OBSERVED SIGNIFICANCE LEVEL) of a test is the measure of how contradictory the sample value is to the null hypothesis while simultaneously supportive of the alternative hypothesis. It is the probability, assuming H0 is true, of obtaining a test statistic value at least as inconsistent with H0 as the one actually observed. For this example Test statistic: z-score=1.41 P-value: Pr(z>1.41)=0.0793 Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 5 Determination of P-values Each form of alternative hypothesis has a specific p-value calculation: 1) 1-sided upper tail alternative HA: parameter > hypothesized value 2) 1-sided lower tail alternative HA: parameter < hypothesized value Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 6 3) 2-sided test alternative HA: parameter ≠ hypothesized value To MAKE THE DECISION whether or not to reject the null hypothesis, we use the following rule: Reject H0 if the P-value ≤ α Do not reject H0 if the P-value > α In our example, the P-value = 0.0793 and α was set to 0.03. Since 0.0793 > 0.03, we do not reject H0. There is insufficient evidence to support the parents’ claim that the MMR vaccine is associated with autism in children. This implies that the seemingly higher rate is due to chance alone and not any firm data. Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 7 LARGE SAMPLE HYPOTHESIS TEST OF A POPULATION PROPORTION: Null hypothesis: H0: π = πo where πo is the hypothesized value Alternative Hypothesis is one of three: a) HA: π > πo b) HA: π < πo c) HA: π ≠ πo p − πo Test Statistic: z = π o (1 − π o ) n where n is the sample size and p is the sample proportion P-value: depends on the alternative hypothesis: a) P-value = Pr( Z > z) b) P-value = Pr( Z < z) c) P-value = 2 Pr( Z < -|z|) Decision Rule: reject Ho if P-value ≤ α Assumptions: 1. n is large enough for p to be approximately normally distributed ( nπo≥10 and n(1-πo)≥10 ) 2. the sampling was random and not more than 5% of the population. Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 8 EXAMPLE The incidence rate of a certain type of chromosome defect in adult males in the U.S. is believed to be 1 in 80. A random sample of 1000 men in prison revealed 20 men with defects. Is there evidence to suggest that the rate for prisoners differs from that in the general population? Use a significance level of 0.05. Null hypothesis: H0: π = πo = 1/80 = .0125 Alternative Hypothesis: HA: π ≠ .0125 Check assumptions: 1) nπo = 1000(.0125) = 12.5 ≥10 n(1-πo)=987.5 ≥10 2) sampling was given to be random Test Statistic: p − πo .02 − .0125 = 2.1347 z= = .0125(1 − .0125 ) π o (1 − π o ) 1000 n P-value: 2 Pr( Z < -|z|) = 2 Pr(Z<-2.13) = 2(0.0166) = 0.0332 Conclusion: reject the null hypothesis since 0.0332<0.05=α. There is sufficient evidence based on this sample to conclude that the population of adult males in the U.S. penal system has a different rate of a certain type of genetic defect than the general adult male population. Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 9 EXAMPLE Suppose a genetic crossing experiment was performed. If independent sorting of the genes occurs then it is expected that 25% of the offspring would display a certain characteristic. If a particular type of non-independent event occurs, the proportion should be smaller. The experiment resulted in 50 plants out of 230 having the characteristic. Is this sufficient evidence to reject independent sorting of the genes? Significance level: α=.10 Null hypothesis: H0: π = πo = .25 Alternative Hypothesis: HA: π < .25 Check assumptions: 1) nπo = 230(.25) = 57.5 ≥10 n(1-πo)=172.5 ≥10 2) sampling? Test Statistic: p − πo .217 − .25 z= = = −1.14 π o (1 − π o ) .25(1 − .25 ) 230 n P-value: Pr( Z < z) = Pr(Z<-1.14)=0.1271 Conclusion: We fail to reject the null hypothesis since 0.1271> α. There is insufficient evidence based on this sample to conclude that the gene sorting is a specific non-independent type of sort. Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 10 2) Testing The Population Mean µ To test a population mean, the test procedure is very similar to the test for proportions except that we need to use t-scores rather than z-scores. Reason: Recall that for these kinds of problems, a sample provides a sample mean x and a sample standard deviation s. Further if the sample size n is sufficiently large and sampling is random, a sample mean will be distributed like a normal distribution. x−µ has a T-distribution on (n –1) Hence, t = s n degrees of freedom. Otherwise the test procedure is quite similar. The (obvious) other difference is in the hypotheses themselves – we’re testing means and NOT proportions now! Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 11 LARGE SAMPLE HYPOTHESIS TEST OF A POPULATION MEAN: Null hypothesis: H0: µ = µ o where µ o is the hypothesized value Alternative Hypothesis is one of three: a) HA: µ > µ o b) HA: µ < µ o c) HA: µ ≠ µ o x − µo Test Statistic: t = s n where n is the sample size and x is the sample mean and s is the sample standard deviation P-value: depends on the alternative hypothesis: a) P-value = Pr( T > t) b) P-value = Pr( T < t) c) P-value = 2 Pr( T > |t|) Decision Rule: reject Ho if P-value ≤ α Assumptions: 1. n is large enough for x to be approximately normally distributed ( n≥30) 2. the sampling was random and not more than 5% of the population. Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 12 Alternative Approach to a Decision Rule: We have seen the p-value approach where we compare the p-value of a test with α. We can instead define an interval (or two) of values of the test statistic that lead us to reject with a type I error rate of α. Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 13 Call the t-value that corresponds to t* the critical or cutoff value for df = n-1 and the type I error rate = α. To indicate that it’s value depends on the sample size (through the df) and the choice of α, we denote the cutoff value by t*(α, n-1) So, an alternative decision rule is: Decision Rule: reject Ho if the test statistic, t, a) t > t*(1-α, n-1) b) t < - t*(1-α, n-1) c) |t| > t*(1-α/2, n-1) where t* is that value that makes the statement Pt(T>t*) = α. Example values: t*(0.95, 9) = 1.833 - t*(0.90, 14) = - 1.345 t*(0.975, 21) = 2.0796 Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 14 EXAMPLE In an experiment with rats, a behavioral scientist used an auditory signal to indicate that food was available through an open door in the cage. The scientist believed that it would take the rats less than 18 trials on average to learn to recognize the signal. He ran the experiment with 23 rats and obtained the following results: x = 16.261 trials to learn to go to the open door with a standard deviation of s = 3.441 trials. Is there sufficient evidence to support his contention? 1) state the hypotheses and choose an α: Ho: µ = 18 α=0.10 HA: µ < 18 2) review the assumptions: Each rat tested independently of the other rats? The rats constitute a random sample of rats from the population of interest? Is a sample of n=23 sufficiently large to invoke the CLT and use a T-test? Let’s look at the dot plot for this data before deciding Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 15 9 8 7 Count 6 5 4 3 2 1 0 5 10 15 20 NUMTRIALS 25 3) do the calculations: Here are the results as given by SYSTAT v. 9 Mean t = 16.261 = -2.424 SD df = 3.441 = 22 2-sided P-value = 0.024 Let’s check these numbers: df = n-1 = 23-1 = 22 ts = x − µ o 16.26 − 18 = = −2.424 s 3.44 n 23 Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 16 The software prints out the 2-sided P-value but we have a one-sided test so we need to divide the given P-value by 2 to get the right P-value for our test: our p-value =0.024 / 2 = 0.012 < 0.10 = α. 4) Draw a conclusion Since our P-value = 0.012 < 0.10 = α, we reject Ho and conclude that the data provide sufficient evidence that the average number of trials required for a rat to recognize an auditory signal that food is available is less than 18. The alternative approach for a decision is to use the critical value method: Need – t*(0.90, 22) = - 1.322 . Since t = - 2.424 < - 1.322, we reject the null hypothesis. Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 17 EXAMPLE Wastewater discharged from a dairy processing plant is high in bicarbonates and calcium. As a result it is thought that irrigating fields of kidney bean plants with the discharge will promote growth. An experiment was done to test this. 40 plants were irrigated with a 50% mix of discharge and water, resulting in a mean root length of 5.46 cm and a standard deviation of 0.55 cm. It is known that average root growth with regular feeding is 5.20 cm. Is there sufficient evidence to suggest that irrigation with the discharge effects average root length? Use a 0.025 level test. Significance level: α=.025 Null hypothesis: Ho: µ = 5.20 Alternative Hypothesis: HA: µ > 5.20 Check assumptions: 1) n large enough? 2) sampling done appropriately? Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE Test Statistic: ts = P-value: 12 - 18 x − µo 5.46 − 5.20 = = 2.99 s 0.55 40 n Pr( T> t) = Pr(T>3)=0.002 Conclusion: We reject the null hypothesis since 0.002< α=0.025. There is strong evidence to suggest that irrigating kidney bean plants with 50% mix of discharge from the dairy processing plant increases average root lengths. 3) Testing the Population Variance σ 2 To test a population variance, the test procedure is very similar to the test for the mean except that we need to use chi-square scores rather than t-scores. Recall that χ 2 = (n − 1)s 2 σ 2 has a Chi-Square distribution on (n – 1) degrees of freedom when the population from which we sampled has a Normal Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 19 distribution with a mean µ and variance σ 2 . We can use this to test hypotheses about that σ 2 . HYPOTHESIS TEST OF A POPULATION VARIANCE: Null hypothesis: H0: σ 2 = σ 02 where σ 02 is the hypothesized value Alternative Hypothesis is one of three: a) HA: σ 2 > σ 02 b) HA: σ 2 < σ 02 c) HA: σ 2 ≠ σ 02 2 Test Statistic: χ = ( n − 1) s 2 σ 02 where n is the sample size and s 2 is the sample variance Decision Rules: a) Reject H0 if χ 2 > χU2 , the upper-tail value for chosen α and df = n – 1. and df = n – 1. b) Reject H0 if χ 2 < χ L2 , the lower-tail value for 1 – α and df = n – 1. Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 20 c) Reject H0 if χ 2 > χU2 , the upper-tail value for α/2 or if χ 2 < χ L2 , the lower-tail value for 1 – α/2 and df = n – 1. Assumptions: The population from which the sample was taken is approximately Normally distributed and the sampling was done randomly. EXAMPLE The USGS maintains historical records of water flow into various bodies of water in the United States. Of interest is whether climate change is affecting the variability in water flow in recent years, i.e. the Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 21 effects of warming may be in the variability of events rather than through a shift in the mean rate. So, let’s test the hypothesis that the flow rate variance has increased above the historical level. 2 2 versus HA: σ 2 > σ historical H0: σ 2 = σ historical Historically (prior to 1990), the variability in flow 2 = 277x106 cfs. rates was σ historical Recent data from 1993 to 2003 are given in the following table: Year 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 CFS 95600 97200 59400 137800 63000 92600 45700 72100 39500 47200 135300 Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE CFS 25000 Moments Mean Std Dev Std Err Mean upper 95% Mean lower 95% Mean N Sum Wgt Sum Variance Skewness Kurtosis CV N Missing 75000100000 150000 80490.909 34296.631 10340.823 103531.7 57450.119 11 11 885400 1.17626e9 0.6045854 -0.751232 42.609323 0 12 - 22 Topic (12) – HYPOTHESIS TESTING BASED ON A SINGLE SAMPLE 12 - 23 Test Standard Deviation=value Hypothesized Value 16643.3 = sqrt( 277x106) Actual Estimate 34296.6 df 10 Test Statistic Prob > |ChiSq| Prob < ChiSq Prob > ChiSq ChiSquare 42.4643 <.0001 1.0000 <.0001 The software provides the p-values so that we do not need to find the critical values for making decisions. We can use the p-values directly! 2 ⎛ 34296.6 ⎞ 2 Check the calculations: χ = 10⎜ ⎟ = 42.464 . ⎝ 16643.3 ⎠ So, for an upper tail test, the p-value is < 0.0001 which is smaller than any reasonable α we might choose, so we reject the null hypothesis and conclude that variance in flow rates has increased based on the data for the last ten years.