+ All Categories
Home > Documents > Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and...

Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and...

Date post: 26-Feb-2020
Category:
Upload: others
View: 3 times
Download: 0 times
Share this document with a friend
23
Lecture 7: Confidence interval and Normal approximation 26th of November 2015 Confidence interval 26th of November 2015 1 / 23
Transcript
Page 1: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

Lecture 7: Confidence interval andNormal approximation

26th of November 2015

Confidence interval 26th of November 2015 1 / 23

Page 2: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

Random sample and uncertainty

Example: we aim at estimating the average height of British men.

We measure the height of 198 men.

The sample mean of 198 men’s heights is 1732mm, and the samplestandard deviation is 68.8mm.

What does this tell us about the average height of British men?

We only measured 198 of the many millions of men in the country.

Measuring the height of 198 other means would have lead to anotherestimation of the average height of British men

Confidence interval 26th of November 2015 2 / 23

Page 3: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

Imagine the height of British men follows a normal distribution N(µ, σ2).

Denote by X1, . . . , Xn the random measurements of the height of n = 198mens.

Our best guess for µ will of course be the sample mean

X̄ =1

n(X1 + · · ·+Xn)

What is the distribution of X̄?

It is the sum of normally distributed random variables so it follows anormal distribution.

Its mean is µ.

Its variance is V ar(X̄) = 1n2

(V ar(X1) + · · ·+ V ar(Xn)

)= σ2

n .

Therefore

X̄ ∼ N(µ,σ2

n

).

Confidence interval 26th of November 2015 3 / 23

Page 4: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

We can standardise X̄ by writing Z = X̄−µσ/√n

, where Z ∼ N(0, 1).

Using the standard normal tables we can show that

P (−1.96 ≤ Z ≤ 1.96) = 0.95

Therefore we have that

P

(X̄ − 1.96

σ√n≤ µ ≤ X̄ + 1.96

σ√n

)= 0.95 .

i.e, the probability is 0.95 that µ is in the range X̄ − 1.96 σ√n

to

X̄ + 1.96 σ√n

; σ can be approximated using the sample standard deviation.

We call this interval a 95% confidence interval for the unknownpopulation mean.

Confidence interval 26th of November 2015 4 / 23

Page 5: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

General procedure for normal confidenceinterval

Suppose X1, . . . , Xn are independent samples from a normal distributionwith unknown mean µ, and known variance σ2.

Then a (symmetric) c% normal confidence interval for µ is the interval(X̄ − z σ√

n, X̄ + z

σ√n

), which we also write as X̄ ± z σ√

n,

z is the number such that (100− c)/2% of the probability in thestandard normal distribution is above z.

For a 95% confidence interval, we take z = 1.96

For a 99% confidence interval, we take z = 2.6

Confidence interval 26th of November 2015 5 / 23

Page 6: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

Standard error

A c% normal confidence interval for µ is the interval(X̄ − z σ√

n, X̄ + z

σ√n

).

The quantity σ√n

, which determines the scale of the confidence interval, is

called the Standard Error (SE) for the sample mean.

Here we assume that σ is known. If it is not, we will estimate it from thedata.

Confidence interval 26th of November 2015 6 / 23

Page 7: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

Interpreting the confidence interval

What does confidence mean?

The quantity µ is a fact, not a random quantity.

Example: imagine we obtain the following 5% confidence interval:(1722mm, 1742mm) for the men height. We can not say:

“The probability is 0.95 that µ is between 1722mm and 1742mm.”

The randomness is in our estimate X̄.

The probability statement is about the random interval.

Confidence interval 26th of November 2015 7 / 23

Page 8: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

Interpreting the confidence interval

A (α× 100)% confidence interval for a parameter µ, based onobservations X = (X1, . . . , Xn) is a pair of statistics A(X) and B(X),such that

P (A(X) ≤ µ ≤ B(X)) = α.

We can say that: (α× 100)% of the time, the random interval generatedaccording to this recipe will cover the true parameter.

The quantity P (A(X) ≤ µ ≤ B(X)) is called the coverage probabilityfor µ.

A (α× 100)% confidence interval is sometimes also called a confidenceinterval with confidence coefficient or confidence level α.

Confidence interval 26th of November 2015 8 / 23

Page 9: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

Example: blood sample

Four measurements for 100 patients

0 20 40 60 80 100

90100

110

120

130

140

150

Trial

Blo

od P

ress

ure

90% confidence interval

0 20 40 60 80 100

90100

110

120

130

140

150

Trial

Blo

od P

ress

ure

95% confidence interval

0 20 40 60 80 100

