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
Chapter 8 Section 8.2 Basics of Hypothesis Testing Hypothesis Testing 8.2 Basics of Hypothesis Testing Objective 8.3 Testing about a Proportion p For a population parameter (p, µ, σ) we wish to test whether a predicted value is close to the actual value (based on sample values). 8.4 Testing about a Mean µ (σ known) 8.5 Testing about a Mean µ (σ unknown) 8.6 Testing about a Standard Deviation σ 1 2 Example 1 Definitions Claim: The XSORT method of gender selection increases the likelihood of birthing a girl. (i.e. increases the proportion of girls born) In statistics, a Hypothesis is a claim or statement about a property of a population. A Hypothesis Test is a standard procedure for testing a claim about a property of a population. 1 To test the claim, use a hypothesis test (about a proportion) on a sample of 14 couples: If 6 or 7 have girls, the method probably doesn’t increase the probability of birthing a girl. Ch. 8 will cover hypothesis tests about a • Proportion p • Mean µ (σ known or σ unknown) • Standard Deviation σ If 13 or 14 couples have girls, this method probably does increase the probability of birthing a girl. 3 Rare Event Rule for Inferential Statistics This will be explained in Section 8.3 4 Components of a Hypothesis Test If, under a given assumption, the probability of a particular event is exceptionally small, we conclude the assumption is probably not correct. Null Hypothesis: H0 Example: Suppose we assume the probability of pigs flying is 10-10 If we find a farm with 100 flying pigs, we conclude our assumption probably wasn’t correct Alternative Hypothesis: H1 5 6 Null Hypothesis: H0 Alternative Hypothesis: H1 The null hypothesis (denoted H0) is a statement that the value of a population parameter (p, µ, σ) is equal to some claimed value. The alternative hypothesis (denoted H1) is a statement that the parameter has a value that somehow differs from the null hypothesis. We test the null hypothesis directly. It will either reject H0 or fail to reject H0 The difference will be one of <, >, ≠ (less than, greater than, doesn’t equal) (i.e. accept H0) Example H0: p = 0.6 Example H1: p < 0.6 H0: p = 0.6 H1: p < 0.6 7 8 Example 1 Example 1 Claim: The XSORT method of gender selection increases the likelihood of birthing a girl. Claim: The XSORT method of gender selection increases the likelihood of birthing a girl. • Let p denote the proportion of girls born. Continued If we reject the null hypothesis, then the original clam is accepted. • The claim is equivilent to “p>0.5” 2 The null hypothesis must say “equal to”: H0 : p = 0.5 Conclusion: The XSORT method increases the likelihood of having a baby girl. If we fail to reject the null hypothesis, then the original clam is rejected. The alternative hypothesis states the difference: H1 : p > 0.5 Conclusion: The XSORT method does not increase the likelihood of having a baby girl. Here, the original claim is the alternative hypothesis 9 Note: We always test the null hypothesis Example 2 Example 2 Claim: For couples using the XSORT method, the likelihood of having a girl is 50% Claim: For couples using the XSORT method, the likelihood of having a girl is 50% • Again, let p denote the proportion of girls born. 10 Continued If we reject the null hypothesis, then the original clam is rejected. • The claim is equivalent to “p=0.5” Conclusion: For couples using the XSORT method, the likelihood of having a girl is not 0.5 The null hypothesis must say “equal to”: H0 : p = 0.5 If we fail to reject the null hypothesis, then the original clam is accepted. The alternative hypothesis states the difference: H1 : p ≠ 0.5 Conclusion: For couples using the XSORT method, the likelihood of having a girl is indeed 0.5 Here, the original claim is the null hypothesis 11 Note: We always test the null hypothesis 12 Example 3 Example 3 Claim: For couples using the XSORT method, the likelihood of having a girl is at least 50% Claim: For couples using the XSORT method, the likelihood of having a girl is at least 50% • Again, let p denote the proportion of girls born. If we reject the null hypothesis, then the original clam is rejected. • The claim is equivalent to “p ≥ 0.5” Conclusion: For couples using the XSORT method, the likelihood of having a girl is less than 0.5 The null hypothesis must say “equal to”: H0 : p = 0.5 If we fail to reject the null hypothesis, then the original clam is accepted. The alternative hypothesis states the difference: H1 : p < 0.5 Continued we can’t use ≥ or ≤ in the alternative hypothesis, so we test the negation Conclusion: For couples using the XSORT method, the likelihood of having a girl is at least 0.5 Here, the original claim is the null hypothesis Note: We always test the null hypothesis 13 Type I Error General rules • If the null hypothesis is rejected, the alternative hypothesis is accepted. • A Type I error is the mistake of rejecting the null hypothesis when it is actually true. H0 rejected → H1 accepted • If the null hypothesis is accepted, the alternative hypothesis is rejected. 3 H0 accepted → H1 rejected • Acceptance or rejection of the null hypothesis is called an initial conclusion. • The final conclusion is always expressed in terms of the original claim. Not in terms of the null hypothesis or alternative hypothesis. 14 • Also called a “True Negative” True: means the actual hypothesis is true Negative: means the test rejected the hypothesis • The symbol (alpha) is used to represent the probability of a type I error. 15 Type II Error 16 Type I and Type II Errors • A Type II error is the mistake of accepting the null hypothesis when it is actually false. • Also called a “False Positive” False: means the actual hypothesis is false Positive: means the test failed to reject the hypothesis • The symbol (beta) is used to represent the probability of a type II error. 17 18 Example 4 Example 4 Claim: A new medication has greater success rate (p) than that of the old (existing) machine (p0) Continued Claim: A new medication has greater success rate (p) than that of the old (existing) machine (p0) H0 : p = p0 • p: Proportion of success for the new medication • p0: Proportion of success for the old medication H1 : p > p0 Type I error H0 is true, but we reject it → We accept the claim • The claim is equivalent to “p > p0” So we adopt the new (inefficient, potentially harmful) medicine. Null hypothesis: H 0 : p = p0 Alternative hypothesis: H 1 : p > p0 (This is called a critical error, must be avoided) Type II error H1 is true, but we reject it → We reject the claim So we decline the new medicine and continue with the old one. Here, the original claim is the null hypothesis (no direct harm…) 19 20 Critical Region Significance Level Consider a parameter (p, µ, σ, etc.) • The probability of a type I error (denoted ) is also called the significance level of the test. The “guess” for the parameter will have a probability that follows a certain distribution (z, t, χ2,etc.) • Characterizes the chance the test will fail. 4 (i.e. the chance of a type I error) • Used to set the “significance” of a hypothesis test. (i.e. how reliable the test is in avoiding type I errors) • Lower significance → Lower chance of type I error Note: This is just like what we used to calculate CIs. Using the significance level α, we determine the region where the guessed value becomes unusual. This is known as the critical region. The region is described using critical value(s). (Like those used for finding confidence intervals) • Values used most: = 0.1, 0.05, 0.01 (i.e. 10%, 5%, 1%, just like with CIs) 21 Example 22 Testing a Claim Using a Hypothesis Test p follows a z-distribution 1. State the H0 and H1 If we guess p > p0 the critical region is defined by the right tail whose area is α 2. Compute the test statistic Depends on the value being tested tα 3. Compute the critical region for the test statistic If we guess p < p0 the critical region is defined by the left tail whose area is α Depends on the distribution of the test statistic (z, t, χ2) Depends on the significance level α Found using the critical values -tα 4. Make an initial conclusion from the test If we guess p ≠ p0 the critical region is defined by the two tails whose areas are α/2 -tα/2 Reject H0 (accept H1) if the test statistic is within the critical region Accept H0 if test statistic is not within the critical region 5. Make a final conclusion about the claim tα/2 23 State it in terms of the original claim 24 Example 5 Claim: The XSORT method of gender selection increases the likelihood of birthing a girl. Suppose 14 couples using XSORT had 13 girls and 1 boy. Test the claim at a 5% significance level 1. State H0 and H1 H0 : p = 0.5 H1 : p > 0.5 2. Find the test statistic 3. Find the critical region 4. Initial conclusion 5. Final conclusion We accept the claim 25 26 Notation Section 8.3 Testing a claim about a Proportion 5 Objective For a population with proportion p, use a sample (with a sample proportion) to test a claim about the proportion. Testing a proportion uses the standard normal distribution (z-distribution) 27 Requirements 28 Test Statistic (1) The sample used is a a simple random sample Denoted z (as in z-score) since the test uses the z-distribution. (i.e. selected at random, no biases) (2) Satisfies conditions for a Binomial distribution (3) n p0 ≥ 5 and n q0 ≥ 5 Note: 2 and 3 satisfy conditions for the normal approximation to the binomial distribution Note: p0 is the assumed proportion, not the sample proportion 29 30 Types of Hypothesis Tests: Two-tailed, Left-tailed, Right-tailed Traditional method: If the test statistic falls within the critical region, reject H0. The tails in a distribution are the extreme regions where values of the test statistic agree with the alternative hypothesis If the test statistic does not fall within the critical region, fail to reject H0 (i.e. accept H0). 31 32 Left-tailed Test “<” H0: p = 0.5 Right-tailed Test “>” H0: p = 0.5 significance level H1: p < 0.5 significance level H1: p > 0.5 6 Area = Area = -z z (Negative) (Positive) 33 Example 1 Two-tailed Test “≠” H0: p = 0.5 H1: p ≠ 0.5 34 The XSORT method of gender selection is believed to increases the likelihood of birthing a girl. significance level 14 couples used the XSORT method and resulted in the birth of 13 girls and 1 boy. Using a 0.05 significance level, test the claim that the XSORT method increases the birth rate of girls. Area = /2 -z/2 (Assume the normal birthrate of girls is 0.5) Area = /2 z/2 What we know: p0 = 0.5 n = 14 Claim: p > 0.5 35 x = 13 using p = 0.9286 α = 0.05 n p0 = 14*0.5 = 7 n q0 = 14*0.5 = 7 Since n p0 > 5 and n q0 > 5, we can perform a hypothesis test. 36 Example 1 What we know: p0 = 0.5 n = 14 Claim: p > 0.5 x = 13 P-Value p = 0.9286 α = 0.01 using The P-value is the probability of getting a value of the test statistic that is at least as extreme as the one representing the sample data, assuming that the null hypothesis is true. H0 : p = 0.5 H1 : p > 0.5 Right-tailed Test statistic: zα = 1.645 Critical value: z = 3.207 Example z in critical region z Test statistic zα Critical value Initial Conclusion: Since z is in the critical region, reject H0 P-value = P(Z > z) Final Conclusion: We Accept the claim that the XSORT method increases the birth rate of girls P-value = area to the right of the test statistic Critical region in the left tail: P-value = area to the left of the test statistic Critical region in two tails: P-value = twice the area in the tail beyond the test statistic z zα 37 38 P-Value Critical region in the right tail: p-value (area) P-Value method: If P-value , reject H0. 7 If P-value > , fail to reject H0. If the P is low, the null must go. If the P is high, the null will fly. 39 40 Calculating P-value for a Proportion Caution Stat → Proportions → One sample → with summary Don’t confuse a P-value with a proportion p. Know this distinction: P-value = probability of getting a test statistic at least as extreme as the one representing sample data p = population proportion 41 42 Calculating P-value for a Proportion Calculating P-value for a Proportion Enter the number of successes (x) and the number of observations (n) Enter the Null proportion (p0) and select the alternative hypothesis (≠, <, or >) Then hit Calculate 43 44 Example 1 Using P-value Calculating P-value for a Proportion What we know: p0 = 0.5 n = 14 Claim: p > 0.5 The resulting table shows both the test statistic (z) and the P-value H0 : p = 0.5 x = 13 using p = 0.9286 α = 0.01 Stat → Proportions→ One sample → With summary H1 : p > 0.5 8 Number of successes: 13 Number of observations: 14 ● Hypothesis Test Null: proportion= 0.5 Alternative > P-value = 0.0007 P-value Test statistic P-value = 0.0007 45 Initial Conclusion: Since p-value < α (α = 0.05), reject H0 Final Conclusion: We Accept the claim that the XSORT method increases the birth rate of girls 46 Example 2 Do we prove a claim? Problem 32, pg 424 Mendel’s Genetics Experiments When Gregor Mendel conducted his famous hybridization experiments with peas, one such experiment resulted in 580 offspring peas, with 26.2% of them having yellow pods. According to Mendel’s theory, ¼ of the offspring peas should have yellow pods. Use a 0.05 significance level to test the claim that the proportion of peas with yellow pods is equal to ¼. A statistical test cannot definitely prove a hypothesis or a claim. Our conclusion can be only stated like this: The available evidence is not strong enough to warrant rejection of a hypothesis or a claim What we know: We can say we are 95% confident it holds. p0 = 0.25 n = 580 Claim: p = 0.25 “The only definite is that there are no definites” -Unknown 47 p = 0.262 using α = 0.05 n p0 = 580*0.25 = 145 n q0 = 580*0.75 = 435 Since n p0 > 5 and n q0 > 5, we can perform a hypothesis test. 48 Example 2 Using P-value Example 2 What we know: p0 = 0.25 n = 580 Claim: p = 0.25 p = 0.262 using What we know: α = 0.05 p0 = 0.25 n = 580 Claim: p = 0.25 H0 : p = 0.25 H0 : p = 0.25 H1 : p ≠ 0.25 Two-tailed H1 : p ≠ 0.25 p = 0.262 using α = 0.05 Stat → Proportions→ One sample → With summary Number of successes: 152 Number of observations: 580 ● Hypothesis Test Null: proportion= Test statistic: ≠ x = np = 580*0.262 ≈ 152 zα = 1.960 zα = -1.960 0.25 Alternative P-value = 0.5021 z = 0.667 Critical value: z not in critical region Initial Conclusion: Since z is not in the critical region, accept H0 Initial Conclusion: Since P-value > α, accept H0 Final Conclusion: We Accept the claim that the proportion of peas with yellow pods is equal to ¼ Final Conclusion: We Accept the claim that the proportion of peas with yellow pods is equal to ¼ 49 50 Section 8.4 Testing a claim about a mean (σ known) 9 Objective For a population with mean µ (with σ known), use a sample (with a sample mean) to test a claim about the mean. Testing a mean (when σ known) uses the standard normal distribution (z-distribution) 51 52 Notation Requirements (1) The population standard deviation σ is known (2) One or both of the following: The population is normally distributed or n > 30 53 54 Example 1 Test Statistic People have died in boat accidents because an obsolete estimate of the mean weight of men (166.3 lb.) was used. Denoted z (as in z-score) since the test uses the z-distribution. A random sample of n = 40 men yielded the mean x = 172.55 lb. Research from other sources suggests that the population of weights of men has a standard deviation given by = 26 lb. Use a 0.1 significance level to test the claim that men have a mean weight greater than 166.3 lb. What we know: µ0 = 166.3 n = 40 Claim: µ > 166.3 x = 172.55 σ = 26 using α = 0.1 55 56 Example 1 Using Critical Region What we know: µ0 = 166.3 n = 40 Claim: µ > 166.3 Calculating P-value for a Mean x = 172.55 σ = 26 using (σ known) α = 0.05 Stat → Z statistics → One sample → with summary H0 : µ = 166.3 H1 : µ > 166.3 Right-tailed 10 Test statistic: zα = 1.282 z = 1.520 Critical value: z in critical region Initial Conclusion: Since z is in the critical region, reject H0 Final Conclusion: We Accept the claim that the actual mean weight of men is greater than 166.3 lb. 57 58 Calculating P-value for a Mean Calculating P-value for a Mean (σ known) (σ known) Then hit Calculate 59 60 Example 1 Using P-value Calculating P-value for a Mean (σ known) What we know: µ0 = 166.3 The resulting table shows both the test statistic (z) and the P-value x = 172.55 σ = 26 n = 40 Claim: µ > 166.3 using α = 0.05 H0 : µ = 166.3 Stat → Z statistics→ One sample → With summary H1 : µ > 166.3 Standard deviation: 26 Null: proportion= Sample size: 40 Alternative Sample mean: 172.55 ● Hypothesis Test 166.3 > P-value = 0.0642 P-value Test statistic Initial Conclusion: Since P-value < α, reject H0 P-value = 0.0642 Final Conclusion: We Accept the claim that the actual mean weight of men is greater than 166.3 lb. 62 61 Example 2 Using Critical Region Example 2 What we know: Weight of Bears A sample of 54 bears has a mean weight of 237.9 lb. µ0 = 250 Claim: µ < 250 H1 : µ < 250 using x = 237.9 σ = 37.8 using α = 0.05 11 Left-tailed Test statistic: –zα = –1.645 x = 237.9 σ = 37.8 n = 54 n = 54 H0 : µ = 250 Assuming that σ is known to be 37.8 lb. use a 0.05 significance level to test the claim that the population mean of all such bear weights is less than 250 lb. What we know: µ0 = 250 Claim: µ < 250 z = –2.352 Critical value: α = 0.05 z in critical region Initial Conclusion: Since z is in the critical region, reject H0 63 Example 2 Using P-value What we know: µ0 = 250 n = 54 Claim: µ < 250 x = 237.9 σ = 37.8 using α = 0.05 H0 : µ = 250 Stat → Z statistics→ One sample → With summary H1 : µ < 250 Standard deviation: Sample mean: 237.9 Sample size: 37.8 ● Hypothesis Test Null: proportion= Alternative 54 250 < P-value = 0.0093 Initial Conclusion: Since P-value < α, reject H0 Final Conclusion: We Accept the claim that the mean weight of bears is less than 250 lb. 65 Final Conclusion: We Accept the claim that the mean weight of bears is less than 250 lb. 64