Homework

3.2)

# a

a_answer<-1-pnorm(-1.13)

a_answer
## [1] 0.8707619
# draw the normal curve
curve(dnorm(x,0,1), xlim=c(-9,9), main="Normal density")
 
# define shaded region
from.z <- -1.13
to.z <- 9
 
S.x  <- c(from.z, seq(from.z, to.z, 0.01), to.z)
S.y  <- c(0, dnorm(seq(from.z, to.z, 0.01)), 0)
polygon(S.x,S.y, col="red")

# b 

b_answer<-pnorm(0.18)

b_answer
## [1] 0.5714237
# draw the normal curve
curve(dnorm(x,0,1), xlim=c(-9,9), main="Normal density")
 
# define shaded region
from.z <- -9
to.z <- 0.18
 
S.x  <- c(from.z, seq(from.z, to.z, 0.01), to.z)
S.y  <- c(0, dnorm(seq(from.z, to.z, 0.01)), 0)
polygon(S.x,S.y, col="red")

# c 

c_answer<-1-pnorm(8)

c_answer
## [1] 6.661338e-16
# draw the normal curve
curve(dnorm(x,0,1), xlim=c(-9,9), main="Normal density")
 
# define shaded region
from.z <- 8
to.z <- 9
 
S.x  <- c(from.z, seq(from.z, to.z, 0.01), to.z)
S.y  <- c(0, dnorm(seq(from.z, to.z, 0.01)), 0)
polygon(S.x,S.y, col="red")

# d

d_answer<-pnorm(0.5)-pnorm(-0.5)

d_answer
## [1] 0.3829249
# draw the normal curve
curve(dnorm(x,0,1), xlim=c(-9,9), main="Normal density")
 
# define shaded region
from.z <- -0.5
to.z <- 0.5
 
S.x  <- c(from.z, seq(from.z, to.z, 0.01), to.z)
S.y  <- c(0, dnorm(seq(from.z, to.z, 0.01)), 0)
polygon(S.x,S.y, col="red")

3.4) a) Shorthand for group (a) is N(4333,583) and for group (b) is (5261,807).

 b) Leo's z score is (4948-4333)/583 or 1.054889 and Mary's is (5513-5261)/807 or 0.3122677. Both Leo and Mary are slower than average member of their group (z>0).   
 
 
 c) These z-scores show that Leo performed worse than Mary for their corresponding groups. His z score is higher than Mary's.  
 
 
 d) ~14.6%.  
 
 
 e) ~37.7%.  
 
 
 f) I do not think (b) and (c) will change, but (d) and (e) will need be recalculated based on correct distribution.
 
leo_z<-(4948-4333)/583

leo_z
## [1] 1.054889
mary_z<-(5513-5261)/807

mary_z
## [1] 0.3122677
leo_d<-1-pnorm(1.054889)

leo_d
## [1] 0.145738
mary_e<-1-pnorm(0.3122677)

mary_e
## [1] 0.3774185

3.18) a) mean + strd dev =61.52+4.58=66.1 and mean - strd dev = 56.94, 17 women fall into the category and 17/25=0.68. It worked!! mean + 2 strd dev =61.52+4.58x2=70.68 and mean - 2 strd dev = 52.36, 17 women fall into the category and 24/25=0.98. Slightly higher than 0.95. For 4 standard deviations we will have all 25 students or 1. Which is again slightly higher than 99.7. However, considering small sample it seems close enough.

  b) Both from pictures in book and Shapiro-Wilks test, it appears that the data is distributed normally.
r68p<-61.52+4.58

r68p
## [1] 66.1
r68n<-61.52-4.58

r68n
## [1] 56.94
perc68<-17/25

perc68
## [1] 0.68
r95p<-61.52+4.58*2

r95p
## [1] 70.68
r95n<-61.52-4.58*2

r95n
## [1] 52.36
perc95<-17/25

perc95
## [1] 0.68
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,74)

hist(height)

shapiro.test(height)
## 
##  Shapiro-Wilk normality test
## 
## data:  height
## W = 0.96831, p-value = 0.6025

3.22) a) 0.98^9 x 0.02=0.01634146.

  b) 0.98^100=0.1326196.
  
  c) 0.98*0.02+0.98^2x0.02+0.98^3x0.02+0.98 ^ 4x0.02+.. so on, mean=1/P, or 1/0.02, or 50, standard deviation is sqrt((1-0.02)/(0.02^2)) or 49.49747.
  
  d) 20. Str Dev would be sqrt(0.95/0.0025) or 19.49359
  
  e) Event will happened faster if probability increases
Pr_a<-0.98^10*0.02

Pr_a
## [1] 0.01634146
Pr_b<-0.98^100

Pr_b
## [1] 0.1326196
SD_c<-((1-.02)/(0.02^2))^.5

SD_c
## [1] 49.49747
SD_d<-((1-.05)/(0.05^2))^.5

SD_d
## [1] 19.49359

3.38) a) Binomial distribution. 3!/1!(3-1)!0.51^2x0.49=3*0.51^2x0.49 or 0.382347

  b) BBG, BGB, and GBB. 0.51^2x0.49+0.51x0.49x0.51+0.49x0.51^2 or 0.382347
  
  c) Formula in (b) will become ridiculously long and hard to compute
a<-3*.51^2*.49

a
## [1] 0.382347

3.42) a) Binomial N=9, K=2 and the last Probability is 0.15. (9!/(2!x7!)x0.15^ 2x0.85 ^7)*0.15 =0.03895012

  b) 0.15
  
  c) In (a) we look at 10 tries as whole calculating all possible outcomes that fit our scenarios (conditional probability) while in (b) we are given information about         first 9 events and 10th is independent of them (independent event)
a<-(9*8/2)*(.15^2)*(.85^7)*.15

a
## [1] 0.03895012