90100

110

120

130

140

150

Trial

Blo

od P

ress

ure

68% confidence interval

0 20 40 60 80 100

90100

110

120

130

140

150

Trial

Blo

od P

ress

ure

Confidence interval 26th of November 2015 9 / 23

Page 10: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

The Normal Approximation

So far, we have been assuming that our data are sampled from apopulation with a normal distribution.

What justification do we have for this assumption?And what do we do if the data come from a different distribution?

One of the great early discoveries of probability theory is that manydifferent kinds of random variables come close to a normal distributionwhen you average enough of them.

You have already seen examples of this phenomenon in the normalapproximation to the binomial distribution and the Poisson.

Confidence interval 26th of November 2015 10 / 23

Page 11: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

The Normal Approximation

Approximation Theorems in Probability

Suppose X1, X2, . . . , Xn are independent samples from a probabilitydistribution with mean µ and variance σ2. Then

Law of Large Numbers (LLN): For n large, X̄ will be close to µ.

Central Limit Theorem (CLT): For n large, the error in the LLN is closeto a normal distribution, with variance σ2/n. That is, using ourstandardisation procedure for the normal distribution,

Z =X̄ − µσ/√n

(1)

is close to having a standard normal distribution.Equivalently, X1 + · · ·+Xn has approximately N(nµ, nσ2) distribution.

Confidence interval 26th of November 2015 11 / 23

Page 12: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

In probability textbooks, you can find very precise statements about whatit means for the distribution to be “close”.

For our purposes, we will simply treat Z as being actually a standardnormal random variable.

However, we also need to know what it means for n to be “large”. Formost distributions that you might encounter, 20 is usually plenty, while 2or 3 are not enough. The key rules of thumb are that the approximationworks best when the distribution of X

1 is reasonably symmetric: Not skewed in either direction.

2 has thin tails: Most of the probability is close to the mean, not manystandard deviations away from the mean.

More specific indications will be given in the following examples.

Confidence interval 26th of November 2015 12 / 23

Page 13: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

The Poisson distribution

Suppose Xi are drawn from a Poisson distribution with parameter µ. Thevariance is then also µ.

We know that X1 + · · ·+Xn has Poisson distribution with parameter nµ.

The CLT tells us that for n large enough, the Po(nµ) distribution is veryclose to the N(nµ, nµ) distribution; or, in other words, Po(λ) isapproximately the same as N(λ, λ) for λ large.

How large should it be?

Confidence interval 26th of November 2015 13 / 23

Page 14: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

λ = 1

-3 -2 -1 0 1 2 3 4

0.0

0.1

0.2

0.3

0.4

Z

Density

λ = 10

0 5 10 15 20

0.00

0.04

0.08

0.12

Z

Density

λ = 4

-4 -2 0 2 4 6 8 10

0.00

0.10

0.20

Z

Density

λ = 20

5 10 15 20 25 30 35

0.00

0.04

0.08

ZDensity

Note that when λ < 2.5√λ or, equivalently, λ < 6.2, the normal curve will

have substantial probability below −0.5.

Confidence interval 26th of November 2015 14 / 23

Page 15: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

The Bernoulli distribution

Bernoulli variables is the name for random variables that are 1 or 0, withprobability p or 1− p respectively.

Then B = X1 + · · ·+Xn is the number of successes in n trials, withsuccess probability p each time — that is, a Bin(n, p) random variable.

The CLT implies that Bin(n, p) ∼ N(np, np(1− p)) for large values of n.

Note that B/n is the proportion of successes in n trials, and this hasapproximately N(p, p(1− p)/n) distribution.

In other words, the observed proportion will be close to p, but will be offby a small multiple of the standard deviation, which shrinks as σ/

√n,

where σ =√p(1− p).

Confidence interval 26th of November 2015 15 / 23

Page 16: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

The Bernoulli distribution

How large does n need to be?

As in the case of the Poisson distribution, a minimum requirement is thatthe mean be substantially larger than the standard deviation

np�√np(1− p) so that n� 1/p .

The condition is symmetric, so we also need n� 1/(1− p).

This fits with our rule of thumb that n needs to be bigger when thedistribution of X is skewed, which is the case when p is close to 0 or 1.

Confidence interval 26th of November 2015 16 / 23

Page 17: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

The Bernoulli distribution

When p = 0.5 the normal approximation is quite good, even when nis only 10

when p = 0.1 we have a good normal approximation when n = 100,but not when n is 25.

p = 0.5, n = 3

-2 -1 0 1 2 3 4 5

0.0

0.1

0.2

0.3

0.4

