Professional Documents
Culture Documents
Changing σ increases or
decreases the spread.
X
The Normal Distribution:
as mathematical function (pdf)
1 x 2
1 (
2
)
f ( x) e
2
This is a bell shaped
Note constants: curve with different
=3.14159 centers and spreads
e=2.71828 depending on and
The Normal PDF
It’s a probability function, so no matter what the values
of and , must integrate to 1!
1 x 2
1 ( )
e 2 dx 1
2
Normal distribution is defined
by its mean and standard dev.
1 x 2
1 ( )
E(X)= = x e 2 dx
2
1 x 2
1 ( )
Var(X)=2 = ( x2 e 2 dx ) 2
2
Standard Deviation(X)=
**The beauty of the normal curve:
68% of
the data
2 1 x 2
1 ( )
e 2 dx .95
2 2
3 1 x 2
1 ( )
e 2 dx .997
3 2
R Syntax
-10
-5
x
0
5
10
pnorm()
-10
-5
0
x
5
10
qnorm()
1
0
x
rnorm()
6
4
2
0
-2 -1 0 1 2
y
Program-1
# Draw a normal distribution with a mean=60
and a standard deviation=15.
>x=seq(15,105,length=200)
>y=dnorm(x,mean=60,sd=15)
>plot(x,y,type="l",xaxt="n")
>axis(1,at=c(15,30,45,60,75,90,105))
y
15
30
45
x
60
75
90
105
Programme2:
#shade the top 20% of the area under the normal density
curve
>x=seq(15,105,length=200)
>y=dnorm(x,mean=60,sd=15)
>plot(x,y,type="l",xaxt="n")
>axis(1,at=c(15,30,45,60,75,90,105))
>x=seq(72.62,105,length=100)
>y=dnorm(x,mean=60,sd=15)
>polygon(c(72.62,x,105),c(0,y,0),col="red")
>text(80,0.005,"0.20")
y
15
30
45
x
60
75
0.20
90
105
Programme 3
# Simulate a standard normal density curve (mean=0 and
standard deviation=1)
>x=seq(-3,3,length=200)
>y=dnorm(x)
>plot(x,y,type="l")
>x=seq(-1,1,length=100)
>y=dnorm(x)
>polygon(c(-1,x,1),c(0,y,0),col="lightgreen")
y
-3
-2
-1
x
0
1
2
3
text(0,0.15,"68%")
0.4
0.3
0.2
y
68%
0.1
0.0
-3 -2 -1 0 1 2 3
x
#Hence,approximately 95% of the area lies within two standard
deviations of the mean.
>x=seq(-3,3,length=200)
>y=dnorm(x) plot(x,y,type="l")
>x=seq(-2,2,length=100)
>y=dnorm(x)
>polygon(c(-2,x,2),c(0,y,0),col="lightgreen")
>text(0,0.15,"95%")
0.4
0.3
0.2
y
95%
68%
0.1
0.0
-3 -2 -1 0 1 2 3
x
#Hence, approximately 99.7% of the area lies within
three standard deviations of the mean.
> x=seq(-3,3,length=200)
> y=dnorm(x)
> plot(x,y,type="l")
> x=seq(-3,3,length=100)
> y=dnorm(x)
> polygon(c(-3,x,3),c(0,y,0),col="lightgreen")
> text(0,0.15,"99.7%")
0.4
0.3
0.2
y
99.7%
0.1
0.0
-3 -2 -1 0 1 2 3
x
generate 50 (standard) normally distributed random
numbers and to display them as a histogram.
0.4
0.3
Density
0.2
0.1
0.0
-3 -2 -1 0 1 2
mysample
approximation of the binomial distribution with the
normal distribution
0
10
20
x
30
40
50
Practice:-
(i) Suppose X is normal with mean 527 and
standard deviation 105. Compute P(X >=310)
>pnorm(310,527,105)
[1] 0.01938279