Standard Normal Density Curve

The following code will generate a standard normal density curve.

curve(dnorm(x), main="Standard Normal Curve", xlab="Z", ylab="density", type="l", xlim=c(-4, 4) );

Calculating z Scores

The following will calculate the z score for a normal random variable with a mean of 0, a standard deviation of 1, and a probability p = .95.

p <- .95 # A probability
# for P(X <= z) = p Lower Tail
qnorm(p, mean = 0, sd = 1); 
## [1] 1.644854
# P(X >= z) = p Upper Tail
qnorm(p, mean = 0, sd = 1, lower.tail=FALSE); 
## [1] -1.644854

Calculating Normal Probabilities

The following will calculate the probability for a normal random variable with a mean of 0, a standard deviation of 1, and an observed value q = 1.5.

q <- 1.5 # value of x

# for P(X <=  q) Lower Tail
pnorm(q, mean = 0, sd = 1); 
## [1] 0.9331928
# for P(X >= q) Upper Tail
pnorm(q, mean = 0, sd = 1, lower.tail=FALSE); 
## [1] 0.0668072

Mathematicss, Computer Science, and Statistics Department Gustavus Adolphus College