Lecture 6: The Normal distribution - Oxford...

29
Lecture 6: The Normal distribution 18th of November 2015 Lecture 6: The Normal distribution 18th of November 2015 1 / 29

Transcript of Lecture 6: The Normal distribution - Oxford...

Page 1: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Lecture 6: The Normal distribution

18th of November 2015

Lecture 6: The Normal distribution 18th of November 2015 1 / 29

Page 2: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Continous data

In previous lectures we have considered discrete datasets and discreteprobability distributions.

In practice many datasets that we collect from experiments consist ofcontinuous measurements.For example:

Babyboom birthweightsBrain sizes of 40 Psychology studentsPetal measurements in a species of flowerSerum potassium measurements from 152 healthy volunteers

So we need to study probability models for continuous data

Lecture 6: The Normal distribution 18th of November 2015 2 / 29

Page 3: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Discrete probability distributions

For the Binomial and Poisson distributions, the probabilitydistributions were characterised by a formula for the probability ofeach possible discrete value.All of the probabilities together sum up to 1.We can visualize the density by plotting the probabilities against thediscrete values

0 5 10 15 20

0.00

0.02

0.04

0.06

0.08

0.10

0.12

X

P(X

)

Lecture 6: The Normal distribution 18th of November 2015 3 / 29

Page 4: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Continuous probability distributions

For continuous data we don’t have equally spaced discrete values.Instead we use a curve or function that describes the probabilitydensity over the range of the distribution.The curve is chosen so that the area under the curve is equal to 1.If we observe a sample of data from such a distribution we should seethat the values occur in regions where the density is highest.

60 80 100 120 140

0.00

0.01

0.02

0.03

0.04

X

density

Lecture 6: The Normal distribution 18th of November 2015 4 / 29

Page 5: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

The Normal distribution

There are many, many possible probability density functions over acontinuous range of values.

The Normal distribution describes a special class of such distributionsthat are symmetric and can be described by two parameters

µ = the mean of the distributionσ = the standard deviation of the distribution

Changing the values of µ and σ alter the positions and shapes of thedistributions.

Lecture 6: The Normal distribution 18th of November 2015 5 / 29

Page 6: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

50 100 150

0.00

0.04

0.08

µ = 100 ! = 10

X

density

50 100 150

0.00

0.04

0.08

µ = 100 ! = 5

X

density

50 100 150

0.00

0.04

0.08

µ = 130 ! = 10

X

density

50 100 150

0.00

0.04

0.08

µ = 100 ! = 15

X

density

Lecture 6: The Normal distribution 18th of November 2015 6 / 29

Page 7: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

The Normal distribution

If X is Normally distributed with mean µ and standard deviation σ, wewrite

X∼N(µ, σ2)

µ and σ are the parameters of the distribution.

The probability density of the Normal distribution is given by

f(x) =1

σ√2π

exp−(x−µ)2/2σ2

For the purposes of this course we do not need to use this expression.It is included here for future reference.

Lecture 6: The Normal distribution 18th of November 2015 7 / 29

Page 8: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Calculating probability for continuousdistributions

For a discrete probability distribution we calculate the probability ofbeing less than some value z, i.e. P (Z < z), by simply summing upthe probabilities of the values less than z.

For a continuous probability distribution we calculate the probabilityof being less than some value z, i.e. P (Z < z), by calculating thearea under the curve to the left of z

Lecture 6: The Normal distribution 18th of November 2015 8 / 29

Page 9: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

For example, suppose Z ∼ N(0, 1) and we want to calculate P (Z < 0) ?

0

P(Z < 0)

For this example we can calculate the required area as we know thedistribution is symmetric and the total area under the curve is equal to 1,i.e. P (Z < 0) = 0.5.

Lecture 6: The Normal distribution 18th of November 2015 9 / 29

Page 10: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

What about P (Z < 1)?

0 1

P(Z < 1)

Calculating this area is not easy and so we use probability tables.

Lecture 6: The Normal distribution 18th of November 2015 10 / 29

Page 11: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Probability tables

Probability tables are tables of probabilities that have been calculatedon a computer.

All we have to do is identify the right probability in the table andcopy it down!

Obviously it is impossible to tabulate all possible probabilities for allpossible Normal distributions so only one special Normal distribution,N(0, 1), has been tabulated.

Lecture 6: The Normal distribution 18th of November 2015 11 / 29

Page 12: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

The tables allow us to read off probabilities of the form P (Z < z).

0 z

Lecture 6: The Normal distribution 18th of November 2015 12 / 29

Page 13: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

