Round your answer to four decimal places.
plot(x = 0:20,
y = dbinom(x = 0:20,
size = 20,
prob = .5
),
type = 'h',
main = 'Binomial Distribution (n=20, p=0.5)',
ylab = 'Probability',
xlab = '# Successes',
lwd = 3
)
# pbinom gets same cumulative probability
dbinom(x = 9:12, size = 20, prob = .5)
## [1] 0.1601791 0.1761971 0.1601791 0.1201344
sum(dbinom(x = 9:12, size = 20, prob = .5))
## [1] 0.6166897
round(x = sum(dbinom(x = 9:12, size = 20, prob = .5)), digits = 4)
## [1] 0.6167
0.6167
Round your answer to four decimal places.
plot(x = 0:13,
y = dbinom(x = 0:13,
size = 13,
prob = .2
),
type = 'h',
main = 'Binomial Distribution (n=13, p=0.2)',
ylab = 'Probability',
xlab = '# Successes',
lwd = 3
)
dbinom(x = 4:5, size = 13, prob = .2)
## [1] 0.15354508 0.06909529
sum(dbinom(x = 4:5, size = 13, prob = .2))
## [1] 0.2226404
round(x = sum(dbinom(x = 4:5, size = 13, prob = .2)),digits = 4)
## [1] 0.2226
0.2226
Round your answer to four decimal places.
plot(x = 0:10,
y = dpois(x = 0:10,
lambda = 4.2
),
type = 'h',
main = 'Poisson Distribution (lambda=4.2)',
ylab = 'Probability',
xlab = '# Special Orders',
lwd = 3
)
ppois(3, lambda = 4.2)
## [1] 0.3954034
round(x = ppois(3, lambda = 4.2), digits = 4)
## [1] 0.3954
0.3954
Round your answer to four decimal places.
plot(x = 0:3,
y = dhyper(x = 0:3,
m = 6,
n = 17-6,
k = 3
),
type = 'h',
main = 'Hypergeometric Distribution',
ylab = 'Probability',
xlab = '# Contaminated Bottles',
lwd = 3
)
res = sum(dhyper(x = 0:1, m = 6, n = 17-6, k = 3))
round(x = res, digits = 4)
## [1] 0.7279
0.7279
Round your answer to four decimal places.
plot(x = 0:6,
y = dhyper(x = 0:6,
m = 6,
n = 19,
k = 6
),
type = 'h',
main = 'Hypergeometric Distribution (N=25, n=6, S=6)',
ylab = 'Probability',
xlab = '# of Employees Over 50',
lwd = 3
)
res <- sum(dhyper(x = 2:6, m = 6, n = 19, k = 6))
round(res, 4)
## [1] 0.4529
0.4259
Round your answer to four decimal places.
mu <- 800
sigma <- 300
x <- seq(from = mu - 3*sigma,
to = mu + 3*sigma,
length.out = 1000
)
pdf <- dnorm(x = x,
mean = mu,
sd = sigma
)
plot(x = x,
y = pdf,
type = 'l',
col = 'blue',
lwd = 2,
xlab = 'Weight ',
ylab = 'Density',
main = 'Normal Distribution with Mean 800 and SD 300'
)
x_shade <- seq(from = 1040,
to = 1460,
length.out = 1000
)
pdf_shade <- dnorm(x = x_shade,
mean = mu,
sd = sigma
)
polygon(x = c(x_shade, rev(x_shade)),
y = c(pdf_shade, rep(x = 0,
times = length(pdf_shade)
)
),
col = 'red',
border = NA
)
res <- pnorm(q = 1460, mean = mu, sd = sigma) - pnorm(q = 1040, mean = mu, sd = sigma)
round(res, 4)
## [1] 0.198
0.198
Round your answer to four decimal places.
mu <- 106
sigma <- 4
x <- seq(from = mu - 3*sigma,
to = mu + 3*sigma,
length.out = 1000
)
pdf <- dnorm(x = x,
mean = mu,
sd = sigma
)
plot(x = x,
y = pdf,
type = 'l',
col = 'blue',
lwd = 2,
xlab = 'Diameter',
ylab = 'Density',
main = 'Normal Distribution with Mean 106 and SD 4'
)
x_shade <- seq(from = 103,
to = 111,
length.out = 100
)
pdf_shade <- dnorm(x = x_shade,
mean = mu,
sd = sigma
)
polygon(x = c(x_shade, rev(x_shade)),
y = c(pdf_shade, rep(x = 0,
times = length(pdf_shade)
)
),
col = 'red',
border = NA
)
res <- pnorm(q = 111, mean = mu, sd = sigma) - pnorm(q = 103, mean = mu, sd = sigma)
round(res, 4)
## [1] 0.6677
0.6677
Round your answer to the nearest hundredth (2 decimal places)
mu <- 3.34
sigma <- 0.07
x <- seq(from = mu - 3*sigma,
to = mu + 3*sigma,
length.out = 1000
)
pdf <- dnorm(x = x,
mean = mu,
sd = sigma
)
plot(x = x,
y = pdf,
type = 'l',
col = 'blue',
lwd = 2,
xlab = 'Length',
ylab = 'Density',
main = 'Normal Distribution with Mean 3.34 and SD 0.07'
)
lower <- qnorm(p = 0.03, mean = mu, sd = sigma)
upper <- qnorm(p = 0.97, mean = mu, sd = sigma)
abline(v = lower, col = 'cyan', lty = 2)
abline(v = upper, col = 'yellow', lty = 2)
round(lower, 2)
## [1] 3.21
round(upper, 2)
## [1] 3.47
3.21, 3.47
Round your answer to the nearest whole number, if necessary
mu <- 75.8
sigma <- 8.1
x <- seq(from = mu - 3*sigma,
to = mu + 3*sigma,
length.out = 1000
)
pdf <- dnorm(x = x,
mean = mu,
sd = sigma
)
plot(x = x,
y = pdf,
type = 'l',
col = 'blue',
lwd = 2,
xlab = 'Scores',
ylab = 'Density',
main = 'Normal Distribution with Mean 75.8 and SD 8.1'
)
lower <- qnorm(p = 0.91, mean = mu, sd = sigma)
abline(v = lower, col = 'yellow', lty = 2)
round(lower)
## [1] 87
87
Round your answer to four decimal places.
mu <- 155 * 0.61
sigma <- sqrt(155 * 0.61 * 0.39)
x <- seq(from = mu - 3*sigma,
to = mu + 3*sigma,
length.out = 1000
)
pdf <- dnorm(x = x,
mean = mu,
sd = sigma
)
plot(x = x,
y = pdf,
type ='l',
lwd = 2,
col = "blue",
xlab = "Number of computers",
ylab = "Density",
main = "Approximate the (binomial) probability using the normal distribution"
)
x_shade <- seq(from = 95.5,
to = 96.5,
length.out = 1000
)
pdf_shade <- dnorm(x = x_shade,
mean = mu,
sd = sigma
)
polygon(x = c(x_shade, rev(x_shade)),
y = c(pdf_shade, rep(x = 0, times = length(x_shade))),
col = 'red',
border = NA
)
abline(v = 95.5, col = "yellow", lty = 2)
abline(v = 96.5, col = "yellow", lty = 2)
res <- pnorm(96.5, mean=mu, sd=sigma) - pnorm(95.5, mean=mu, sd=sigma)
round(res, 4)
## [1] 0.0638
0.0638