R Markdown

Question 1

round(pnorm(979, 1300, sqrt(40000), lower.tail = FALSE), 4)
## [1] 0.9458

Question 2

round(pnorm(8340, 11000, sqrt(1960000), lower.tail = FALSE), 4)
## [1] 0.9713

Question 3

sd = 3000000
mean = 80000000
round(pnorm(85000000, mean, sd)- pnorm(83000000, mean, sd), 4)
## [1] 0.1109

Question 4

round(qnorm(1-.14, 456, 123), 0)
## [1] 589

Question 5

round(qnorm(.93, 6.13, .06), 2)
## [1] 6.22
round(qnorm(.7, 6.13, .06), 2)
## [1] 6.16

Question 6

round(qnorm(.55, 78.8, 9.8), 0)
## [1] 80
round(qnorm(.20, 78.8, 9.8), 0)
## [1] 71

Question 7

round(qnorm(.55, 21.2, 5.4), 1)
## [1] 21.9

Question 8

round(pbinom(10, 151, .09, lower.tail = TRUE), 4)
## [1] 0.192

Question 9

###lifetime mean = 48 months
###lifetime sd = 7
###sample size = 147
###figure out probability of sample mean being greater than 48.83 
###need to figure out sample stardard deviation. Divide st by square root of sample
Xsd <- 7/sqrt(147)
round(pnorm(48.83, 48, Xsd, lower.tail = FALSE), 4)
## [1] 0.0753

Question 10

###mean = 91
###sd = 10
###sample size = 68
###need to figure out the probability of the sample mean would be greater than 93.54
###figure out new standard deviation
Xsd <- 10/sqrt(68)
round(pnorm(93.54, 91, Xsd, lower.tail = FALSE), 4)
## [1] 0.0181

Question 11

## sample = 540
N <- 540
##population is .07
p <- .07
## standard deviation
std <- sqrt(p*(1-p)/N)
first <- round(pnorm(.1, p, std), 4)
second <- round(pnorm(.04, p, std), 4)
print(first - second)
## [1] 0.9938

Question 12

## sample = 602
n <- 602
##the population
p <- .23
##standard deviation
std <- sqrt(p*(1-p)/N)
first <- round(pnorm(.17, p, std), 4)
second <- round(pnorm(.27, p, std), 4)
print(abs(first - second))
## [1] 0.9859

Question 13

###mean=3.9
###standard deviation=.8
###sample size N = 208
###80% confidence level, 
###3.9 + or - t(n-1)(.8/sqrt(208))
N <- 208
ci <- .8
p <- (1-.8)/2
t <- qt(p, N-1)
upper <- round(3.9 + t * (.8/sqrt(N)), 1)
lower <- round(3.9 - t * (.8/sqrt(N)), 1)
print(upper)
## [1] 3.8
print(lower)
## [1] 4

Question 14

###sample size = 7472
N <- 7472
###mean = 16.6
m <- 16.6
###standard deviation = 11
sd <- 11
###confidence interval = 98
ci <- .98
###probability
p <- (1- ci)/2
t <- qt(p, N-1)
upper = round(m + t * (sd)/sqrt(N), 1)
lower = round (m - t * (sd)/sqrt(N), 1)
print (upper)
## [1] 16.3
print (lower)
## [1] 16.9

Question 15

The picture that best describes this problem is the top right graph

N <- 26
p <- .05
t <- round(qt(p,N-1), 3)
print (t)
## [1] -1.708

Question 16

###step 1
av <-c(383.6, 347.1, 371.9, 347.6, 325.8, 337)
round(mean(av), 2)
## [1] 352.17
m <- round(mean(av), 2)
###step 2
round(sd(av, na.rm = FALSE), 2)
## [1] 21.68
sd <- round(sd(av, na.rm = FALSE), 2)
###step 3
N <- length(av)
ci <- .90
p <- (1-ci)/2
t <- round(qt(p, N-1), 3)
print (t)
## [1] -2.015
###step 4
upper <- round(m + t * (sd)/sqrt(N), 2)
lower <- round(m - t * (sd)/sqrt(N), 2)
print (upper)
## [1] 334.34
print (lower)
## [1] 370

Question 17

###step 1
ci <- .8
p <- (1 - ci)/2
N <- 16
m <- 46.4
sd <- 2.45
t <- round(qt(p, N-1), 3)
print (t)
## [1] -1.341
###step 2
upper <- round(m + t * (sd)/sqrt(N), 1)
lower <- round(m - t * (sd)/sqrt(N), 1)
print (upper)
## [1] 45.6
print (lower)
## [1] 47.2

Question 18

###z value for 99% confidence level
z <- 2.576
m <- 8
sd <- 1.9
e <- .13
n <- round((z * sd/e)^2, 0)
print (n)
## [1] 1417

Question 19

###z value for 95% confidence level
z <- 1.960
m <- 12.6
sd <- sqrt(3.61)
e <- .19
n <- round((z * sd/e)^2, 0)
print (n)
## [1] 384

Question 20

###step 1
###sample size 2089
N <- 2089
n <- 1734
p <- round(1 -(n/N), 3)
print(p)
## [1] 0.17
###step 2
###z value for 98% confidence level 
z <- 2.326
###above reading level
n1 <- 1734
###below reading level
n2 <- (N - n1)
###find the standard error at or below reading level
se <- sqrt ((p*(1-p))/n2)
print (se)
## [1] 0.01993652
upper <- round(p - z * se, 3)
lower <- round(p + z * se, 3)
print (upper)
## [1] 0.124
print (lower)
## [1] 0.216

Question 21

###step 1
N <- 474
n <- 156
p <- round((n/N), 3)
print (p)
## [1] 0.329
###step 2
###z value for 95% confidence level
z <- 1.960
###spilled
n1 <- 156
###find the standard error of tankers that have spilled
se <- sqrt((p*(1-p))/n1)
print (se)
## [1] 0.0376181
upper <- round(p - z * se, 3)
lower <- round(p + z * se, 3)
print (upper)
## [1] 0.255
print (lower)
## [1] 0.403

Bonus Questions - Show all work

###1)The cumulative distribution function of the random variable X is 

####F(x)^(x) = 1 - e^(-ax), a > 0, x > 0

####What is the probability density function?  
####What is the expected value? 
####What is the variance?  
####Determine P(X<.5 | alpha =1)

###Solutions
####PDF?
####f(x)= (df(x))/d(x)
####(d/dx)(1) = 0
####(d/dx)(0) = (d/d(-ax))*(e^-ax)*(d/dx)(-ax)
####(d/d(-ax))*(e^-ax) = -e^-ax
####(d/dx(-ax))*(-ax) = -a
####=e^-ax(-a)
####-ae^-ax
####0 - (-ae^(-ax))
###PDF = ae^(-ax)
####expected value? -- I'm having a hard time figuring this out
###E(V) = 1/a + c
####variance? -- I'm having a hard time figuring this out, too
###VA(x) = 1/a^2
###Determine P(X<.5 | alpha =1)
x<- .5
a <- 1
PDF = a * exp(-a * x)
print (PDF)
## [1] 0.6065307

P(X < .5 | a = .6065307)

###2) The probability mass function for a particular random variable Y is 
####f(y)^y = ((e^-b)*(b^y)/y!), y e [0,1, ... inf], b >0
###What is E(Y)? What is E(Y^2)? What is the Variance?
### E(Y) is the mean
### E(Y^2) is the variance