14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence...

27
14. Introduction to inference The Practice of Statistics in the Life Sciences Third Edition © 2014 W. H. Freeman and Company

Transcript of 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence...

Page 1: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

14. Introduction to inference

The Practice of Statistics in the Life Sciences Third Edition

© 2014 W. H. Freeman and Company

Page 2: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

Objectives (PSLS Chapter 14)

Introduction to inference

p Uncertainty and confidence

p Confidence intervals

p Confidence interval for a Normal population mean (σ known)

p Significance tests

p Null and alternative hypotheses

p The P-value

p Test for a Normal population mean (σ known)

Page 3: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

Uncertainty and confidence

If you picked different samples from a population, you would probably get

different sample means ( x ̅) and virtually none of them would actually

equal the true population mean, µ.

Page 4: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

nSample means,n subjects

µ

σ

Population, xindividual subjects

x If the population is N(µ,σ), the

sampling distribution is N(µ,σ/√n).

If not, the sampling distribution is

~N(µ,σ/√n) if n is large enough.

Use of sampling distributions

➔ We take one random sample of size n, and rely on the known properties of the sampling distribution.

Page 5: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

~95% of all intervals computed with this method capture the parameter µ.

Based on the ~68-95-99.7% rule, we can expect that:

When we take a random sample, we can compute the sample mean and an interval of size plus-or-minus 2σ/√n around the mean.

Page 6: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

Confidence intervals

A confidence interval is a range of values with an associated probability, or confidence level, C. This probability quantifies the chance that the interval contains the unknown population parameter.

We have confidence C that µ falls within the interval computed.

Page 7: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

The confidence level C (in %) represents an area of corresponding size C under the sampling distribution.

mm

The margin of error, m

A confidence interval (“CI”) can be expressed as:

p a center ± a margin of error m: µ within x ̅ ± m

p an interval: µ within (x ̅− m) to (x ̅+ m)

Page 8: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

A 95% confidence interval for the mean body temperature (in °F) was computed as (98.1, 98.4), based on body temperatures from a sample of 130 healthy adults. The correct interpretation of this interval is:

A) 95% of observations in the sample have body temperature between 98.1 and 98.4°F.

B) 95% of the individuals in the population should have body temperature between 98.1 and 98.4°F.

C) We are 95% confident that the population mean body temperature is a value between 98.1 and 98.4°F.

The margin of error for this interval is:

A) 95% B) 98.25°F. C) 0.3°F. D) 0.15°F.

Page 9: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

When taking a random sample from a Normal population with known standard deviation σ, a level C confidence interval for µ is:

CI for a Normal population mean (σ known)

80% confidence level C

C

z* -z*

p σ/√n is the standard deviation of

the sampling distribution

p C is the area under the N(0,1)

between −z* and z*

* or x z n x mσ± ±

Page 10: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

How do we find z*-values?

For 95% confidence level, z* = 1.96 (almost 2).

(…)

We can use a table of z- and t-values (Table C). For a given confidence level C, the appropriate z*-value is listed in the same column.

Page 11: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

Density of bacteria in solution

p 99% confidence interval for the true density, z* = 2. 576

= 28 ± 2.576(1/√3)

≈ 28 ± 1.5 million bacteria/ml

p 90% confidence interval for the true density, z* = 1.645 = 28 ± 1.645(1/√3)

≈ 28 ± 0.9 million bacteria/ml

Measurement equipment has Normal distribution with standard deviation σ = 1 million bacteria/ml of fluid.

Three measurements made: 24, 29, and 31 million bacteria/ml.

Mean: = 28 million bacteria/ml. Find the 99% and 90% CI.

*x znσ

± *x znσ

±

x

Page 12: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

Link between confidence level and margin of error

The confidence level C determines the value of z* (in Table C). The margin of error also depends on z*.

m = z *σ n

C

Z*−Z*

m m

Higher confidence C implies a larger

margin of error m (less precision more

accuracy).

A lower confidence level C produces a

smaller margin of error m (more

precision less accuracy).

➔ win/loose situation

Page 13: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

Someone makes a claim about the unknown value of a population parameter. We check whether or not this claim makes sense in light of the “evidence” gathered (sample data).

A test of statistical significance tests a specific hypothesis using sample data to decide on the validity of the hypothesis.

Significance tests

Blood levels of inorganic phosphorus are known to vary Normally among adults, with mean 1.2 and standard deviation 0.1 mmol/l. But is the true mean inorganic phosphorus level lower among the elderly?The average inorganic phosphorus level of a random sample of 12 healthy elderly subjects is 1.128 mmol/l.

p Is this smaller mean phosphorus level simply due to chance variation?

p Is it evidence that the true mean phosphorus level in elderly individuals is lower than 1.2 mmol/l?

Page 14: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

The null hypothesis, H0, is a very specific statement about a parameter of the population(s).

The alternative hypothesis, Ha, is a more general statement that complements yet is mutually exclusive with the null hypothesis.

Phosphorus levels in the elderly:

H0: µ = 1.2 mmol/l

Ha: µ < 1.2 mmol/l (µ is smaller due to changing physiology)

Null and alternative hypotheses

Page 15: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

One-sided versus two-sided alternatives

p A two-tail or two-sided alternative is symmetric:

Ha: µ ≠ [a specific value or another parameter]

