Area under the curve, Part I. (4.1, p. 142) What percent of a standard normal distribution \(N(\mu=0, \sigma=1)\) is found in each region? Be sure to draw a graph.
## 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
## [1] 0.1292381
## [1] 0.06943662
## [1] 0.5886145
## [1] 0.02275013
## [1] 1.089194
## [1] 0.3122677
## [1] 0.1380342
## [1] 0.3774186
Triathlon times, Part I (4.4, p. 142) 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:
Remember: a better performance corresponds to a faster finish.
# 4.4 (a)
#Distribution for Men's group (Ages 30-34) is N(mean = 4313, std. dev. = 583)
#Distribution for Women's group (Ages 25-29) is N(mean = 5261, std. dev. = 807)
# 4.4 (b)
# men's team's mean and std dev
m_mean <- 4313
m_sd <- 583
# women's team's mean and std dev
w_mean <- 5261
w_sd <- 807
# Leo's z-score
z_leo <- (4948 - m_mean) / m_sd
z_leo
## [1] 1.089194
# Mary's z-score
z_mary <- (5513 - w_mean) / w_sd
z_mary
## [1] 0.3122677
# 4.4 (c) Did Leo or Mary rank better in their respective groups? Explain your reasoning.
# Solution: Lower z-score for Mary indicates that she performed better compared to Leo. A -ve z-score would # have meant that she performed better than the average.
# 4.4 (d) What percent of the triathletes did Leo finish faster than in his group?
# From Leo's z-score
1 - pnorm(z_leo, 0, 1)
## [1] 0.1380342
normalPlot ( bounds = c(-Inf, z_leo))
# Looking at the plot, Leo performed better than the 13.8%(1 - 0.862) of the triathletes in his group.
# 4.4 (e) What percent of the triathletes did Mary finish faster than in her group?
1 - pnorm(z_mary, 0, 1)
## [1] 0.3774186
normalPlot ( bounds = c(-Inf, z_mary))
# Looking at the plot, Mary performed better than the 37.7%(1 - 0.623) of the triathletes in her group.
# 4.4 (e)
# Solution: The answer for (b) could still be reliably calculated and the outcome could be explained in (c). # However, for (d) and (e), we would not be able to figure out the answer given that we need the assumption # of normal distribution to complete the calculations.
Heights of female college students Below are heights of 25 female college students.
\[ \stackrel{1}{54}, \stackrel{2}{55}, \stackrel{3}{56}, \stackrel{4}{56}, \stackrel{5}{57}, \stackrel{6}{58}, \stackrel{7}{58}, \stackrel{8}{59}, \stackrel{9}{60}, \stackrel{10}{60}, \stackrel{11}{60}, \stackrel{12}{61}, \stackrel{13}{61}, \stackrel{14}{62}, \stackrel{15}{62}, \stackrel{16}{63}, \stackrel{17}{63}, \stackrel{18}{63}, \stackrel{19}{64}, \stackrel{20}{65}, \stackrel{21}{65}, \stackrel{22}{67}, \stackrel{23}{67}, \stackrel{24}{69}, \stackrel{25}{73} \]
Yes, it seems to follow a normal distribution and all the data points seem to fall within 68-95-99.7% Rule.
Yes, the data is following the normal distribution as majority of the data points fall under the bell curve and are distributed very close to the regression line except for a few that might be outliers.
# Use the DATA606::qqnormsim function
DATA606::qqnormsim(heights)
Defective rate. (4.14, p. 148) 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.
# Solution (a)
pgeom(10-1,.02)
## [1] 0.1829272
# There is a probability of 0.183 that the 10th transistor is the first one with a defect.
# Solution (b)
1-pgeom(100,.02)
## [1] 0.1299672
# There is a probability of 0.13 that the machine produces no defective transistors in a batch of 100.
# Solution (c)
# The probability for the sample is:
prob <- 0.02
# The prabability of the first defective piece is:
def_prob <- (1 / prob) / 100
def_prob
## [1] 0.5
# The probability is .5.
sd <- sqrt((1 - prob)/(prob^2))
sd
## [1] 49.49747
# The stardard deviation is 49.497.
# Solution (d)
prob2 <- 0.05
def_prob2 <- (1 / prob2) / 100
def_prob2
## [1] 0.2
# The probability in this is case 0.2.
sd2 <- sqrt((1 - prob2)/(prob2^2))
sd2
## [1] 19.49359
# The standard deviation is 19.494.
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.
# Solution (a)
dbinom(2,3,0.51)
## [1] 0.382347
# The probability is 0.382.
# Solution (b)
# The probability of having a girl is 0.49 (1 - 0.5).
# The possible ordering is ((.49*.51*.51), (.51*.49*.51), (.51*.51*.49))
boys_prob <- ((.49*.51*.51)+(.51*.49*.51)+(.51*.51*.49))
boys_prob
## [1] 0.382347
# The probability is 0.382 and the answer matches with (a).
# Solution (c)
# Amount of possible combinations is 56, which will entail a much longer calculation.
choose(n=8, k=3)
## [1] 56
# The answer could be found using a simple formula:
dbinom(3, 8, 0.51)
## [1] 0.2098355
# The probability will be 0.21 in both cases.
Serving in volleyball. (4.30, p. 162) 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.
n_try <- 10
n_success <- 3
prob_sucess <- 0.15
prob_unsuccess <- (1 - 0.15)
prob3 <- (factorial(n_try - 1)/(factorial(n_success - 1)*factorial(n_try - n_success))*prob_sucess^n_success*prob_unsuccess^(n_try - n_success))
prob3
## [1] 0.03895012
# The probability that on the 10th try player will make her 3rd successful serve is 0.39.
# Solution (b)
# The probability will still be 0.15 as each attempt is independant.
# Part (a) was based on a combination of events whereas part (b) was an independant event.