2 Chapter Goals After completing this chapter, you should be able to: Formulate null and alternative hypotheses for applications involving a single population mean or proportionFormulate a decision rule for testing a hypothesisKnow how to use the test statistic, critical value, and p-value approaches to test the null hypothesisKnow what Type I and Type II errors areCompute the probability of a Type II error.
3 What is a Hypothesis? A hypothesis is a claim (assumption) about a population parameter:population meanpopulation proportionExample: The mean monthly cell phone bill of this city is = $42Example: The proportion of adults in this city with cell phones is p = .68.
4 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 ( )Is always about a population parameter, not about a sample statistic.
5 The Null Hypothesis, H0(continued)Begin with the assumption that the null hypothesis is trueSimilar to the notion of innocent until proven guiltyRefers to the status quoAlways contains “=” , “≤” or “” signMay or may not be rejected.
6 The Alternative Hypothesis, HA Is the opposite of the null hypothesise.g.: The average number of TV sets in U.S. homes is less than 3 ( HA: < 3 )Challenges the status quoNever contains the “=” , “≤” or “” signMay or may not be acceptedIs generally the hypothesis that is believed (or needs to be supported) by the researcher.
7 Hypothesis Testing Process Claim: thepopulationmean age is 50.(Null Hypothesis:PopulationH0: = 50 )Now select a random samplexIs=20likely if = 50?Supposethe sampleIf not likely,REJECTmean ageis 20: x = 20SampleNull Hypothesis.
8 ... then we reject the null hypothesis that = 50. Reason for Rejecting H0Sampling Distribution of xx20 = 50If H0 is true... then we reject the null hypothesis that = 50.If it is unlikely that we would get a sample mean of this value ...... if in fact this were the population mean….
9 Level of Significance, Defines unlikely values of sample statistic if null hypothesis is trueDefines rejection region of the sampling distributionIs designated by , (level of significance)Typical values are .01, .05, or .10Is selected by the researcher at the beginningProvides the critical value(s) of the test.
10 Level of Significance and the Rejection Region Representscritical valueH0: μ ≥ 3 HA: μ < 3aRejection region is shadedLower tail testH0: μ ≤ 3 HA: μ > 3aUpper tail testH0: μ = 3 HA: μ ≠ 3aa/2/2Two tailed test.
11 Errors in Making Decisions Type I ErrorReject a true null hypothesisConsidered a serious type of errorThe probability of Type I Error is Called level of significance of the testSet by researcher in advance.
12 Errors in Making Decisions (continued)Type II ErrorFail to reject a false null hypothesisThe probability of Type II Error is β.
13 Outcomes and Probabilities Possible Hypothesis Test OutcomesState of NatureDecisionH0 TrueH0 FalseDo NotNo error( )Type II Error( β )RejectKey:Outcome(Probability)aHRejectType I Error( )No Error( 1 - β )Ha.
14 Type I & II Error Relationship Type I and Type II errors can not happen atthe same timeType I error can only occur if H0 is trueType II error can only occur if H0 is falseIf Type I error probability ( ) , thenType II error probability ( β ).
15 Factors Affecting Type II Error All else equal,β when the difference between hypothesized parameter and its true valueβ when β when σβ when n.
16 Critical Value Approach to Testing Convert sample statistic (e.g.: ) to test statistic ( Z or t statistic )Determine the critical value(s) for a specified level of significance from a table or computerIf the test statistic falls in the rejection region, reject H0 ; otherwise do not reject H0.
17 Lower Tail Tests a H0: μ ≥ 3 HA: μ < 3 The cutoff value, or , is called a critical value-zαxαaReject H0Do not reject H0-zαxαμ.
18 Upper Tail Tests a H0: μ ≤ 3 HA: μ > 3 zα xα The cutoff value, or , is called a critical valuezαxαaDo not reject H0Reject H0zαμxα.
19 Two Tailed Tests /2 /2 H0: μ = 3 HA: μ ¹ 3 ± zα/2 xα/2 xα/2 There are two cutoff values (critical values):or± zα/2/2/2xα/2LowerUpperReject H0Do not reject H0Reject H0xα/2-zα/2zα/2μ0xα/2xα/2LowerUpper.
20 Critical Value Approach to Testing Convert sample statistic ( ) to a test statistic( Z or t statistic )xHypothesisTests for Known Unknown.
21 Calculating the Test Statistic HypothesisTests for μ Known UnknownThe test statistic is:.
22 Calculating the Test Statistic (continued)HypothesisTests for Known UnknownThe test statistic is:But is sometimes approximated using a z:Working WithLarge Samples.
23 Calculating the Test Statistic (continued)HypothesisTests for Known UnknownThe test statistic is:UsingSmallSamples(The population must be approximately normal).
24 Review: Steps in Hypothesis Testing 1. Specify the population value of interest2. Formulate the appropriate null and alternative hypotheses3. Specify the desired level of significance4. Determine the rejection region5. Obtain sample evidence and compute the test statistic6. Reach a decision and interpret the result.
25 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 interestThe mean number of TVs in US homes2. Formulate the appropriate null and alternative hypothesesH0: μ HA: μ < 3 (This is a lower tail test)3. Specify the desired level of significanceSuppose that = .05 is chosen for this test.
26 Hypothesis Testing Example (continued)4. Determine the rejection region = .05Reject H0Do not reject H0-zα=This is a one-tailed test with = .05.Since σ is known, the cutoff value is a z value:Reject H0 if z < z = ; otherwise do not reject H0.
27 Hypothesis Testing Example 5. Obtain sample evidence and compute the test statisticSuppose a sample is taken with the following results: n = 100, x = ( = 0.8 is assumed known)Then the test statistic is:.
28 Hypothesis Testing Example (continued)6. Reach a decision and interpret the result = .05zReject H0Do not reject H0-1.645-2.0Since z = -2.0 < , we reject the null hypothesis that the mean number of TVs in US homes is at least 3.
29 Hypothesis Testing Example (continued)An alternate way of constructing rejection region:Now expressed in x, not z units = .05xReject H0Do not reject H02.868432.84Since x = 2.84 < , we reject the null hypothesis.
30 p-Value Approach to Testing Convert Sample Statistic (e.g. ) to Test Statistic ( z or t statistic )Obtain the p-value from a table or computerCompare the p-value with If p-value < , reject H0If p-value , do not reject H0x.
31 p-Value Approach to Testing (continued)p-value: Probability of obtaining a test statistic more extreme ( ≤ or ) than the observed sample value given H0 is trueAlso called observed level of significanceSmallest value of for which H0 can be rejected.
32 p-value exampleExample: 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? n=100, sigma=0.8 = .05p-value =.0228x2.868432.84.
33 Computing p value in RR has a function called pnorm which computes the area under the standard normal distribution z~N(0,1). If we give it the z value, the function pnrom in R computes the entire area from negative infinity to that z. For examples:> pnorm(-2)pnorm(0) # is 0.5.
34 p-value example Compare the p-value with (continued)Compare the p-value with If p-value < , reject H0If p-value , do not reject H0 = .05Here: p-value = .0228 = .05Since < .05, we reject the null hypothesisp-value =.02282.868432.84.
35 Example: Upper Tail z Test for Mean ( Known) A phone industry manager thinks that customer monthly cell phone bill have increased, and now average over $52 per month. The company wishes to test this claim. (Assume = 10 is known)Form hypothesis test:H0: μ ≤ the average is not over $52 per monthHA: μ > the average is greater than $52 per month(i.e., sufficient evidence exists to support themanager’s claim).
36 Example: Find Rejection Region (continued)Suppose that = .10 is chosen for this testFind the rejection region:Reject H0 = .10Do not reject H0Reject H0zα=1.28Reject H0 if z > 1.28.
37 Finding rejection region in R Rejection region is defined from a dividing line between accept and reject. Given the tail area or the probability that z random variable is inside the tail, we want the z value which defines the dividing line. The z can fall inside the lower (left) tail or the right tail. This will mean looking up the N(0,1) table backwards. The R command:qnorm(0.10, lower.tail=FALSE).
38 Review: Finding Critical Value - One Tail Standard Normal Distribution Table (Portion)What is z given a = 0.10?.90.10.08Z.07.09a = .101.1.3790.3810.3830.50.401.2.3980.3997.4015z1.281.3.4147.4162.4177Critical Value= 1.28.
39 Example: Test Statistic (continued)Obtain sample evidence and compute the test statisticSuppose a sample is taken with the following results: n = 64, x = (=10 was assumed known)Then the test statistic is:.
40 Example: Decision Reach a decision and interpret the result: = .10 (continued)Reach a decision and interpret the result:Reject H0 = .10Do not reject H0Reject H01.28z = .88Do not reject H0 since z = 0.88 ≤ 1.28i.e.: there is not sufficient evidence that themean bill is over $52.
41 p -Value Solution Calculate the p-value and compare to (continued)Calculate the p-value and compare to p-value = .1894Reject H0 = .10Do not reject H0Reject H01.28z = .88Do not reject H0 since p-value = > = .10.
42 Using R to find p-valueGiven the test statistic (z value) finding the p value means finding a probability or area under the N(0,1) curve. This means we use the R command: pnorm(0.88, lower.tail=FALSE)This is the p-value from the previous slide!If the z is negative, do not use the option lower.tail=FALSE. For example, pnorm(-0.88).
43 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 = $ ands = $ Test at the = level.(Assume the population distribution is normal)H0: μ = HA: μ ¹ 168.
44 Example Solution: Two-Tail Test H0: μ = HA: μ ¹ 168a/2=.025a/2=.025a = 0.05n = 25 is unknown, souse a t statisticCritical Value:t24 = ±Reject H0Do not reject H0Reject H0tα/2-tα/22.06391.46Do not reject H0: not sufficient evidence that true mean cost is different than $168.
45 Critical value of t in RBy analogy with pnorm and qnorm R has functions pt to find the probability under the t density and qt to look at t tables backward and get the critical value of t from knowing the tail probability. Here we need to specify the degrees of freedom (df).qt(0.025, lower.tail=FALSE, df=24)pt(1.46, lower.tail=FALSE, df=24).
46 Hypothesis Tests for Proportions Involves categorical valuesTwo 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.
47 Proportions Sample proportion in the success category is denoted by p (continued)Sample proportion in the success category is denoted by pWhen both np and n(1-p) are at least 5, p can be approximated by a normal distribution with mean and standard deviation.
48 Hypothesis Tests for Proportions The sampling distribution of p is normal, so the test statistic is a z value:HypothesisTests for pnp 5andn(1-p) 5np < 5orn(1-p) < 5Not discussed in this chapter.
49 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 with 25 responses. Test at the = .05 significance level.Check:n p = (500)(.08) = 40n(1-p) = (500)(.92) = 460.
50 Z Test for Proportion: Solution Test Statistic:H0: p = HA: p ¹ .08a = .05n = 500, p = .05Decision:Critical Values: ± 1.96Reject H0 at = .05RejectRejectConclusion:.025.025There is sufficient evidence to reject the company’s claim of 8% response rate.z-1.961.96-2.47.
51 p -Value Solution Calculate the p-value and compare to (continued)Calculate the p-value and compare to (For a two sided test the p-value is always two sided)Do not reject H0Reject H0Reject H0p-value = .0136:/2 = .025/2 = .025.0068.0068-1.961.96z = -2.47z = 2.47Reject H0 since p-value = < = .05.
52 Two-sided p value in RAs before, finding p value means finding a probability and it involves the function pnorm or pt as the case may be. Here we want two-sided p value given the z value of + orpnorm(-2.47)We have to double this as there are 2 tail probabilities as 2*0.0068=0.0136.
53 Type II Error Suppose we fail to reject H0: μ 52 Type II error is the probability offailing to reject a false H0Suppose we fail to reject H0: μ 52when in fact the true mean is μ = 505052RejectH0: μ 52Do not rejectH0 : μ 52.
54 Type II Error(continued)Suppose we do not reject H0: 52 when in fact the true mean is = 50This is the range of x where H0 is not rejectedThis is the true distribution of x if = 505052RejectH0: 52Do not rejectH0 : 52.
55 Type II Error(continued)Suppose we do not reject H0: μ 52 when in fact the true mean is μ = 50Here, β = P( x cutoff ) if μ = 50β5052RejectH0: μ 52Do not rejectH0 : μ 52.
56 Calculating β Suppose n = 64 , σ = 6 , and = .05 (for H0 : μ 52)So β = P( x ) if μ = 505050.76652RejectH0: μ 52Do not rejectH0 : μ 52.
57 Calculating β Suppose n = 64 , σ = 6 , and = .05 (continued) Probability of type II error:β = .15395052RejectH0: μ 52Do not rejectH0 : μ 52.
58 Chapter Summary Addressed hypothesis testing methodology Performed z Test for the mean (σ known)Discussed p–value approach to hypothesis testingPerformed one-tail and two-tail tests . . ..
59 Chapter Summary Performed t test for the mean (σ unknown) (continued)Performed t test for the mean (σ unknown)Performed z test for the proportionDiscussed type II error and computed its probability.