p A one-tail or one-sided alternative is asymmetric and specific:

Ha: µ < [a specific value or another parameter] OR

Ha: µ > [a specific value or another parameter]

What determines the choice of a one-sided versus two-sided test is the question we are asking and what we know about the problem before performing the test. If the question or problem is asymmetric, then Ha

should be one-sided. If not, Ha should be two-sided.

Page 16: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

Is the active ingredient concentration as stated on the label (325 mg/ tablet)?

H0: µ = 325 Ha: µ ≠ 325

Is nicotine content greater than the written 1 mg/cigarette, on average? H0: µ = 1 Ha: µ > 1

Does a drug create a change in blood pressure, on average?

H0: µ = 0 Ha: µ ≠ 0

Does a particular stream have an unhealthy mean oxygen content (a level below 5 mg per liter)? Ecologists collect a liter of water from each of 45 random locations along a stream and measure the amount of dissolved oxygen in each. They find a mean of 4.62 mg per liter.

H0: µ = 5 Ha: µ < 5

Page 17: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

The P-value

P-value: The probability, if H0 was true, of obtaining a sample statistic

at least as extreme (in the direction of Ha) as the one obtained.

Phosphorus levels vary Normally with standard deviation σ = 0.1 mmol/l.

H0: µ = 1.2 mmol/l versus Ha: µ < 1.2 mmol/l

The mean phosphorus level from the 12 elderly subjects is 1.128 mmol/l.

What is the probability of drawing a random sample with a mean as small as this one or even smaller, if H0 is true?

Page 18: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

Phosphorus levels vary Normally with standard deviation σ = 0.1 mmol/l.

H0: µ = 1.2 mmol/l versus Ha: µ < 1.2 mmol/l

The mean phosphorus level from the 12 elderly subjects is 1.128 mmol/l.

Page 19: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

Interpreting a P-value

Could random variation alone account for the difference between H0 and observations from a random sample?

➔ Small P-values are strong evidence AGAINST H0 and we reject H0.

The findings are “statistically significant.”

➔ P-values that are not small don’t give enough evidence against H0

and we fail to reject H0. Beware: We can never “prove H0.”

Page 20: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

0 1

Hig

hly

sign

ifica

ntVe

ry s

igni

fican

tSi

gnifi

cant

Som

ewha

t sig

nific

ant !--------------------------- Not significant --------------------------"

Possible P-values

Range of P-values

P-values are probabilities, so they are always a number between 0 and 1.

The order of magnitude of the P-value matters more than its exact numerical value.

Page 21: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

The significance level α

The significance level, α, is the largest P-value tolerated for rejecting H0 (how much evidence against H0 we require). This value is decided

arbitrarily before conducting the test.

p When P-value ≤ α, we reject H0.

p When P-value > α, we fail to reject H0.

Industry standards require a significance level α of 5%. Does the packaging machine need revision?

Two-sided test. The P-value is 4.56%.

P-value < 5%, the results are statistically significant at significance level 0.05.

Page 22: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

Test for a population mean (σ known)

nx

µ0−=

To test H0: µ = µ0 using a random sample of size n from a Normal

population with known standard deviation σ, we use the null sampling distribution N(µ0, σ√n).

The P-value is the area under N(µ0, σ√n) for values of x̅ at least as

extreme in the direction of Ha as that of our random sample.

Calculate the z-value then use Table B or C. Or use technology.

Page 23: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

P-value in one-sided and two-sided tests

To calculate the P-value for a two-sided test, use the symmetry of the normal curve. Find the P-value for a one-sided test and double it.

One-sided (one-tailed) test

Two-sided (two-tailed) test

Page 24: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level
Page 25: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

Do the elderly have a mean phosphorus level below 1.2 mmol/l? p H0: µ = 1.2 versus Ha: µ < 1.2 p What would be the probability of drawing a random sample such as

this or worse if H0 was true?

1.128 0.1 12 is normally distributedx n xσ= = =

1.128 1.2 2.4940.1 12

xz

σ

− −= = = −

Table B: P-value = P(z ≤ –2.49) = 0.0064

The probability of getting a random sample average so different from µ0 is so low that we reject H0.

Table C: one-sided P-value is between 0.005 and 0.01 (use |z|).

➔The mean phosphorus level among the elderly is significantly less than 1.2 mmol/l.

P-value

Page 26: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

Confidence intervals to test hypotheses

Because a two-sided test is symmetric, you can easily use a confidence interval to test a two-sided hypothesis.

α /2 α /2

In a two-sided test, C = 1 – α.

C confidence level

α significance level

Page 27: 14. Introduction to inferencevollmer/stat307pdfs/book...standard deviation σ, a level C confidence interval for µ is: CI for a Normal population mean (σ known) 80% confidence level

Logic of confidence interval test

We found a 99% confidence interval for the true bacterial density of , or 26.5 to 29.5 million bacteria/ per ml.

With 99% confidence, could the population mean be µ =25 million/ml? µ = 29?

5.128±=±mx

Cannot reject H0: µ = 29Reject H0: µ = 25

A confidence interval gives a black and white answer: Reject or don’t reject H0.

But it also estimates a range of likely values for the true population mean µ.

A P-value quantifies how strong the evidence is against the H0. But if you reject

H0, it doesn’t provide any information about the true population mean µ.

26.5 99% CI 29.5