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
library(ggplot2)
1 - pnorm(-1.13, mean= 0, sd = 1)
## [1] 0.8707619
normalPlot(mean = 0, sd= 1, bounds= c(-1.13, 4))
(b) z > 0.18
pnorm(0.18, mean = 0, sd = 1)
## [1] 0.5714237
normalPlot(mean= 0, sd= 1, bounds =c(-4, 0.18))
(c) Z > 8
1-pnorm(8, mean=0, sd=1)
## [1] 6.661338e-16
normalPlot(mean=0, sd=1, bounds= c(8,Inf))
(d) |z| < 0.5
normalPlot(bounds=c(-0.5, 0.5))
Answer = 0.383
Group – > N(mean, sd) Women – > N(5261, 803) Men – > N(4313, 583)
(4948-4313)/583
## [1] 1.089194
z-score for Mary
(5513-5261)/807
## [1] 0.3122677
The z-score for Leo and Mary are 1.089 and 0.312, Leo’s time was 1.089 above the mean and Mary’s time was 0.312 above the mean in their groups.
As per the z-scores in part B, Leo performed 1.089 seconds faster than his group while Mary performed 0.312 seconds faster than her group.
pnorm(1.089)
## [1] 0.8619231
Leo performed 86.192 percent better than his group.
pnorm(0.312)
## [1] 0.6224797
Mary finished the race 62.247 percent faster than her group.
Yes, although z-scores would be still same but the percentiles would be changed due to abnormality in the data.
femheights <- 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(femheights)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 54.00 58.00 61.00 61.52 64.00 73.00
hist(femheights)
qqnormsim(femheights)
femheightsmean <- mean(femheights)
femheightssd <- mean(femheights)
pnorm(femheightsmean+femheightssd, mean= femheightsmean, sd= femheightssd)
## [1] 0.8413447
pnorm(femheightsmean+2*femheightssd, mean= femheightsmean, sd= femheightssd)
## [1] 0.9772499
pnorm(femheightsmean+3*femheightssd, mean= femheightsmean, sd= femheightssd)
## [1] 0.9986501
Based on the above answers, the data follows 68, 95, 99% rule and it seems that the data is almost normally distributed as 99.86 percent of the data exists within 3 standard deviation but it has not perfectly normal. It has few outliers.
pgeom(10-1, 0.02)
## [1] 0.1829272
1-pgeom(100,0.02)
## [1] 0.1299672
p <- 0.02
t <- 1/p
t
## [1] 50
sd <- sqrt((1-p)/p^2)
sd
## [1] 49.49747
p <- 0.05
t <- 1/p
t
## [1] 20
sd <- sqrt((1-p)/p^2)
sd
## [1] 19.49359
boy <- 0.51
n <- 3
x <- 2
dbinom(x, n, boy)
## [1] 0.382347
BBG, GBB, BGB
pboys <- ((.51*.51*.49)+(.49*.51*.51)+(.51*.49*.51))
pboys
## [1] 0.382347
Both answers are same
p <- 0.15
k <- 3
n <- 10
choose(n - 1, k - 1) * (1 - p)^ (n - k) * p^k
## [1] 0.03895012
All the events are independent so the probability of her 10th successful serve will still be 15 percent.
In part (a) specified pattern of success was asked while in part (b) only one serve was concerned.