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
# p(z > -1.13)
normalPlot(bounds = c(-1.13,4))
# p(z < 0.18)
normalPlot(bounds = c(-4,0.18))
# p(z > 8)
normalPlot(bounds = c(8,10))
# |Z| < 0.5
normalPlot(bounds = c(-.5,.5))
#b)
Leo.z.score = (4948 - 4313) / 583.0
Leo.z.score
## [1] 1.089194
Mary.z.score = (5513 - 5261 ) / 807
Mary.z.score
## [1] 0.3122677
#c)
#Mary is better ranked
#mary
round(pnorm(5513, 5261, 807), 4)
## [1] 0.6226
#leo
round(pnorm(4948, 4313, 583), 4)
## [1] 0.862
height = 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 )
#a)
# 68-95-99.7% Rule
pnorm(mean(height)+sd(height), mean = 61.52, sd = 4.58) - pnorm(mean(height)-sd(height), mean = 61.52, sd = 4.58)
## [1] 0.6830768
pnorm(mean(height) + sd(height) * 2, mean = 61.52, sd = 4.58) - pnorm(mean(height)-sd(height) *2, mean = 61.52, sd = 4.58)
## [1] 0.9546724
pnorm(mean(height)+sd(height) *3, mean = 61.52, sd = 4.58) - pnorm(mean(height)-sd(height) *3, mean = 61.52, sd = 4.58)
## [1] 0.9973214
#b)
qqnorm(height)
qqline(height)
qqnormsim(height)
#looking a the graph it seem nearly normal.
#a)
(0.98) ^ 9 * 0.02
## [1] 0.01667496
#b)
.98 ^ 100
## [1] 0.1326196
#c)
1/.02
## [1] 50
#d)
sqrt((1-.05)/(.05)^2)
## [1] 19.49359
#increasing the probability of an event decreased the waiting time.
#a)
n <- 3
x <-2
dbinom(x, n, 0.51)
## [1] 0.382347
#b)
#part a and b the same match
boy.p <- 0.51
girl.p <- 0.49
(boy.p *boy.p * girl.p) + (boy.p * girl.p * boy.p) + (girl.p * boy.p * boy.p)
## [1] 0.382347
#a)
p <- 0.15
k <- 3
n <- 10
round(choose(n - 1, k - 1) * ((1 - p)^ (n - k) * p^k),4)
## [1] 0.039
Independent event and will be 15 %.
That’s even the same scenario on part a we still count all 3 serves while on part we already have specific 2 successful serve in nine attempts which as independent event we just focus on the last success serve event.