#Using NormalPlot Under DATA606 package
#a.
normalPlot(bounds = c(-1.13,Inf))
#b.
normalPlot(bounds = c(-Inf,0.18))
#c.
normalPlot(bounds = c(8,Inf))
#d
normalPlot(bounds = c(-0.5,0.5))
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. (a) Write down the short-hand for these two normal distributions.
N(4313,583) and N(5261,807)
#Z=x-mU/sigma
leoZ=(4948-4313)/583
leoZ
## [1] 1.089194
MaryZ=(5513-5261)/807
MaryZ
## [1] 0.3122677
#Marys Z score is closer to her groups mean. They both have done better in their respective groups time.
#Ans : Mary has performed better than Leo in terms of speed, Because her Z -score is 0.31 and his is 1.08.
round(pnorm(4948,4313,583, lower.tail=FALSE),3)*100
## [1] 13.8
round(pnorm(5261,5513,807, lower.tail=FALSE),3)*100
## [1] 62.3
#Ans: We would not be able to compute B and E, if they distributions are not normal.
Below are heights of 25 female college students. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 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
femHeight=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)
mean=mean((femHeight))
sd=sd(femHeight)
# 68-95-99.7 Rule
#a
length(femHeight[femHeight < mean + sd & femHeight > mean - sd]) / length(femHeight)
## [1] 0.68
#b
length(femHeight[femHeight < mean + 2*sd & femHeight > mean - 2*sd]) / length(femHeight)
## [1] 0.96
#c
length(femHeight[femHeight < mean + 3*sd & femHeight > mean - 3*sd]) / length(femHeight)
## [1] 1
#a,b,c almost follow the 68-95-99.7 Rule.
qqnormsim(femHeight)
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.
# Using Geometric Dist.
p=.02
n=10
p*(1-p)^(n-1)
## [1] 0.01667496
(1-p)^100
## [1] 0.1326196
# fisrt defective piece
1/p
## [1] 50
#Standard Dev
sd=sqrt((1-p)/p^2)
sd
## [1] 49.49747
p=.05
# First defect hit
1/p
## [1] 20
#SD
sd=sqrt((1-p)/p^2)
sd
## [1] 19.49359
# Incresing the probability will lower the mean and standard deviation.
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.
p=.51
twoboys=dbinom(2,3,p)
twoboys
## [1] 0.382347
# 3 children with 2 as boys
#1. Boy, Boy, Girl
T1=.51 * .51 * .49
#2. Boy, Girl, Boy
T2= .51 * .49 * .51
#3. Girl, Boy, Boy
T3 = .49 * .51 *.51
T1 + T2 + T3
## [1] 0.382347
# The sample space will be choose(8,3)
choose(8,3)
## [1] 56
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. (a) What is the probability that on the 10th try she will make her 3rd successful serve?
# Creating a function to use n-1 and k-1 for negative binomial distribution.
mybinom=function(n,k,p){
choose(n-1,k-1) * p^k * ((1-p)^(n-k))
}
mybinom(10, 3, 0.15)
## [1] 0.03895012
# The Probability of her 10th serve being positive will be the original probability of 0.15
# In the first question, we used negative binomial distribution because we were trying to find the last successful event
# In the second question, we are calculating the probability of a single event is success or not.