HYPOTHESIS TEST CLASS NOTES Hypothesis Test: Procedure that allows us to ask a question about an unknown population parameter Uses sample data to draw a conclusion about the unknown population parameter. Steps to perform a Hypothesis Test Step 1: Planning the test: Formulate questions as a pair of hypotheses AND set criteria for how to draw a conclusion from the data Step 2: In real life: Gather Data: Select random sample(s) and collect data. In HW or exam problem: Examine the given data and information, and determine how to perform test (which distribution and type of test to use) Step 3: Analyze sample data: Perform a probability calculation to find the “p value” Step 4: Decide what the data analysis shows about the hypotheses Step 5: Interpret the decision in the context of the problem. Step 1: Set up hypotheses that ask a question about the population by setting up two opposite statements about the possible value of the parameters. Ho: Null hypothesis: The assumption about the population parameter that will be believed unless it can be shown to be wrong beyond a reasonable doubt Ha: Alternate hypothesis: The claim about the population parameter that must be shown correct "beyond a reasonable doubt" to believe that it is true. Statisticians design the hypothesis test so that the outcome that needs to be proved is the alternate hypothesis. Example A: A new surgery is being tested to determine if is effective in providing a cure. The hypothesis test should be set up so that the surgery must be proven effective. Ho: Null hypothesis: A new surgery is as effective as non-surgical treatment Ha: Alternate hypothesis: A new surgery is more effective than non-surgical treatment A hospital is testing a new surgery for a type of knee injury. Many patients with knee injuries recover with non-surgical treatment, and surgery has risks. The surgery review board has decided that the hospital can perform this surgery as a clinical trial. After studying the medical considerations, they decide that they will approve this type of surgery for future use if the clinical trial shows that the surgery would cure more than 60% of all such injuries p = ___________________________________________________________________________ Ho: Null hypothesis: ________________________________________________________________. Ha: Alternate hypothesis: __________________________________________________________________ Example B: FDA guidelines require that to be considered "fat-free", a serving of salad dressing must contain less than ½ gram of fat. A salad dressing manufacturer must be able to show that its salad dressing satisfies these guidelines in order to put the words "fat-free" on its label. (one "serving" is 2 tablespoons of salad dressing) The hypothesis test should be set up so that the manufacturer must prove that the salad dressing satisfies the regulations to call it "fat-free" µ = ___________________________________________________________________________ Ho: Null hypothesis: ________________________________________________________________. Ha: Alternate hypothesis: __________________________________________________________________ Page 1 Math 10 RULE FOR HYPOTHESES Null hypothesis Ho must contain equality of some type: = or Alternate hypothesis Ha must contain a pure inequality. > or < Some of the following examples will be used in class. Link to answers is posted on instructor's website. 1. Engineering students at a college want to determine how the price of their calculus book at their bookstore compares to the price at other college bookstores. The calculus book costs $150 at their bookstore. They will collect data about the price of this calculus book from 30 other bookstores nationwide and will use the sample data to decide whether the average price of this book at all other colleges in the nation is different from the price of $150 at their bookstore. _____ = ____________________________________________________________________________ H0: ________ HA: _________ _________________________ 2. A soda bottler wants to determine whether the 12 ounce soda cans filled at their plant are underfilled, containing less than 12 ounces, on average. _____ = ____________________________________________________________________________ H0: ________ HA: _________ _________________________ 3. Exercise Circuit, a fitness center, advertises a 30 minute workout that rotates clients exercising though all the fitness stations in 30 minutes. Clients who want longer workouts have complained, but other clients prefer the relatively quick 30 minute workout. The center conducts a survey to determine whether the average desired workout time for its clients is longer than the current 30 minute circuit. _____ = ____________________________________________________________________________ H0: ________ HA: _________ _________________________ 4. It has been estimated that nationally, 16% of US residents lack health insurance coverage. Suppose that a city wanted to determine whether the percent of city residents without health insurance is different from the national percent. _____ = ____________________________________________________________________________ H0: ________ HA: _________ _________________________ 5. The Center for Disease Control reports that only 14% of California adults smoke. A study is conducted to determine if the percent of De Anza college students who smoke is higher than that. _____ = ____________________________________________________________________________ H0: ________ HA: _________ _________________________ 6. The average price of a cup of coffee in the airport is at least $2.50 _____ = ____________________________________________________________________________ H0: ________ HA: _________ _________________________ 7. The average amount of time that students do statistics homework each night is 2 hours. _____ = ____________________________________________________________________________ H0: ________ HA: _________ _________________________ 8. At most half of all customers at Ace Auto Repair drive foreign cars. _____ = ____________________________________________________________________________ H0: ________ HA: _________ _________________________ Page 2 PROCEDURE FOR FORMULATING HYPOTHESES: Read problem carefully: Is the parameter a MEAN or a PROPORTION? Hypotheses always refer to the population parameter p or (never the sample statistic) Describe the parameter, p or , being tested in a sentence that starts p = description or = description Write both null hypothesis Ho and alternate hypothesis Ha using mathematical symbolss. Ho Null Hypothesis Contains equality of some type ≤ or = or = = Ha Alternate Hypothesis Contains strict inequality only > < One tailed test to the right One tailed test to the left Two tailed test Hypothesis Tests: Correct Decisions and Errors in Decisions In a hypothesis test, we decide about the hypothesesbased on the strength of evidence in the sample data. The sample data may lead us to make a correct decision or sometimes make a wrong decision. We want to make decisions in a way that minimizes the chance of making a wrong decision. IN REALITY: Null Hypothesis is TRUE DECISION: Based on sample data we DECIDE NOT TO REJECT null hypothesis (Data favors null hyothesis) Based on sample data we DECIDE TO REJECT null hypothesis (Data favors alternate hyothesis) Correct Decision Type I Error: Wrong Decision Acceptable probability (risk) is is called significance level Null Hypothesis is FALSE Alternate Hypothesis is true Type II Error: Wrong Decision Probability is Correct Decision Probability is 1 − 1 − is called the power Type I Error: Rejecting the null hypothesis when in reality the null hypothesis is true concluding (based on sample data) in favor of the alternate hypothesis when in reality the null hypothesis is true The probability you are willing to risk of making a Type I error is denoted by (Greek letter alpha). is called the (pre-determined) significance level of the hypothesis test. The significance level should be small: a low risk of incorrectly rejecting the null hypothesis if it is really true Type II Error: Failing to reject the null hypothesis when in reality the null hypothesis is false concluding (based on sample data) in favor of the null hypothesis when in reality the alternate hypothesis is true The probability of Type II error is denoted by (Greek letter beta). 1 − is called the power of the hypothesis test. The power of a hypothesis test should be large: large probability of correctly rejecting a false null hypothesis A Court Trial is a real-life example of a hypothesis test: Null Hypothesis: Not Guilty: A person is assumed to be innocent Alternate Hypothesis: Guilty: A person must be proven guilty beyond a reasonable doubt IN REALITY: DECISION: Based on evidence presented in court jury decides NOT GUILTY Based on evidence presented in court jury decides GUILTY Null Hypothesis is TRUE Person is NOT GUILTY Correct Decision Wrong Decision Type I Error Null Hypothesis is FALSE Person is GUILTY Wrong Decision Type II Error Correct Decision Page 3 Example A: (see page 1 for the statement of this problem) p = true population proportion of all people with this knee injury who would be cured if they had this knee surgery Ho: p .60 Ha: p > .60 A Type I error would be to conclude that this surgery cures more than 60% of all knee injuries of this type, when in reality it cures 60% or fewer of all such injuries. A Type II error would be to conclude that this surgery cures at most 60% of all knee injuries of this type, when in reality it cures more than 60%of all such injuries. Some of the examples on page 2 will be used in class to interpret errors; Catalyst website has a link to all answers. Example #____: A Type I Error is concluding that_________________________________________________________ when in reality_______________________________________________________________________ A Type II Error is concluding that________________________________________________________ when in reality_______________________________________________________________________ Example #____: A Type I Error is concluding that_________________________________________________________ when in reality_______________________________________________________________________ A Type II Error is concluding that________________________________________________________ when in reality_______________________________________________________________________ Example #____: A Type I Error is concluding that_________________________________________________________ when in reality_______________________________________________________________________ A Type II Error is concluding that________________________________________________________ when in reality_______________________________________________________________________ Example #____: A Type I Error is concluding that_________________________________________________________ when in reality_______________________________________________________________________ A Type II Error is concluding that________________________________________________________ when in reality_______________________________________________________________________ Guidelines: The interpretation should clearly indicate the conclusion (we conclude, we decide, we believe) and should indicate what is true in reality Each part of the interpretation should be stated in context of the problem. The decision and reality should NOT agree – otherwise it’s a good decision and not an error Each part of the interpretation should clearly and accurately state a hypothesis (Ho or Ha) in words. Be careful to reflect equalities and inequalities accurately in your sentences Page 4 Rare Events We have an assumption about a property of a population. We select a sample. Suppose our sample data has properties that are extremely unlikely to occur if the population actually has the properties we assumed. We would then conclude that the assumption is not correct. Suppose our sample data has properties that are reasonably likely to occur if the population actually has the properties we assumed. This would not give us any reason to doubt the assumption. Example A: A hospital is testing a new surgery for a type of knee injury The surgery review board has decided that they will approve this surgery for future use if a clinical trial shows that the true population cure rate for this surgery would be more than 60%. Otherwise they will not approve it. Population parameter: p = true population cure rate for this surgery Random Variable: P ' = cure rate for a sample of patients having this surgery Ho: p .60 Ha: p > .60 Suppose the new surgery is tested on 200 patients. Suppose the sample proportion of people who are cured is p'=0.90, a 90% cure rate. What does this seem to indicate about Ho and Ha? Explain: _________________________________________________________________________________________ _________________________________________________________________________________________ _________________________________________________________________________________________ Suppose the sample proportion of people who are cured is p'=0.46, a 46% cure rate. What does this seem to indicate about Ho and Ha? Explain: _________________________________________________________________________________________ _________________________________________________________________________________________ _________________________________________________________________________________________ Suppose the sample proportion of people who are cured is p'=0.605, a 60.5% cure rate. What does this seem to indicate about Ho and Ha? Explain: _________________________________________________________________________________________ _________________________________________________________________________________________ _________________________________________________________________________________________ What if p' = 0.62 or 0.65 or 0.70 or 0.75? Where do we draw the line between "far" and "close"? How far away from the null hypothesis should the sample statistic be in order to reject the null hypothesis and assume the alternate hypothesis is true? We use probability calculations to determine where to draw the "dividing line" to decide if a sample statistic is close to or far from the null hypothesis. Find the probability of getting a sample that "looks like ours" if the null hypothesis is true. If that probability is small, it indicates that our sample is not consistent with the null hypothesis (that our sample value is considered “far from” the hypothesized value). It would be strong evidence in support of the alternate hypothesis, leading us to reject the null hypothesis. If that probability is large, it indicates that our sample is reasonably likely to occur if the null hypothesis is true, so does not lead us to reject the null hypothesis Page 5 Example A: A hospital is testing a new surgery for a type of knee injury The surgery review board has decided that they will approve this surgery for future use if a clinical trial shows that the true population cure rate for this surgery would be more than 60%. Otherwise they will not approve it. Population parameter: p = true population cure rate for this surgery Random Variable: P ' = cure rate for a sample of patients having this surgery Ho: p .60 Ha: p > .60 Suppose that in a sample of 200 patients having this surgery, 130 of them are cured: p' = 130/200 = 0.65 Is p' = .65 close to or far from the null hypothesis that p = .60 ? If sample proportion p' = 0.65 is "close to" (consistent with) the hypothesized proportion 0.60 in Ho, then we will not be able to conclude that the surgery is effective. If sample proportion p' = 0.65 is "far from" (not consistent) the hypothesized proportion 0.60 in Ho, then we will conclude that the surgery is effective. Find the probability of getting a sample that "looks like ours" if the null hypothesis is true. If that probability is small, it indicates that our sample is not consistent with the null hypothesis, but is strong evidence in support of the alternate hypothesis, leading us to reject the null hypothesis. Criteria for "what is a small probability?" The significance level is our criteria for "what is a small probability?" It is the risk we are willing to accept of making a Type I error if we reject the null hypothesis. A Type I Error would be to decide to approve the surgery, believing it's cure rate is more than 60%, (p > .60) if in reality surgery is not effective, having a cure rate that is not more than 60% ( p ≤ .60) What risk of making a Type I error are we willing to accept for this situation?_____________ Calculate the probability of getting a sample at least as far from the null hypothesis as our sample is. This is called the p value. Since our alternate hypothesis says >, we use the right tail of the distribution If Ho is true, our random variable P ' ~ ____ ( _____ , ___________ ) P(p'≥.65 if p=.60) P(p'≥.65 | p=.60) = ____________________________________________ is another symbol used for the sample proportion 1-PropZTest on our calculator uses rather than p' Compare p value to signficiance level : Is the p value smaller than the significance level? _______ Decision: ______________________________________ Conclusion: ______________________________________________________________________________ ______________________________________________________________________________________________ ______________________________________________________________________________________________ ______________________________________________________________________________________________ DECISION RULE: If p value < , REJECT Ho If p value ≥ , DO NOT REJECT Ho At a (state as %) level of significance, the sample data DO / DO NOT provide strong enough evidence to conclude that (state in words what the alternate hypothesis says in context of the problem) CONCLUSION: TRY IT: Suppose in a sample of 200 patients having this surgery, 138 of them are cured: p' = 138/200 = 0.69 Does a hypothesis test support adopting the new surgery? Page 6 Take notes in class on a Chapter 9 Solution Sheet as we do some of these examples in class. EXAMPLE C: Hypothesis Test of Population Mean when Population Standard Deviation is KNOWN A truck manufacturer company sells Model XDV delivery vans to package delivery services. From detailed records, the management knows that the average fuel efficiency for these vans is 19.8 miles per gallon (mpg) with standard deviation 2.9 miles per gallon. Recently they redesigned an engine part and believe that this redesign will increase fuel efficiency, on average. The engineering team believes that the known population standard deviation for fuel efficiency of 2.9 miles per gallon will continue to apply to the new engine design. A sample of 36 vans with the redesigned engine part has an average fuel efficiency of 21.2 mpg. 20.1 24.6 18.1 15.7 24.8 25.1 24.5 21.5 26.9 13.8 19.9 22.2 20.7 16.6 24.7 24.2 21.7 20.1 22.4 17.7 20.5 22.2 20.5 23.4 24.5 21.1 18.3 18.4 22.2 21.2 21.1 19.9 18.9 19.4 23.1 23.5 At a 5% level of significance, perform a hypothesis test to determine if the redesigned engine part is effective in increasing the average fuel efficiency. EXAMPLE D: Hypothesis Test of Population Mean when Population Standard Deviation is NOT KNOWN OptiFiber Network advertises that their fiber optic network delivers internet service at coneection speeds up to 450 mb per second with an average speed of 300 mb per second. Their main competitor CableNet claims that internet service from OptiFiber is not advertising truthfully and that their average connection speed is slower than 300 mb per second. If CableNet can prove that, they will file a lawsuit against OptiFiber for false and misleading advertising; otherwise their lawyers tell them they will not be able to win the lawsuit. CableNet selects a sample of 16 different internet connections on OptiFiber’s network and measures the speed of each connection in the sample. For the sample, the average speed is 280 mb per second with standard deviation is 64 mb per second. Does CableNet have sufficient evidence in its sample data to support its claim that OptiFiber’s average connection speed is less than 300 mb per second? Use a 5% significance level. 228 337 Sample data: internet connection speeds in mb per second n = 16 261 397 200 359 326 224 233 311 211 215 251 367 241 319 (Assume that the underlying population for the speeds of individual internet connections is approximately normally distributed.) EXAMPLE E: Hypothesis Test of Population Mean when Population Standard Deviation is NOT KNOWN At Dina's Dress shop, customers complain that fashion designers assume that all women are tall when they design clothes. Dina read that the designers whose clothes she carries tend to design for women who are 5 feet 6 inches (66 inches) tall. Because of her customers comments, Dina wants to determine whether the average height of her customers is shorter. A random sample of 25 customers has an average height of 64 inches with standard deviation 2.7 inches. (Assume that the population of individual customer heights is approximately normally distributed.) Perform a hypothesis test to determine if the average height of all Dina's customers is less than 66 inches. Use a 2% level of significance NOTE: Then find a confidence interval to estimate the true average height of all Dina's customers, so that she will be able to decide which designers to buy dresses from for the shop. Page 7 EXAMPLE F: Hypothesis Test of Population Proportion p A city government wants to determine if the number of parking spaces required per household for residentially zoned neighborhoods is still appropriate. Several year ago they based their current regulations on the assumption that 28% of households are “car-free; now they want to check that assumption to see if the percent of households that are car free has changed. The conduct a survey of 1200 households; they discover that 372 are “car-free”. At a 3% significance level, can they conclude that the percent of households that are car free differs from their assumption of 28%? EXAMPLE G: Hypothesis Test of Population Proportion p The owners of Ace Auto Repair believe that at most half of all their customers drive foreign cars. One of their mechanics is taking a Math 10 class and does a hypothesis test as his student project. He selects a random sample of 50 cars brought in for repair and finds that 21 of them are foreign cars. At a 5% level of significance, perform the hypothesis test. EXAMPLE H: A package for a medication states that this drug contains a dosage of 250 mg per pill. A lab is quality testing the drug to determine if it contains the correct amount of drug on average. A sample of 50 pills has an average dosage of 232 mg with standard deviation 25 mg. At a 2% level of significance, perform the hypothesis test. (Assume the underlying population of amount of drug in individual pills is approximately normally distributed.) EXAMPLE I: The management of SuperSave Grocery Mart is consider adopting Apple Pay. It would require some investment; they will do this only if they strongly believe that more than 10% of their customers would use Apple Pay if available. They survey 300 customers; 42 customers state they would use Apple Pay. Perform a hypothesis test to determine whether SuperSave Grocery Mart should invest in adopting Apple Pay. EXAMPLE J: The management of SuperSave Grocery Mart is consider adopting Apple Pay. It would require some investment; they will do this only if they strongly believe that more than 10% of their customers would use Apple Pay if available. They survey 300 customers; 36 customers (12%) state they would use Apple Pay. Perform a hypothesis test to determine whether the sample data provide sufficient evidence for SuperSave Grocery Mart to invest in adopting Apple Pay. Page 8 EXAMPLE K: Online Shoes claims that the average delivery time for a package with standard shipping is 5 days. It has recently changed the shipping company it uses and management wants to determine if the standard shipping time has changed. Shipping records for packages recently shipped with the new company are examined for a sample of 30 packages. For the sample of 30 packages, the average shipping time is 5.2 days with standard deviation of 0.6 days. Do the sample data provide sufficient evidence to conclude that the average shipping time for all packages with the new shipping company is different from 5 days? (Assume the underlying population of shipping times for individual packages is approximately normally distributed.) EXAMPLE L: Does the label “GLUTEN FREE” guarantee that a food has absolutely NO gluten? The New York Times on 5/20/2015 published an article titled “Study Finds that Probiotics Labelled Gluten Free Often Aren’t”. It reported that FDA guidelines state a product must contain less than 20 parts per million of gluten to qualify as gluten free. They reported that some products exceed that but claim to be gluten free, but also noted that some products containing gluten may legally qualify as gluten free. Dr. P.H.R. Green of the Celiac Disease Center, Coumbia University, was quoted that some people “may be much more sensitive to even less than 20 parts per million”. Suppose that a product claiming to be gluten free was tested and that in a sample of 7 batches of this product the gluten levels in parts per million were: 9 20 14 22 14 12 15 Perform a hypothesis test to determine if the average gluten content is less than 20 parts per million so that the manufacturer can support its claim that the product can be represented as gluten free. Perform a hypothesis test to determine if the average gluten content is less than 20 parts per million so that the manufacturer can support its claim that the product can be represented as gluten free. Use a 3% level of significance. (Assume the underlying population of gluten content in individual batches of in this product is approximately normally distributed.) Page 9