library(DATA606)
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.
library(qualityTools)
## Loading required package: Rsolnp
## Loading required package: MASS
##
## Attaching package: 'qualityTools'
## The following object is masked from 'package:stats':
##
## sigma
DATA606::normalPlot(mean = 0, sd = 1, bounds=c(-4,-1.35))
library(qualityTools)
DATA606::normalPlot(mean = 0, sd = 1, bounds=c(1.48,4), tails = FALSE)
library(qualityTools)
DATA606::normalPlot(mean = 0, sd = 1, bounds=c(-0.4,1.5), tails = FALSE)
mu <- 0
sd <- 1
Z <- 2
x <- Z * sd + mu
x1 <- -x
x2 <- x
p1 <- pnorm(x1, mean = 0, sd = 1)
p2 <- 1- pnorm(x2, mean = 0, sd = 1)
p1 + p2
## [1] 0.04550026
DATA606::normalPlot(mean = 0, sd = 1, bounds = c(x1, x2), tails = TRUE)
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.
women_mean=5261
women_sd=807
men_mean=4313
men_sd=583
Leo_z_score<-(4948-men_mean)/men_sd
Leo_z_score
## [1] 1.089194
mary_z_score<-(5513-women_mean)/women_sd
mary_z_score
## [1] 0.3122677
Did Leo or Mary rank better in their respective groups? Explain your reasoning. Since Mary is closer to mean, I believe the answer is Mary
What percent of the triathletes did Leo finish faster than in his group?
pnorm(Leo_z_score,lower.tail=FALSE)
## [1] 0.1380342
13.8%
pnorm(mary_z_score,lower.tail=FALSE)
## [1] 0.3774186
37.7%
I believe NO. The performance from leo and mary are relative to other participants of their groups.
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} \]
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)
heights_mean<-mean(heights)
heights_sd<-sd(heights)
#68%
1-2*pnorm(heights_mean+heights_sd,mean=heights_mean,sd=heights_sd,lower=FALSE)
## [1] 0.6826895
#95%
1-2*pnorm(heights_mean+2*heights_sd,mean=heights_mean,sd=heights_sd,lower=FALSE)
## [1] 0.9544997
#99.7%
1-2*pnorm(heights_mean+3*heights_sd,mean=heights_mean,sd=heights_sd,lower=FALSE)
## [1] 0.9973002
heights_mean<-mean(heights)
heights_sd<-sd(heights)
hist(heights, probability = TRUE,ylim = c(0, 0.1))
x <- 40:80
y <- dnorm(x = x, mean = heights_mean, sd = heights_sd)
lines(x = x, y = y, col = "green")
qqnorm(heights)
qqline(heights)
DATA606::qqnormsim(heights)
# Use the DATA606::qqnormsim function
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.
(0.98^9)*0.02
## [1] 0.01667496
0.98^100
## [1] 0.1326196
1/0.02
## [1] 50
sqrt((1-0.02)/(0.02^2))
## [1] 49.49747
1/0.05
## [1] 20
sqrt((1-0.05)/(0.05^2))
## [1] 19.49359
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
((0.51^2)*0.49)+((0.51^2)*0.49)+((0.51^2)*0.49)
## [1] 0.382347
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.
p <- .15
n <- 10
k <- 3
P <- choose(n-1, k-1) *(1-p)^(n-k)*p^k
P
## [1] 0.03895012
10th serve success probability is 0.15, since her serves are independent of each other.
in question [a] we are calculating a specific probability of having 3 successes out of 10. later in question [b] we are calculating the probability of one successful serve and since the serves are independent, it does not matter what happened in previous serves.