Hypothesis Testing PDF
Document Details
Uploaded by IntegralTriumph2926
Tags
Summary
This document provides an introduction to hypothesis testing, a statistical method for making decisions by controlling the probability of errors. It covers formulating hypotheses, calculating test statistics (z- and t-tests), determining rejection regions, and interpreting results. It also discusses different types of errors and their probabilities.
Full Transcript
Introduction to Hypothesis Testing Chapter Goals After completing this chapter, you should be able to: Formulate null and alternative hypotheses for applications involving a single population mean or proportion Formulate a decision rule for testing a hypot...
Introduction to Hypothesis Testing Chapter Goals After completing this chapter, you should be able to: Formulate null and alternative hypotheses for applications involving a single population mean or proportion Formulate a decision rule for testing a hypothesis Know how to use the test statistic, critical value, and p-value approaches to test the null hypothesis Know what Type I and Type II errors are Compute the probability of a Type II error Hypothesis Testing In hypothesis testing, we make a hypothesis (or statement) concerning a population parameter. We then use sample data to either deny or confirm the validity of the proposed hypothesis. Hypothesis Testing Hypothesis Testing Statistical hypothesis testing provides a structured analytical method for making decisions while controlling (or at least quantifying) the probability of decision errors What is a Statistical Hypothesis? A claim (assumption) about a population parameter: Population mean Example: The mean monthly cell phone bill of this city is = $42 Population proportion Example: The proportion of adults in this city with cell phones is p =.68 The Null Hypothesis, H0 States the assumption (numerical) to be tested Example: The average number of TV sets in U.S. Homes is at least three ( H0 : μ 3 ) Is always about a population parameter, not about a sample statistic H0 : μ 3 H0 : x 3 The Null Hypothesis, (continued) Begin with the assumption that the null hypothesis is true Similar to the notion of innocent until proven guilty Refers to the status quo Always contains “=” , “≤” or “” sign May or may not be rejected If is true, then any discrepancy between the observed data and the hypothesis is due only to chance variation The Alternative Hypothesis, H1 or HA Is the opposite of the null hypothesis e.g.: The average number of TV sets in U.S. homes is less than 3 ( HA: < 3 ) Challenges the status quo Never contains the “=” , “≤” or “” sign May or may not be accepted Is generally the hypothesis about new beliefs which needs to be supported by the researcher Discrepancy between observed data and the null hypothesis is not due to chance variation Statistical Hypothesis Testing The goal of the statistical hypothesis test is to try to Reject the Null Hypothesis, which states there's no observable change Hypothesis Testing Process Claim: the population mean age is 50. (Null Hypothesis: Population H0: = 50 ) Now select a random sample Is x = 20 likely if = 50? If not likely, Suppose We get a REJECT sample mean Sample Null Hypothesis age of 20 Reason for Rejecting H0 Sampling Distribution of x x 20 = 50 If H0 is true If it is unlikely that... then we we would get a reject the null sample mean of... if in fact this were hypothesis that this value... the population mean… = 50. Level of Significance, Defines unlikely values of sample statistic if null hypothesis is true Defines rejection region of the sampling distribution Is designated by , (level of significance) Typical values are.01,.05, or.10 Is selected by the researcher at the beginning Provides the critical value(s) of the test Level of Significance and the Rejection Region Level of significance = a Represents critical value H0: μ ≥ 3 a Rejection HA: μ < 3 Lower tail test 0 region is shaded H0: μ ≤ 3 a HA: μ > 3 Upper tail test 0 H0: μ = 3 a/2 a/2 HA: μ ≠ 3 Two tailed test 0 Critical Value Approach to Testing Convert sample statistic (e.g.: or ) to the corresponding test statistic ( z or t statistic ) Determine the critical value(s) for a specified level of significance from a table or computer If the test statistic falls in the rejection region, reject H0 ; otherwise do not reject H0 Lower Tail Tests H0: μ ≥ 3 The cutoff value, -zα or xα , is called a HA: μ < 3 critical value a Reject H0 Do not reject H0 -zα 0 xα μ σ x μ z n Upper Tail Tests H0: μ ≤ 3 The cutoff value, zα or xα , is called a HA: μ > 3 critical value a Do not reject H0 Reject H0 0 zα μ xα σ x μ z n Two Tailed Tests There are two cutoff H0: μ = 3 values (critical values): HA: μ ¹ ± zα/2 3 or /2 /2 xα/2 Lower Reject H0 Do not reject H0 Reject H0 xα/2 -zα/2 0 zα/2 Upper μ0 xα/2 xα/2 Lower Upper σ x /2 μ z /2 n Critical Value Approach to Testing Convert sample statistic ( x ) to a test statistic ( Z or t statistic ) Hypothesis Tests for Known Unknown Large Small Samples Samples Calculating the Test Statistic Hypothesis Tests for Known Unknown The test statistic is: Large Small x μ z Samples Samples σ n Calculating the Test Statistic (continued) Hypothesis Tests for Known Unknown The test statistic is: But is sometimes approximated Large Small x μ using a z: t nt 1 x μ Samples Samples s z sσ n n Calculating the Test Statistic (continued) Hypothesis Tests for Known Unknown The test statistic is: Large Small x μ t nt 1 Samples Samples s n (The population must be approximately normal) Review: Steps in Hypothesis Testing 1. Specify the population value of interest 2. Formulate the appropriate null and alternative hypotheses 3. Specify the desired level of significance 4. Determine the rejection region 5. Obtain sample evidence and compute the test statistic 6. Reach a decision and interpret the result Hypothesis Testing Example Test the claim that the true mean # of TV sets in US homes is at least 3. (Assume σ = 0.8) 1. Specify the population value of interest The mean number of TVs in US homes 2. Formulate the appropriate null and alternative hypotheses H : μ 3 HA: μ < 3 (This is a lower tail test) 0 3. Specify the desired level of significance Suppose that =.05 is chosen for this test (typically given) Hypothesis Testing Example (continued) 4. Determine the rejection region =.05 Reject H0 Do not reject H0 -zα= -1.645 0 This is a one-tailed test with =.05. Since σ is known, the cutoff value is a z value: Reject H0 if z < z = -1.645 ; otherwise do not reject H0 Hypothesis Testing Example 5. Obtain sample evidence and compute the test statistic Suppose a sample is taken with the following results: n = 100, x = 2.84 ( = 0.8 is assumed known) Then the test statistic is: x μ 2.84 3 .16 z 2.0 σ 0.8.08 n 100 Hypothesis Testing Example (continued) 6. Reach a decision and interpret the result =.05 z Reject H0 Do not reject H0 -1.645 0 -2.0 Since z = -2.0 < -1.645, we reject the null hypothesis (that the mean number of TVs in US homes is at least 3) Conclude: true mean # of TV sets in US homes is less than 3. Hypothesis Testing Example (continued) An alternate way of constructing rejection region using : Now expressed in units instead of units =.05 x Reject H0 Do not reject H0 2.8684 3 2.84 σ 0.8 x α μ z α 3 1.645 2.8684 Since x = 2.84 < 2.8684, n 100 we reject the null hypothesis Conclude: true mean # of TV sets in US homes is less than 3. p-Value Approach to Testing p-value: Probability of obtaining a test statistic more extreme ( ≤ or ) than the observed sample value given H0 is true Probability of how likely an observed result is due to chance Also called observed level of significance Smallest value of for which H0 can be rejected p-Value Approach to Testing (continued ) Convert Sample Statistic (e.g. x ) to Test Statistic ( Z or t statistic ) Obtain the p-value from a table or computer Compare the p-value with If p-value < , reject H0 If p-value , do not reject H0 p-value example Example: How likely is it to see a sample mean of 2.84 (or something further below the mean) if the true mean is = 3.0? =.05 P( x 2.84 | μ 3.0) p-value =.0228 2.84 3.0 P z 0.8 x 100 2.8684 3 P(z 2.0) .0228 2.84 p-value example (continued) Compare the p-value with If p-value < , reject H0 If p-value , do not reject H0 =.05 Here: p-value =.0228 p-value =.0228 =.05 Since.0228 <.05, we reject the null hypothesis 2.8684 3 2.84 Example: Find Rejection Region (continued) Suppose that =.10 is chosen for this test Find the rejection region: Reject H0 =.10 Do not reject H0 Reject H0 0 Review: Finding Critical Value - One Tail Standard Normal What is z given a = Distribution Table (Portion) 0.10?.90.10 Z.07.08.09 a =.10 1.1.3790.3810.3830.50.40 1.2.3980.3997.4015 z 0 1.28 1.3.4147.4162.4177 Critical Value = 1.28 Example: Find Rejection Region (continued) Suppose that =.10 is chosen for this test Find the rejection region: Reject H0 =.10 Do not reject H0 Reject H0 0 zα=1.28 Reject H0 if z > 1.28 Example: Test Statistic (continued) Obtain sample evidence and compute the test statistic Suppose a sample is taken with the following results: n = 64, x = 53.1 ( = 10 known) Then the test statistic is: x μ 53.1 52 z 0.88 σ 10 n 64 Example: Decision (continued) Reach a decision and interpret the result: Reject H0 =.10 Do not reject H0 Reject H0 0 1.28 z =.88 Do not reject H0 since z = 0.88 ≤ 1.28 i.e.: there is not sufficient evidence that the mean bill is over $52 p -Value Solution (continued) Calculate the p-value and compare to p-value =.1894 P( x 53.1 | μ 52.0) Reject H0 =.10 53.1 52.0 P z 10 0 64 Do not reject H0 Reject H0 1.28 P(z 0.88) .5 .3106 z =.88 .1894 Do not reject H0 since p-value =.1894 > =.10 Example: Two-Tail Test ( Unknown) The average cost of a hotel room in New York is said to be $168 per night. A random sample of 25 hotels resulted in x = $172.50 and H0: μ = 168 s = $15.40. Test at the HA: μ ¹ = 0.05 level. 168 (Assume the population distribution is normal) Example Solution: Two-Tail Test H0: μ = 168 a/2=.025 a/2=.025 HA: μ ¹ 168 a = 0.05 Reject H0 Do not reject H0 Reject H0 -tα/2 0 tα/2 n = 25 -2.0639 2.0639 1.46 Critical Value: x μ 172.50 168 t n t 1 1.46 s 15.40 t24 = ± 2.0639 n 25 is unknown, Do not reject H0: not sufficient evidence use a t statistic that true mean cost is different than $168 Hypothesis Tests for Proportions Involves categorical values Two possible outcomes “Success” (possesses a certain characteristic) “Failure” (does not possesses that characteristic) Fraction or proportion of population in the “success” category is denoted by p Proportions - Review (continued) Sample proportion in the success category is denoted by p x number of successes in sample p n sample size When both np and n(1-p) are at least 5, can be approximated by a normal distribution with mean and standard deviation μP p p(1 p) σp n Hypothesis Tests for Proportions The sampling distribution of p is Hypothesis normal, so the test Tests for p statistic is a z value: np 5 np < 5 and or p p z n(1-p) 5 n(1-p) < 5 p(1 p) Not discussed n in this chapter Example: z Test for Proportion A marketing company claims that it receives 8% responses from its mailing. To test this claim, a random sample of 500 were surveyed Check: with 25 responses. Test n p = (500)(.08) = 40 at the =.05 significance n(1-p) = (500)(.92) = 460 level. Z Test for Proportion: Solution Test Statistic: H0: p =.08 p p.05 .08 HA: p z 2.47 p(1 p).08(1 .08) a¹ =.08.05 n = 500, p =.05 n 500 Critical Values: ± 1.96 Decision: Reject Reject Reject H0 at =.05 Conclusion:.025.025 There is sufficient -1.96 0 1.96 z evidence to reject the -2.47 company’s claim of 8% response rate. p -Value Solution (continued) Calculate the p-value and compare to (For a two sided test the p-value is always two sided) Do not reject H0 Reject H0 Reject H0 p-value =.0136: /2 =.025 /2 =.025 P(z 2.47) P(z 2.47).0068.0068 2(.5 .4932) 2(.0068) 0.0136 -1.96 0 1.96 z = -2.47 z = 2.47 Reject H0 since p-value =.0136 < =.05 Errors in Making Decisions Type I Error (false positive) Reject a true null hypothesis Considered a serious type of error The probability of Type I Error is Called level of significance of the test Set by researcher in advance Errors in Making Decisions (continued) Type II Error (false negative) Fail to reject a false null hypothesis The probability of Type II Error is β Errors in Making Decisions Example: Mistakes in the Justice System : the defendant is innocent : the defendant is guilty We require evidence to reject the null hypothesis (convict the defendant) What are Type I and Type II Errors? Type I error: Reject when it is true An innocent person goes to jail Type II error: Fail to reject when it is false A guilty person is set free Outcomes and Probabilities An innocent person is set free A guilty person is set free State of Nature (Reality) Decision H0 True H0 False Do Not No Error Type II Error Reject () (β) H0 Reject Type I Error No Error Power of H0 () ( the test An innocent person goes to jail A guilty person goes to jail Outcomes and Probabilities (continued) A guilty person 𝐻0 𝐻𝐴 goes to jail A guilty person is set free Power: Power: False False Rjected Rjected Type II Error: ()() False Not rejected Type I Error: () True Rejected 𝜷 () Do not reject Reject An innocent Critical person goes to jail Value Type I & II Error Relationship Type I and Type II errors cannot happen at the same time Type I error can only occur if H0 is true Type II error can only occur if H0 is false If Type I error probability ( ) , then Type II error probability ( β ) See: http://shiny.stat.tamu.edu:3838/eykolo/power/ Type I & II Error Relationship Type I and Type II errors cannot happen at the same time Type I error can only occur if H0 is true Type II error can only occur if H0 is false If Type I error probability ( ) , then Type II error probability ( β ) http://jpiccirillo.com/PowerApplet/powerapplet.html Factors Affecting Type II Error All else equal, β when the difference between hypothesized parameter and its true value β when β when σ β when n Factors Affecting Type II Error 𝜇 0=2𝜇 𝐴=3.5 𝜇 0=2𝜇 𝐴=3.5 Similarly 𝜎 =1.5 𝝈=𝟏 n 𝛼=0.025 𝛼=0.025 𝜇 0=2𝜇 𝐴=3.5 𝝁 𝑨 =𝟑 𝜇 0=2 𝜎 =1.5 𝜎 =1.5 𝜶=𝟎. 𝟎𝟓 𝛼=0.025 𝜶↑ 𝜷↓ ( 𝝁𝟎 − 𝝁 𝑨 ) ↓ 𝜷 ↑ Example: find the Probability of Type II Error Westberg has developed a new energy- saving light bulb to last more than 700 hours on average. What is , if the true value of is 701 hours? ( hours and , ) Average life span of light bulbs WK 56 Example: find the Probability of Type II Error 𝛼=0.05 ⇒ 𝑧 0.05 =1.645 1. Find the corresponding critical value Hypothesized distribution 2. Decision rule: If > 702.468 reject Otherwise don’t reject Do Not reject Reject Type II error is the probability of failing to reject a false H0 | 𝜇=700 𝑥0.05 =702.468 Do Not reject Reject ( | ) 𝒙 𝟎. 𝟎𝟓 − 𝝁 𝜷= 𝑷 𝐳 ≤ 𝝁 =𝟕𝟎𝟏 𝝈 √𝒏 ( ) 𝟕𝟎𝟐. 𝟒𝟔𝟖 − 𝟕𝟎𝟏 𝜷= 𝑷 𝐳 ≤ 𝟏𝟓 √𝟏𝟎𝟎 𝜇=701 𝑥0.05 =702.468 0 𝑧=0.98 Chapter Summary Addressed hypothesis testing methodology Performed z Test for the mean (σ known) Discussed p–value approach to hypothesis testing Performed one-tail and two-tail tests... Chapter Summary (continued) Performed t test for the mean (σ unknown) Performed z test for the proportion Discussed type II error and computed its probability