z 0.0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.090.0 0.5000 5040 5080 5120 5160 5199 5239 5279 5319 53590.1 0.5398 5438 5478 5517 5557 5596 5636 5675 5714 57530.2 0.5793 5832 5871 5910 5948 5987 6026 6064 6103 61410.3 0.6179 6217 6255 6293 6331 6368 6406 6443 6480 65170.4 0.6554 6591 6628 6664 6700 6736 6772 6808 6844 68790.5 0.6915 6950 6985 7019 7054 7088 7123 7157 7190 72240.6 0.7257 7291 7324 7357 7389 7422 7454 7486 7517 75490.7 0.7580 7611 7642 7673 7704 7734 7764 7794 7823 78520.8 0.7881 7910 7939 7967 7995 8023 8051 8078 8106 81330.9 0.8159 8186 8212 8238 8264 8289 8315 8340 8365 8389

1.0 0.8413 8438 8461 8485 8508 8531 8554 8577 8599 86211.1 0.8643 8665 8686 8708 8729 8749 8770 8790 8810 8830

From this table we can identify that P (Z < 1.0) = 0.8413

Lecture 6: The Normal distribution 18th of November 2015 13 / 29

Page 14: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Example 1

Suppose we want P (Z > 0.92).

0 00.92 0.92

P(Z < 0.92)P(Z > 0.92)

We know thatP (Z > 0.92) = 1− P (Z < 0.92)

and we can calculate P (Z < 0.92) from the tables.

Thus, P (Z > 0.92) = 1− 0.8212 = 0.1788.

Lecture 6: The Normal distribution 18th of November 2015 14 / 29

Page 15: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Example 2

The table only includes positive values of z.

If we want to compute P (Z > −0.5), we use the fact that the Normaldistribution is symmetric:

P (Z > −0.5) = P (Z < 0.5) = 0.6915

0!0.5

P(X > !0.5) P(X < 0.5)

0 0.5

Lecture 6: The Normal distribution 18th of November 2015 15 / 29

Page 16: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Example 3

How do we compute P (−0.64 < Z < 0.43)?

0 0.43!0.64 0

!0.64 0.430

P(X < !0.64) P(X < 0.43)

P(!0.64 < X < 0.43)

P (−0.64 < Z < 0.43) = P (Z < 0.43)− P (Z < −0.64)= P (Z < 0.43)− P (Z > 0.64)

= P (Z < 0.43)− (1− P (Z < 0.64)) = 0.4053

Lecture 6: The Normal distribution 18th of November 2015 16 / 29

Page 17: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Example 4

How would we compute P (Z < 0.567)?

From tables we know that

P (Z < 0.56) = 0.7123

P (Z < 0.57) = 0.7157

To calculate P (Z < 0.567) we interpolate between these two values

P (Z < 0.567) = 0.3× 0.7123 + 0.7× 0.7157 = 0.7146

Lecture 6: The Normal distribution 18th of November 2015 17 / 29

Page 18: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Standardisation

All of the probabilities above were calculated for the standardNormal distribution N(0, 1).

If we want to calculate probabilities from different Normaldistributions we convert the probability to one involving the standardNormal distribution.

This process is called standardisation.

Lecture 6: The Normal distribution 18th of November 2015 18 / 29

Page 19: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Suppose X ∼ N(3, 4) and we want to calculate P (X < 6.2).

We convert this probability to one involving the N(0, 1) distribution by

1 Subtracting the mean µ

2 Dividing by the standard deviation σ

P (X < 6.2) = P

(X − 3

2<

6.2− 3

2

)= P (Z < 1.6) = 0.9452

where Z ∼ N(0,1)

This process can be described by the following rule

If X ∼ N(µ, σ2) and Z = X−µσ then Z ∼ N(0, 1)

Lecture 6: The Normal distribution 18th of November 2015 19 / 29

Page 20: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Linear combinations of Normal randomvariables

Suppose two rats A and B have been trained to navigate a large maze.

X = Time of run for rat A; X ∼ N(80, 102)

Y = Time of run for rat B; Y ∼ N(78, 132)

On any given day what is the probability that rat A runs the maze slowerthan rat B?

Let D = X − Y be the difference in times of rats A and B.

If rat A is slower than rat B then D < 0 so we want to calculate

P (D < 0) .

To calculate this probability we need to know the distribution of D.

Lecture 6: The Normal distribution 18th of November 2015 20 / 29

Page 21: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

To do this we use the following rule

If X and Y are two independent normal variable such that

X ∼ N(µ1, σ21) and Y ∼ N(µ2, σ22)

then X − Y ∼ N(µ1 - µ2, σ21 + σ22)

In this example,

D = X − Y ∼ N(80− 78, 102 + 132) = N(2, 269)

P (D < 0) = P

(D − 2√269

<0− 2√269

)= P (Z < −0.122) where Z ∼ N(0, 1)

= 1− (0.8× 0.5478 + 0.2× 0.5517)

= 0.45142

Lecture 6: The Normal distribution 18th of November 2015 21 / 29

Page 22: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Other rules that are often used are

If X and Y are two independent normal variable such that

X ∼ N(µ1, σ21) and Y ∼ N(µ2, σ22)

then

X + Y ∼ N(µ1 + µ2, σ21 + σ22)

aX ∼ N(aµ1, a2σ21)

aX + bY ∼ N(aµ1 + bµ2, a2σ21 + b2σ22)