p = 0.1, n = 3

-2 -1 0 1 2 3

0.0

0.2

0.4

0.6

p = 0.5, n = 10

0 2 4 6 8 10

0.00

0.05

0.10

0.15

0.20

0.25

p = 0.1, n = 10

-2 -1 0 1 2 3 4

0.0

0.1

0.2

0.3

0.4

p = 0.5, n = 25

5 10 15 20

0.00

0.05

0.10

0.15

p = 0.1, n = 25

-2 0 2 4 6 8

0.00

0.10

0.20

p = 0.5, n = 100

35 40 45 50 55 60 65

0.00

0.02

0.04

0.06

0.08

p = 0.1, n = 100

5 10 15

0.00

0.04

0.08

0.12

Confidence interval 26th of November 2015 17 / 23

Page 18: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

CLT for real data

Example: household incomes in the state of California in 1999Challenge: household income has a highly skewed distribution — hence apoor candidate for applying the CLT.

Histogram of California household income 1999

income in $thousands

Density

0 50 100 150 200 250 300

0.000

0.004

0.008

0.012

Averages of 2 California household incomes

income in $thousands

Density

0 50 100 150 200 250 300

0.000

0.004

0.008

0.012

Averages of 5 California household incomes

income in $thousands

Density

0 50 100 150 200

0.000

0.005

0.010

0.015

Averages of 10 California household incomes

income in $thousands

Density

50 100 150

0.000

0.005

0.010

0.015

0.020

Averages of 50 California household incomes

income in $thousands

Density

40 50 60 70 80 90 100

0.00

0.01

0.02

0.03

0.04

0.05

Averages of 100 California household incomes

income in $thousandsDensity

50 60 70 80

0.00

0.02

0.04

0.06

Confidence interval 26th of November 2015 18 / 23

Page 19: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

Use of the CLT

The CLT enables us to approximate probability distributions by a normaldistribution.

There are many implications of the Central Limit Theorem.

Here we discuss one crucial application:The CLT allows us to compute normal confidence intervals to data thatare not themselves normally distributed

Confidence interval 26th of November 2015 19 / 23

Page 20: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

Example: average incomes

Suppose we take a random sample of 400 households in Oxford.

We find that they have an average income of £36,200,

with an SD of £26,400.

What can we infer about the average income of all households in Oxford?

Answer: Although the distribution of incomes is not normal, the averageof 400 incomes is approximatively normally distributed. The SE for themean is £26400/

√400 = 1320, so a 95% confidence interval for the

average income in the population will be

£36200± 1.96 ·£1320 = (£33560,£38840) .

A 99% confidence interval is

£36200± 2.6 ·£1320 = (£32800,£39600) .

Confidence interval 26th of November 2015 20 / 23

Page 21: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

Confidence intervals for probability ofsuccess

Example: The Gallup organisation carried out a poll in October, 2005, ofAmericans’ attitudes about guns

They surveyed 1,012 Americans, chosen at random.

30% said they personally owned a gun.

If they’d picked different people, purely by chance they would have gottena somewhat different percentage.

What does this survey tell us about the true proportion of Americans whoown guns?

Here, n = 1, 012 is large so, according to the CLT, the distribution of theproportion of Americans who own guns can be approximated by aN(p, p(1− p)/n) distribution.

Confidence interval 26th of November 2015 21 / 23

Page 22: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

We can compute a 95% confidence interval for the true proportion ofAmericans who own guns as

0.30± 1.96SE

where SE can be approximated using the sample mean p ≈ 0.3:

SE =

√p(1− p)

n≈√

0.3× 0.7

1012= 0.0144

So a 95% confidence interval for the true fraction of Americans who ownguns is 0.30± 0.029 = (0.271, 0.329).

Loosely put, we can be 95% confident that the true proportion supportingEPP is between 27% and 33%.

A 99% confidence interval comes from multiplying by 2.6 instead of 1.96:it goes from 26.3% to 33.7%.

Confidence interval 26th of November 2015 22 / 23

Page 23: Lecture 7: Confidence interval and Normal …filippi/Teaching/psychology_human...Random sample and uncertainty Example: we aim at estimating the average height of British men. We measure

Summary

Definition of confidence interval for the mean when data are normallydistributed

Approximation theorems in probability

the law of large numbersthe central limit theorem (CLT)

Indications about the conditions of the CLT for different probabilitydistributions

Applications of the CLT to compute confidence intervals when dataare not normally distributed

Reminder: the lecture notes contain more details and more examples; theyare available on my website.

Confidence interval 26th of November 2015 23 / 23


Recommended