Coursera.org - Data Science Specialization

Developing Data Products - Peer Assessment

by Sergio Vicente
Aug. 2015

The "Normal Plot App" insight

This application sprang up in the idea of providing a simple tool to show Normal Distribution and its probability calculus to novice students in Statistics.

Along some courses I have ministered, I took notice that some people have trouble to understand its use to solve simple problems, like I will show you along next slides.

A typical problem

Suppose that a product made in an industry has this weight following a normal distribution with average equals to 20g and standard deviation, 4g. And it's being asked to find the probability of an article randomly selected have your weight:

  • a) Between 16 and 22 grams;
  • b) Between 22 and 25 grams;
  • c) Above of 23 grams.

Normal Distribution Plot

Using R to plot normal curve:

mean=20; sd=4
x <- seq(-4,4,length=100)*sd + mean
f <- dnorm(x,mean,sd)
plot(x, f, type="n", xlab="X values", ylab="", main="Normal Distribution - Weight Product", axes=FALSE)
box(lwd=3, lty=2, col='#e0e0e0')

And to show probability area under normal function:

i <- x >= low_lim & x <= upp_lim
lines(x, hx)
polygon(c(low_lim,x[i],upp_lim), c(0,hx[i],0), col="red") 

Plotting the solution to item (b) of that typical problem:

plot of chunk unnamed-chunk-3

The red area represents the density of probability between 22 and 25, e.g., 0.2029.