Ch 3: Normal Distribution
z-score
Here is how to convert IQ test scores (3.29 ,p.86) to z-score. Note that in the following result, the mean of z, -4.698777e-16 means -.0000000000000004698777. That is, it is zero.
> x <- c(114, 110, 104, 89, 102, 91, 114, 114, 103, 105, 108, 130, 120, 133) > z <- (x-mean(x))/sd(x) > z [1] 0.3210488 0.0000000 -0.4815732 -1.6855063 -0.4013110 -1.5249819 [7] 0.3210488 0.3210488 -0.5618354 -0.4013110 -0.1605244 1.6052441 [13] 0.8026221 1.8460308 > mean(z) [1] -4.698777e-16 > sd(z) [1] 1
Drawing Normal Distributions in R
Standard Normal distribution with mean 0 and standard deviation 1, N(0,1).
> x <- seq(-4,4,length=100) > y <- dnorm(x,mean=0, sd=1) > plot(x,y,type="l")
Add color to an area from x=-inf to x=-1.
> x=seq(-4,4,length=100) > y=dnorm(x) > plot(x,y,type="l") > x=seq(-4,-1,length=100) > y=dnorm(x) > polygon(c(-4,x,-1),c(0,y,0),col="gray") > abline(h=0)
Probability of a normal distribution.
The cumulative probability from negative infinite to -1 for a standard normal distribution of a mean of 0 and a sdandard deviation of 1.
> pnorm(-1,0,1) > 0.1586553 > pnorm(-1, mean=0, sd=1) > 0.1586553 > pnorm(-1, sd=1, mean=0) > 0.1586553
The cumulative probability from 2 to 15 for a normal distribution of a mean of 12 and a sdandard deviation of 5.
> pnorm(15,12,5)-pnorm(3,12,5) > 0.7029968
Quantile Points.
What will be the qunatile points for a area whose cumulative probability is 95% when the disribution is standard normal with a mean of 0 and a standard deviation of 1?
> qnorm(.95, 0, 1) > 1.644854
What will be the qunatile points for a area whose cumulative probability is 80% when the distribution is normal with a mean of 3.1 and a standard deviation of 1.2?
> qnorm(.80, 3.1, 1.2) > 4.109945
[ Going back to Using R: Index ]