Lecture 6: The Normal distribution 18th of November 2015 22 / 29

Page 23: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Example: maze-running time (conitnued)

X = Time of run for rat A; X ∼ N(80, 102)Y = Time of run for rat B; Y ∼ N(78, 132)

On any given day what is the probability that the average time the ratstake to run the maze is greater than 82 seconds?

Let A = X+Y2 = 1

2X + 12Y be the average time of rats A and B.

Then A ∼ N(1280 +

1278, (12)

2102 + (12)2132

)= N(79, 67.25)

P (A > 82) = P

(A− 79√67.25

>82− 79√67.25

)= P (Z > 0.366)

= 1− (0.4× 0.6406 + 0.6× 0.6443) = 0.35718

where Z ∼ N(0, 1).

Lecture 6: The Normal distribution 18th of November 2015 23 / 29

Page 24: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Using the Normal tables backwards

Example: Exam scores

X = The marks of 500 candidates in an examination ∼ N(45, 202).

Estimate the value of x such that 20% of candidates obtain marks ofx or more

We want x such that P (X > x) = 0.2⇔ P (X < x) = 0.8 .

Standardising this probability we get

P

(X − 45

20<x− 45

20

)= 0.8 = P

(Z <

x− 45

20

)where Z ∼ N(0, 1).

From the tables we know that P (Z < 0.84) ≈ 0.8 so

x− 45

20≈ 0.84

⇒ x ≈ 45 + 20× 0.84 = 61.8

Lecture 6: The Normal distribution 18th of November 2015 24 / 29

Page 25: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

The Normal approximation to the Binomial

If X ∼ Bin(n, p) then

µ = np

σ2 = npq where q = 1− pFor large n and p not too small or too large, X ∼ N(np, npq)

100 120 140 160 180 200

0.00

0.01

0.02

0.03

0.04

Bin(300, 0.5)

X

P(X

= x)

100 120 140 160 180 200

0.00

0.01

0.02

0.03

0.04

N(150, 75)

X

dens

ity

What are large n and p not too small or too large?

n > 10 and p ≈ 12 OR n > 30 and p moving away from 1

2

Lecture 6: The Normal distribution 18th of November 2015 25 / 29

Page 26: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

The Normal approximation to the Poisson

We can also use the Normal distribution to approximate a Poissondistribution under certain conditions.

If X ∼ Po(λ) then

µ = λ

σ2 = λ

For large λ (say λ > 20)

X ∼ N(λ, λ)

Lecture 6: The Normal distribution 18th of November 2015 26 / 29

Page 27: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Continuity correction

Suppose X ∼ Bin(12, 0.5) what is P (4 ≤ X ≤ 7)?

For this distribution we have

µ = np = 6

σ2 = npq = 3

So we can use a N(6, 3) distribution as an approximation.

We have to take into account the fact that we are using a continuousdistribution to approximate a discrete distribution.

In this example,

P (4 ≤ X ≤ 7) = P (3 < X < 8) ≈ P (3.5 < Y < 7.5) = · · ·

where Y ∼ N(6, 3).

Lecture 6: The Normal distribution 18th of November 2015 27 / 29

Page 28: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

Example

In the 1970s, the psychologist Charles Tart tried to test whether peoplemight have the power to see into the future. His “Aquarius machine” wasa device that would flash four different lights in random orders. Subjectswould press buttons to predict which of the 4 lights will come on next.

15 different subjects each ran a trial of 500 guesses.

They produced 2006 correct guesses and 5494 incorrect.

Hypothesis = subject has no power to predict the future, i.e. a subjecthas a 1/4 chance of guessing right each time, independent of any otheroutcomes.

Under this hypothesis, the number of correct guesses X ∼ Bin(7500, 1/4)

The observed number of correct guesses is above the mean number ofcorrect guesses under the hypotheses (7500/4=1875).Is this difference from the expectation just chance variation?

Lecture 6: The Normal distribution 18th of November 2015 28 / 29

Page 29: Lecture 6: The Normal distribution - Oxford Statisticsfilippi/Teaching/psychology_humanscience_20… · The Normal distribution describes a special class of such distributions that

We want to know how likely a result this extreme would be if X really hasthis binomial distribution.

We could compute this directly from the binomial distribution as

P (X ≥ 2006) =

7500∑x=2006

(7500

x

)(0.25)x(0.75)7500−x

This is a lot of work. More useful is to approximate the distribution of Xby a normal distribution with mean µ = 7500/4 = 1875, and standarddeviation σ =

√7500× 0.25× 0.75 = 37.5

Because of the continuity correction, the probability we are looking for is

P (X > 2005) ≈ P (Y > 2005.5) where Y ∼ N(1875, 37.5)

= P

(Z >

2005.5− 1875

37.5

)where Z ∼ N(0, 1)

= P (Z > 3.48) = 0.000250

This may be compared to the exact binomial probability 0.000274.Lecture 6: The Normal distribution 18th of November 2015 29 / 29