Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

1 / 16

Overview 1

The Basics Hypotheses Examples

2

Hypothesis Tests for Population Means Procedure Examples Theory Type I and Type II Error The Connection Between Two-Tailed Tests and CIs p-values

3

Hypothesis Tests for Population Proportions The Binomial Test Normal Approximation Test Examples Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

2 / 16

Hypotheses Statements A hypothesis is an assumption which may or may not be true.

Example Some hypotheses: 1

The average annual compensation for used car salespeople is $46,000.00.

2

The average annual compensation for used car salespeople is more than $46,000.00.

3

The mean weight of all bags of pretzels is 454g.

4

The mean weight of all bags of pretzels differs from the advertised weight of 454g.

The null hypothesis H0 is an an established belief, or the status quo. The alternative hypothesis Ha is an assumption that prescribes a new school of thought if we reject H0 . The alternative hypothesis is a new idea, or one that challenges the status quo. Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

3 / 16

Examples Example In a U.S. court of law, H0 :

The defendant is innocent.

Ha :

The defendant is guilty.

If sufficient evidence can be presented to warrant a guilty verdict, we reject the claim that the accused is innocent.

Example A consumer wishes to investigate the weights of bags of pretzels. H0 :

The mean weight of all bags of pretzels equals 5 oz.

Ha :

The mean weight of all bags of chips is less than 5 oz.

Reject H0 in favor of Ha if the sample mean is sufficiently less than 5 oz. Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

4 / 16

Hypothesis Testing Procedure for One Population Mean

1

Satisfy the necessary assumptions: (i) Simple random sampling. (ii) Population has a normal distribution or sample size n is large... like ≥ 25 or 30.

2

State H0 and Ha .

3

Set the significance level α if desired.

4

Compute the test statistic t=

5

x − µ0 √ s/ n

Compute the p-value. Reject H0 in favor of Ha if and only if p-value < α. Otherwise, fail to reject H0 .

Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

5 / 16

Example Example You wish to test a company’s claim that they produce bags of pretzels with mean mass 454 g. Masses (in g) of 25 randomly chosen bags are 442 449 468 446 447

456 465 454 456 447

454 449 433 435 456

438 446 463 452 456

447 447 450 444 450

At the 5% level of significance, is there enough evidence to suggest customers are being cheated? Be sure to verify the assumptions.

Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

6 / 16

Example Example The mean top speed for cheetahs is assumed to be 60 mph. Twenty-eight randomly selected cheetahs have top speeds (in mph) of 57.3 57.5 59.0 56.5

57.6 59.2 65.0 61.3

62.6 55.4 60.7 60.1

54.8 60.9 55.5 59.7

57.8 61.6 75.3 62.3

55.9 60.2 59.6 65.2

54.7 52.6 52.4 57.8

At the 5% significance level, do the data provide sufficient evidence to conclude that the mean top speed of cheetahs differs from sixty mph?

Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

7 / 16

Example

Example A lake is non-acidic if its pH exceeds 6. The pH levels of high mountain lakes in the southern Alps are 7.3 6.3 6.5

7.2 6.9 5.8

6.6 5.7 7.9

6.9 7.3 6.3

6.1 5.5 6.7

Check to see if the necessary assumptions are satisfied for performing a significance test. If they are, do the data provide sufficient evidence that high mountain lakes in the southern Alps are non acidic?

Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

8 / 16

Theory Null hypothesis: H0 : µ = µ 0 Possible alternative hypotheses: Ha : µ < µ0

(in this case, do a left-tailed test)

Ha : µ > µ0

(in this case, do a right-tailed test)

Ha : µ 6= µ0

(in this case, do a two-tailed test)

If we can gather ‘enough’ evidence to support Ha , we reject H0 in favor of Ha . Otherwise, we fail to reject H0 . √ 0 . By the null hypothesis, if n is large or we’re sampling from Let t = xs/−µ n a normal distribution, t should have a t-distribution with n − 1 degrees of freedom. So reject H0 in favor of Ha if t is ‘far away’ from 0 in the direction indicated by Ha . Fail to reject H0 otherwise. Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

