18.440: Lecture 19 Normal random variables Scott Sheffield MIT

advertisement
18.440: Lecture 19
Normal random variables
Scott Sheffield
MIT
18.440 Lecture 19
Outline
Tossing coins
Normal random variables
Special case of central limit theorem
18.440 Lecture 19
Outline
Tossing coins
Normal random variables
Special case of central limit theorem
18.440 Lecture 19
Tossing coins
I
Suppose we toss a million fair coins. How many heads will we
get?
Tossing coins
I
Suppose we toss a million fair coins. How many heads will we
get?
I
About half a million, yes, but how close to that? Will we be
off by 10 or 1000 or 100,000?
Tossing coins
I
Suppose we toss a million fair coins. How many heads will we
get?
I
About half a million, yes, but how close to that? Will we be
off by 10 or 1000 or 100,000?
I
How can we describe the error?
Tossing coins
I
Suppose we toss a million fair coins. How many heads will we
get?
I
About half a million, yes, but how close to that? Will we be
off by 10 or 1000 or 100,000?
I
How can we describe the error?
I
Let’s try this out.
Tossing coins
I
Toss n coins. What is probability to see k heads?
Tossing coins
I
I
Toss n coins. What is probability to see k heads?
Answer: 2−k kn .
Tossing coins
I
Toss n coins. What is probability to see k heads?
Answer: 2−k kn .
I
Let’s plot this for a few values of n.
I
18.440 Lecture 19
Tossing coins
I
Toss n coins. What is probability to see k heads?
Answer: 2−k kn .
I
Let’s plot this for a few values of n.
I
Seems to look like it’s converging to a curve.
I
18.440 Lecture 19
Tossing coins
I
Toss n coins. What is probability to see k heads?
Answer: 2−k kn .
I
Let’s plot this for a few values of n.
I
Seems to look like it’s converging to a curve.
I
If we replace fair coin with p coin, what’s probability to see k
heads.
I
18.440 Lecture 19
Tossing coins
I
Toss n coins. What is probability to see k heads?
Answer: 2−k kn .
I
Let’s plot this for a few values of n.
I
Seems to look like it’s converging to a curve.
I
If we replace fair coin with p coin, what’s probability to see k
heads.
Answer: p k (1 − p)n−k kn .
I
I
18.440 Lecture 19
Tossing coins
I
Toss n coins. What is probability to see k heads?
Answer: 2−k kn .
I
Let’s plot this for a few values of n.
I
Seems to look like it’s converging to a curve.
I
I
If we replace fair coin with p coin, what’s probability to see k
heads.
Answer: p k (1 − p)n−k kn .
I
Let’s plot this for p = 2/3 and some values of n.
I
18.440 Lecture 19
Tossing coins
I
Toss n coins. What is probability to see k heads?
Answer: 2−k kn .
I
Let’s plot this for a few values of n.
I
Seems to look like it’s converging to a curve.
I
I
If we replace fair coin with p coin, what’s probability to see k
heads.
Answer: p k (1 − p)n−k kn .
I
Let’s plot this for p = 2/3 and some values of n.
I
What does limit shape seem to be?
I
18.440 Lecture 19
Outline
Tossing coins
Normal random variables
Special case of central limit theorem
18.440 Lecture 19
Outline
Tossing coins
Normal random variables
Special case of central limit theorem
18.440 Lecture 19
Standard normal random variable
I
Say X is a (standard) normal random variable if
2
fX (x) = f (x) = √12π e −x /2 .
Standard normal random variable
I
I
Say X is a (standard) normal random variable if
2
fX (x) = f (x) = √12π e −x /2 .
Clearly f is alwaysR non-negative for real values of x, but how
∞
do we show that −∞ f (x)dx = 1?
Standard normal random variable
I
I
I
Say X is a (standard) normal random variable if
2
fX (x) = f (x) = √12π e −x /2 .
Clearly f is alwaysR non-negative for real values of x, but how
∞
do we show that −∞ f (x)dx = 1?
Looks kind of tricky.
Standard normal random variable
I
I
I
I
Say X is a (standard) normal random variable if
2
fX (x) = f (x) = √12π e −x /2 .
Clearly f is alwaysR non-negative for real values of x, but how
∞
do we show that −∞ f (x)dx = 1?
Looks kind of tricky.
R∞
2
Happens to be a nice trick. Write I = −∞ e −x /2 dx. Then
try to compute I 2 as a two dimensional integral.
Standard normal random variable
I
I
I
I
I
Say X is a (standard) normal random variable if
2
fX (x) = f (x) = √12π e −x /2 .
Clearly f is alwaysR non-negative for real values of x, but how
∞
do we show that −∞ f (x)dx = 1?
Looks kind of tricky.
R∞
2
Happens to be a nice trick. Write I = −∞ e −x /2 dx. Then
try to compute I 2 as a two dimensional integral.
That is, write
Z ∞
Z ∞
Z ∞Z ∞
2
2
2
2
I2 =
e −x /2 dx
e −y /2 dy =
e −x /2 dxe −y /2 dy .
−∞
−∞
−∞
−∞
Standard normal random variable
I
I
I
I
I
Say X is a (standard) normal random variable if
2
fX (x) = f (x) = √12π e −x /2 .
Clearly f is alwaysR non-negative for real values of x, but how
∞
do we show that −∞ f (x)dx = 1?
Looks kind of tricky.
R∞
2
Happens to be a nice trick. Write I = −∞ e −x /2 dx. Then
try to compute I 2 as a two dimensional integral.
That is, write
Z ∞
Z ∞
Z ∞Z ∞
2
2
2
2
I2 =
e −x /2 dx
e −y /2 dy =
e −x /2 dxe −y /2 dy .
−∞
I
−∞
−∞
Then switch to polar coordinates.
Z ∞ Z 2π
Z
2
−r 2 /2
e
rdθdr = 2π
I =
0
so I =
√
0
2π.
0
∞
re −r
−∞
2 /2
dr = −2πe −r
2 /2
∞
,
0
Standard normal random variable mean and variance
I
Say X is a (standard) normal random variable if
2
f (x) = √12π e −x /2 .
Standard normal random variable mean and variance
I
Say X is a (standard) normal random variable if
2
f (x) = √12π e −x /2 .
I
Question: what are mean and variance of X ?
Standard normal random variable mean and variance
I
Say X is a (standard) normal random variable if
2
f (x) = √12π e −x /2 .
I
Question: what are mean and variance of X ?
R∞
E [X ] = −∞ xf (x)dx. Can see by symmetry that this zero.
I
Standard normal random variable mean and variance
I
Say X is a (standard) normal random variable if
2
f (x) = √12π e −x /2 .
I
Question: what are mean and variance of X ?
R∞
E [X ] = −∞ xf (x)dx. Can see by symmetry that this zero.
I
I
Or can compute directly:
Z ∞
∞
1
1
2
2
√ e −x /2 xdx = √ e −x /2 E [X ] =
= 0.
−∞
2π
2π
−∞
Standard normal random variable mean and variance
I
Say X is a (standard) normal random variable if
2
f (x) = √12π e −x /2 .
I
Question: what are mean and variance of X ?
R∞
E [X ] = −∞ xf (x)dx. Can see by symmetry that this zero.
I
I
Or can compute directly:
Z ∞
∞
1
1
2
2
√ e −x /2 xdx = √ e −x /2 E [X ] =
= 0.
−∞
2π
2π
−∞
I
How wouldR we compute R
∞
Var[X ] = f (x)x 2 dx = −∞
2
√1 e −x /2 x 2 dx?
2π
Standard normal random variable mean and variance
I
Say X is a (standard) normal random variable if
2
f (x) = √12π e −x /2 .
I
Question: what are mean and variance of X ?
R∞
E [X ] = −∞ xf (x)dx. Can see by symmetry that this zero.
I
I
Or can compute directly:
Z ∞
∞
1
1
2
2
√ e −x /2 xdx = √ e −x /2 E [X ] =
= 0.
−∞
2π
2π
−∞
I
How wouldR we compute R
∞
Var[X ] = f (x)x 2 dx = −∞
I
2
√1 e −x /2 x 2 dx?
2π
2
Try integration by parts with u = x and dv = xe −x /2 dx.
R∞
2
2
∞
Find that Var[X ] = √12π (−xe −x /2 + −∞ e −x /2 dx) = 1.
−∞
General normal random variables
I
Again, X is a (standard) normal random variable if
2
f (x) = √12π e −x /2 .
General normal random variables
I
Again, X is a (standard) normal random variable if
2
f (x) = √12π e −x /2 .
I
What about Y = σX + µ? Can we “stretch out” and
“translate” the normal distribution (as we did last lecture for
the uniform distribution)?
18.440 Lecture 19
General normal random variables
I
Again, X is a (standard) normal random variable if
2
f (x) = √12π e −x /2 .
I
What about Y = σX + µ? Can we “stretch out” and
“translate” the normal distribution (as we did last lecture for
the uniform distribution)?
I
Say Y is normal with parameters µ and σ 2 if
2
2
1
e −(x−µ) /2σ .
f (x) = √2πσ
18.440 Lecture 19
General normal random variables
I
Again, X is a (standard) normal random variable if
2
f (x) = √12π e −x /2 .
I
What about Y = σX + µ? Can we “stretch out” and
“translate” the normal distribution (as we did last lecture for
the uniform distribution)?
I
Say Y is normal with parameters µ and σ 2 if
2
2
1
e −(x−µ) /2σ .
f (x) = √2πσ
I
What are the mean and variance of Y ?
18.440 Lecture 19
General normal random variables
I
Again, X is a (standard) normal random variable if
2
f (x) = √12π e −x /2 .
I
What about Y = σX + µ? Can we “stretch out” and
“translate” the normal distribution (as we did last lecture for
the uniform distribution)?
I
Say Y is normal with parameters µ and σ 2 if
2
2
1
e −(x−µ) /2σ .
f (x) = √2πσ
I
What are the mean and variance of Y ?
I
E [Y ] = E [X ] + µ = µ and Var[Y ] = σ 2 Var[X ] = σ 2 .
18.440 Lecture 19
Cumulative distribution function
I
Again, X is a standard normal random variable if
2
f (x) = √12π e −x /2 .
18.440 Lecture 19
Cumulative distribution function
I
Again, X is a standard normal random variable if
2
f (x) = √12π e −x /2 .
I
What is the cumulative distribution function?
18.440 Lecture 19
Cumulative distribution function
I
Again, X is a standard normal random variable if
2
f (x) = √12π e −x /2 .
I
What is the cumulative distribution function?
Ra
2
Write this as FX (a) = P{X ≤ a} = √12π −∞ e −x /2 dx.
I
18.440 Lecture 19
Cumulative distribution function
I
Again, X is a standard normal random variable if
2
f (x) = √12π e −x /2 .
I
What is the cumulative distribution function?
Ra
2
Write this as FX (a) = P{X ≤ a} = √12π −∞ e −x /2 dx.
I
I
How can we compute this integral explicitly?
18.440 Lecture 19
Cumulative distribution function
I
Again, X is a standard normal random variable if
2
f (x) = √12π e −x /2 .
I
What is the cumulative distribution function?
Ra
2
Write this as FX (a) = P{X ≤ a} = √12π −∞ e −x /2 dx.
I
I
How can we compute this integral explicitly?
I
Can’t. Let’s Rjust give it a name. Write
2
a
Φ(a) = √12π −∞ e −x /2 dx.
18.440 Lecture 19
Cumulative distribution function
I
Again, X is a standard normal random variable if
2
f (x) = √12π e −x /2 .
I
What is the cumulative distribution function?
Ra
2
Write this as FX (a) = P{X ≤ a} = √12π −∞ e −x /2 dx.
I
I
How can we compute this integral explicitly?
I
Can’t. Let’s Rjust give it a name. Write
2
a
Φ(a) = √12π −∞ e −x /2 dx.
I
Values: Φ(−3) ≈ .0013, Φ(−2) ≈ .023 and Φ(−1) ≈ .159.
18.440 Lecture 19
Cumulative distribution function
I
Again, X is a standard normal random variable if
2
f (x) = √12π e −x /2 .
I
What is the cumulative distribution function?
Ra
2
Write this as FX (a) = P{X ≤ a} = √12π −∞ e −x /2 dx.
I
I
How can we compute this integral explicitly?
I
Can’t. Let’s Rjust give it a name. Write
2
a
Φ(a) = √12π −∞ e −x /2 dx.
I
Values: Φ(−3) ≈ .0013, Φ(−2) ≈ .023 and Φ(−1) ≈ .159.
I
Rough rule of thumb: “two thirds of time within one SD of
mean, 95 percent of time within 2 SDs of mean.”
18.440 Lecture 19
Outline
Tossing coins
Normal random variables
Special case of central limit theorem
18.440 Lecture 19
Outline
Tossing coins
Normal random variables
Special case of central limit theorem
18.440 Lecture 19
DeMoivre-Laplace Limit Theorem
I
Let Sn be number of heads in n tosses of a p coin.
18.440 Lecture 19
DeMoivre-Laplace Limit Theorem
I
Let Sn be number of heads in n tosses of a p coin.
I
What’s the standard deviation of Sn ?
18.440 Lecture 19
DeMoivre-Laplace Limit Theorem
I
Let Sn be number of heads in n tosses of a p coin.
I
What’s the standard deviation of Sn ?
√
Answer: npq (where q = 1 − p).
I
18.440 Lecture 19
DeMoivre-Laplace Limit Theorem
I
Let Sn be number of heads in n tosses of a p coin.
I
What’s the standard deviation of Sn ?
√
Answer: npq (where q = 1 − p).
I
I
The special quantity S√n −np
npq describes the number of standard
deviations that Sn is above or below its mean.
18.440 Lecture 19
DeMoivre-Laplace Limit Theorem
I
Let Sn be number of heads in n tosses of a p coin.
I
What’s the standard deviation of Sn ?
√
Answer: npq (where q = 1 − p).
I
I
I
The special quantity S√n −np
npq describes the number of standard
deviations that Sn is above or below its mean.
What’s the mean and variance of this special quantity? Is it
roughly normal?
18.440 Lecture 19
DeMoivre-Laplace Limit Theorem
I
Let Sn be number of heads in n tosses of a p coin.
I
What’s the standard deviation of Sn ?
√
Answer: npq (where q = 1 − p).
I
I
The special quantity S√n −np
npq describes the number of standard
deviations that Sn is above or below its mean.
I
What’s the mean and variance of this special quantity? Is it
roughly normal?
I
DeMoivre-Laplace limit theorem (special case of central
limit theorem):
Sn − np
≤ b} → Φ(b) − Φ(a).
lim P{a ≤ √
npq
n→∞
18.440 Lecture 19
DeMoivre-Laplace Limit Theorem
I
Let Sn be number of heads in n tosses of a p coin.
I
What’s the standard deviation of Sn ?
√
Answer: npq (where q = 1 − p).
I
I
The special quantity S√n −np
npq describes the number of standard
deviations that Sn is above or below its mean.
I
What’s the mean and variance of this special quantity? Is it
roughly normal?
I
DeMoivre-Laplace limit theorem (special case of central
limit theorem):
Sn − np
≤ b} → Φ(b) − Φ(a).
lim P{a ≤ √
npq
n→∞
I
This is Φ(b) − Φ(a) = P{a ≤ X ≤ b} when X is a standard
normal random variable.
18.440 Lecture 19
Problems
I
Toss a million fair coins. Approximate the probability that I
get more than 501, 000 heads.
18.440 Lecture 19
Problems
I
I
Toss a million fair coins. Approximate the probability that I
get more than 501, 000 heads.
√
√
Answer: well, npq = 106 × .5 × .5 = 500. So we’re asking
for probability to be over two SDs above mean. This is
approximately 1 − Φ(2) = Φ(−2) ≈ .159.
18.440 Lecture 19
Problems
I
I
I
Toss a million fair coins. Approximate the probability that I
get more than 501, 000 heads.
√
√
Answer: well, npq = 106 × .5 × .5 = 500. So we’re asking
for probability to be over two SDs above mean. This is
approximately 1 − Φ(2) = Φ(−2) ≈ .159.
Roll 60000 dice. Expect to see 10000 sixes. What’s the
probability to see more than 9800?
18.440 Lecture 19
Problems
I
I
I
I
Toss a million fair coins. Approximate the probability that I
get more than 501, 000 heads.
√
√
Answer: well, npq = 106 × .5 × .5 = 500. So we’re asking
for probability to be over two SDs above mean. This is
approximately 1 − Φ(2) = Φ(−2) ≈ .159.
Roll 60000 dice. Expect to see 10000 sixes. What’s the
probability to see more than 9800?
q
√
Here npq = 60000 × 16 × 56 ≈ 91.28.
18.440 Lecture 19
Problems
I
I
Toss a million fair coins. Approximate the probability that I
get more than 501, 000 heads.
√
√
Answer: well, npq = 106 × .5 × .5 = 500. So we’re asking
for probability to be over two SDs above mean. This is
approximately 1 − Φ(2) = Φ(−2) ≈ .159.
I
Roll 60000 dice. Expect to see 10000 sixes. What’s the
probability to see more than 9800?
q
√
Here npq = 60000 × 16 × 56 ≈ 91.28.
I
And 200/91.28 ≈ 2.19. Answer is about 1 − Φ(−2.19).
I
18.440 Lecture 19
Download