library(IS606)
##
## Welcome to CUNY IS606 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='IS606') will list the demos that are available.
##
## Attaching package: 'IS606'
## The following object is masked from 'package:utils':
##
## demo
library(StMoSim)
## Warning: package 'StMoSim' was built under R version 3.2.3
## Loading required package: RcppParallel
## Warning: package 'RcppParallel' was built under R version 3.2.3
## Loading required package: Rcpp
## Warning: package 'Rcpp' was built under R version 3.2.3
3.2 Area under the curve, Part II. What percent of a standard normal distribution N(µ = 0, = 1) is found in each region? Be sure to draw a graph.
For a standard normal distribution, we can use the default mean=0 and sd=1 for the normalPlot function.
normalPlot(bounds=(c(1.13,Inf)))
normalPlot(bounds=(c(-Inf,0.18)))
normalPlot(bounds=(c(8,Inf)))
normalPlot(bounds=(c(-Inf,0.5)))
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 fiishing 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.
N(µ=4313, sd=583) for Men and N(µ=5261, sd=807) for women
z_leo <- (4948-4313)/583
z_leo
## [1] 1.089194
z_mary <- (5513-5261)/807
z_mary
## [1] 0.3122677
Leo is 1.09 standard deviations above the mean and Mary is only 0.31 standard deviation above the mean. So Mary did better in her group than Leo (in this case, the lower the z-value, the faster is your finishing time)
Mary rank better than Leo. In this case, the lower the z-value the higher is your rank.
pnorm(1.09,lower.tail=FALSE)
## [1] 0.1378566
pnorm(0.31,lower.tail=FALSE)
## [1] 0.3782805
No, the answers will be same. The z score and corresponding percentile score gives your performance relative the other participants. So if you are in the 37.8 percentile, it does not matter whether the distribution is normal, multimodal, skewed, etc…you are still in that cut-off line on the graph where 37.8% of the area is computed.
3.18 Heights of female college students. Below are heights of 25 female college students.
hgt <- 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)
summary(hgt)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 54.00 58.00 61.00 61.52 64.00 73.00
hist(hgt)
qqnormSim(hgt, nSim=500)
pnorm(61.52+4.58,mean=61.52,sd=4.58)
## [1] 0.8413447
pnorm(61.52+2*4.58,mean=61.52,sd=4.58)
## [1] 0.9772499
pnorm(61.52+3*4.58,mean=61.52,sd=4.58)
## [1] 0.9986501
No. The sample data above does not follow the 68-95-99.7% rule. The distribution seems to be skewed to the left.
Not from the 68-95-99.7% rule. Although, when executing the Q-Q plot simulation (500 times), it seems that all the point are within the gray area (even the high value outliers), suggesting that the sample data is normal (by this standards).
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.
define p(sucess) as the probability the transistor is defective = .02
pgeom(10-1,0.02)
## [1] 0.1829272
The probabilty that the 101th transistor is defective
pgeom(100,0.02)
## [1] 0.8700328
#mean
1/0.02
## [1] 50
#standard deviation
sqrt((1-0.02)/0.02^2)
## [1] 49.49747
#mean
1/0.05
## [1] 20
#standard deviation
sqrt((1-0.05)/0.05^2)
## [1] 19.49359
increasing the probability of success decreases the wait time for success and decreases the spread in the distribution
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
# BBG GBB BGB #
(0.51^2)*0.49*3
## [1] 0.382347
Confirm that your answers from parts (a) and (b) match. (c) If we wanted to calculate the probability that a couple who plans to have 8 kids will have 3 boys, briefly describe why the approach from part (b) would be more tedious than the approach from part (a).
My answer for (a) and (b) matched - 0.382347. The approach from part (b) will be more tedious because you have to manually draw all the possible combinations of 3 boys from 8 siblings while in (a) the choose function will compute that number for you
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.
choose(9,2)*0.15^3*0.85^7
## [1] 0.03895012
Since each attempt is independent of each other and the probability of success is the same for each attempt, the probability of success on the 10th serve is the same as the probability of success for the previous 9 servers - 0.15
(a) fits the case of a negative binonmial distribution - (probability of kth success on the nth trial). For (a) we are looking for the 3rd success (the last attempt being a success) after the 10th attempt. For (b), we are not concern about the probabilities of the first 9 attempts - we are only concern about the probability of success on the 10 attempt.