9 / 16

Type I and Type II Error

If we reject H0 when we should not, we make a Type I error. If we fail to reject H0 when it should be rejected, we make Type II error.

Fail to reject H0 Reject H0

H0 is true Correct Decision Type I Error

H0 is false Type II Error Correct Decision

Given H0 is true, the significance level α is the probability of making a Type I error. β is the probability of making Type II error, and depends on the true value of µ0 . When performing hypothesis tests, we generally want to minimize α and β.

Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

10 / 16

The Connection Between Two-Tailed Tests and CIs Consider running the two-tailed hypothesis test for a mean with significance level/type I error probability α: H0 :

µ = µ0 ,

Ha :

µ 6= µ0 .

Failing to reject the null in this case occurs if and only if a (1 − α) × 100% CI for the mean µ contains the value µ0 .

For example, in lieu of running a two-tailed hypothesis test for a mean with, say µ0 = 60 mph at the 5% significance level, we could instead construct a 95% confidence interval for the mean, and see if that interval surrounds 60. If so, fail to reject the null. If not, reject in favor of the two-tailed alternative (that there is a difference). Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

11 / 16

p-values Assuming H0 is indeed true, the p-value is the probability of observing a value of the test statistic at least as extreme as that observed. For a right-tailed test:

p-value = P(T > t)

For a left-tailed test:

p-value = P(T < t)

For a two-tailed test:

p-value = 2P(T > |t|)

Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

12 / 16

The Exact Binomial Hypothesis Test for Population Proportions 1

Satisfy the one necessary assumption: Simple random sampling.

2

State H0 and Ha .

3

Set significance level α (if you desire).

4

Compute p-value = probability that a binomial random variable is as extreme as the number of successes x you observed in your sample. Case 1: For a LTT, use p-value = binomcdf(n, p0 , x ) Case 2: For a RTT, use p-value = 1- binomcdf(n, p0 , x − 1) Case 3: For a TTT, if pˆ > p0 use p-value = 2(1- binomcdf(n, p0 , x − 1)). For a TTT, if pˆ < p0 use p-value = 2binomcdf(n, p0 , x ).

5

Reject H0 in favor of Ha if p-value < α. Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

13 / 16

Hypothesis Tests for Pop. Proportions: When n is Large We always prefer the binomial test for proportions, but if n is large, we can use the central limit theorem to get an approximate test. The CLT says x −µ Z0 = √ σ/ n is distributed approximately normal(0,1) for large n. Proportions are means! So subbing pˆ for x , subbing p for µ, and subbing p √ p(1 − p)/n for σ/ n gives that Z=p

pˆ − p p(1 − p)/n

is distributed approximately normal(0,1) for large n. This suggests the use of the test static pˆ − p0 z0 = p p0 (1 − p0 )/n to test hypotheses about one-sample population proportions. Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

14 / 16

Large Sample, Normal Approximation Procedure for Hypothesis Testing for Proportions 1

Necessary Assumptions: (a) Simple random sampling. (b) np0 ≥ 5 and n(1 − p0 ) ≥ 5

2

State H0 and Ha .

3

Set significance level α (if you desire).

4

Compute the test statistic z0 = p

pˆ − p0 p0 (1 − p0 )/n

5

Compute p-value = probability that a standard normal random variable is as extreme as z0

6

Reject H0 in favor of Ha if p-value < α. Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

15 / 16

Example Example Of 459 of 850 Austin Peay stats students reported using Yik Yak to remark on their professors in class. Find the smallest significance level at which we can conclude a majority of APSU stats students use Yik Yak to remark about their professors. Use the binomial test and the normal approximation test and compare.

Example 10% of the population is left-handed. Does this hold for APSU students? Use the binomial and normal tests and compare.

Example In recent decades, the proportion of ACME students who are male has been about 38%. In a recent poll of 300 students, 105 were male. Does the evidence suggest the proportion who are male has decreased? Use the binomial and normal tests and compare. Matt Jones (APSU)

Hypothesis Testing for One Mean and One Proportion

16 / 16