Chapter 3 - Distributions of Random Variables Graded: 3.2 (see normalPlot), 3.4, 3.18 (use qqnormsim from lab 3), 3.22, 3.38, 3.42
3.2 Area under the curve, Part II. What percent of a standard normal distribution N(µ = 0, sigma = 1) is found in each region? Be sure to draw a graph.
library(DATA606)
## Loading required package: shiny
## Loading required package: openintro
## Please visit openintro.org for free statistics materials
##
## Attaching package: 'openintro'
## The following objects are masked from 'package:datasets':
##
## cars, trees
## Loading required package: OIdata
## Loading required package: RCurl
## Loading required package: bitops
## Loading required package: maps
## Loading required package: ggplot2
##
## Attaching package: 'ggplot2'
## The following object is masked from 'package:openintro':
##
## diamonds
## Loading required package: markdown
##
## Welcome to CUNY DATA606 Statistics and Probability for Data Analytics
## This package is designed to support this course. The text book used
## is OpenIntro Statistics, 3rd Edition. You can read this by typing
## vignette('os3') or visit www.OpenIntro.org.
##
## The getLabs() function will return a list of the labs available.
##
## The demo(package='DATA606') will list the demos that are available.
##
## Attaching package: 'DATA606'
## The following object is masked from 'package:utils':
##
## demo
normalPlot(mean = 0, sd = 1, bounds = c(-1.13, 4), tails = FALSE)
(b) Z < 0.18
normalPlot(mean = 0, sd = 1, bounds = c(-4, 0.18), tails = FALSE)
normalPlot(mean = 0, sd = 1, bounds = c(8,100), tails = FALSE)
normalPlot(mean = 0, sd = 1, bounds = c(-0.5, 0.5), tails = FALSE)
3.4 Triathlon times, Part I. In triathlons, it is common for racers to be placed into age and gender groups. Friends Leo and Mary both completed the Hermosa Beach Triathlon, where Leo competed in the Men, Ages 30 - 34 group while Mary competed in the Women, Ages 25 - 29 group. Leo completed the race in 1:22:28 (4948 seconds), while Mary completed the race in 1:31:53 (5513 seconds). Obviously Leo finished faster, but they are curious about how they did within their respective groups. Can you help them? Here is some information on the performance of their groups: • The finishing times of the Men, Ages 30 - 34 group has a mean of 4313 seconds with a standard deviation of 583 seconds. • The finishing times of the Women, Ages 25 - 29 group has a mean of 5261 seconds with a standard deviation of 807 seconds. • The distributions of finishing times for both groups are approximately Normal. Remember: a better performance corresponds to a faster finish.
Leo: N(mu = 4313, sigma = 583) Mary: N(mu = 5261, sigma = 807)
Leo’s Z score is 1.09 and Mary’s Z score is 0.31. Their Z-scores tell us how far away from the mean their times were. Based on these Z scores, Mary’s time was faster respective to her group than Leo’s time was respective to his group.
mMean <- 4313
mSD <- 583
leo <- 4948
fMean <- 5261
fSD <- 807
mary <- 5513
leoZ <- (leo - mMean)/mSD
maryZ <- (mary - fMean)/fSD
Did Leo or Mary rank better in their respective groups? Explain your reasoning. Mary ranked better in respect to her group because she is fewer standard deviations away from the mean time in her group than Leo was for his group. Their Z scores are both positive, so they were both slower than the average racer in their groups.
What percent of the triathletes did Leo finish faster than in his group?
1 - pnorm(q = leo, mean = mMean, sd = mSD)
## [1] 0.1380342
1 - pnorm(q = mary, mean = fMean, sd = fSD)
## [1] 0.3774186
If these distributions were not nearly normal, the only answers that would change are d and e. The Z scores would still give us insight into how Mary and Leo performed with the respect to the mean finishing times of their groups.
3.18 (use qqnormsim from lab 3) Heights of female college students. Below are heights of 25 female college students.
The heights do seems to follow the 68-95-99.7% rule, and there only seem to be differences in these proportions due to rounding.
heights <- c(54,55,56,56,57,58,58,59,60,60,60,61,61,62,62,63,63,63,64,65,65,67,67,69,73)
mHgt <- 61.52
sdHgt <- 4.58
sum(heights > (mHgt - sdHgt) & heights < (mHgt + sdHgt))/length(heights)
## [1] 0.68
sum(heights > (mHgt - 2*sdHgt) & heights < (mHgt + 2*sdHgt))/length(heights)
## [1] 0.96
sum(heights > (mHgt - 3*sdHgt) & heights < (mHgt + 3*sdHgt))/length(heights)
## [1] 1
Looking at qqplots of normal distributions with the same mean and standard deviation as our heights, and comparing this to the qqplot of our heights, it appears that our data follow some of the normal distributions shown below. So, our data appears to also follow a normal distribution.
qqnormsim(heights)
3.22 Defective rate. A machine that produces a special type of transistor (a component of computers) has a 2% defective rate. The production is considered a random process where each transistor is independent of the others.
(0.98)^9 * (0.02)
## [1] 0.01667496
(0.98)^100
## [1] 0.1326196
This would be the expected value which is the mean, so 50 trials. The standard deviation is 49.497.
mean <- 1/0.02
mean
## [1] 50
sqrt((1-0.02)/(0.02^2))
## [1] 49.49747
mean <- 1/0.05
mean
## [1] 20
sqrt((1-0.05)/(0.05^2))
## [1] 19.49359
Increasing the probability of en event decreases the mean and the standard deviation of the wait time until success.
3.38 Male children. While it is often assumed that the probabilities of having a boy or a girl are the same, the actual probability of having a boy is slightly higher at 0.51. Suppose a couple plans to have 3 kids.
dbinom(2, 3, 0.51)
## [1] 0.382347
These possible orderings are: B B G B G B G B B
There are 3C2 = 3!/(2! * 1!) = (3 x 2 x 1) / (2 x 1) = 3 different scenarios.
Each of these scenarios have probability 0.51 x 0.51 x 0.49 = 0.127449. The probability that either of these scenarios will happen is 3 x 0.127449 = 0.38 from (a)
(0.51*0.51*0.49) * 3
## [1] 0.382347
There are 8C3 = (8 x 7 x 6) / (3 x 2) = 56 different ways to have 3 boys in a total of 8 kids. This is much more tedious than simply calculating using dbinom.
3.42 Serving in volleyball. A not-so-skilled volleyball player has a 15% chance of making the serve, which involves hitting the ball so it passes over the net on a trajectory such that it will land in the opposing team’s court. Suppose that her serves are independent of each other.
This is an application of the negative binomial distribution.
choose(9,2)*0.15^3*0.85^7
## [1] 0.03895012
0.15 since these events are independent
These probabilities are different because in (a) we are looking at the probability of an entire scenario occuring while in (b) we are looking at the individual probability of a next event happening that does not depend on what has happened before.