# Create graph showing binomial distribution of new car buyers who prefer the color red chosen from a sample size of 20
plot(0:20, dbinom(0:20, size = 20, prob = .5), type = "h",
main = expression(paste("Binomial Distribution (n = 20, ", pi," = 0.5)")),
xlab = "Number of Buyers Who Prefer Red",
ylab = "Probability",
lwd = 3,
col = "red"
)
\[P(9 \le x \le 12) \mid n = 20, \pi = 0.5\]
# Calculate probability that the number of buyers that prefer red is between 9 and 12
red <- pbinom(q = 12,
size = 20,
prob = .5,
lower.tail = TRUE
) -
pbinom(q = 8,
size = 20,
prob = .5,
lower.tail = TRUE
)
# Round to four decimal places
round(red, digits = 4)
## [1] 0.6167
# Graph binomial distribution of the number of lightbulbs that are defective chosen from a sample size of 13
plot(0:13, dbinom(0:13, size = 13, prob = .2), type = "h",
main = expression(paste("Binomial Distribution (n = 13, ", pi," = 0.2)")),
xlab = "Number of Defective Lightbulbs",
ylab = "Probability",
lwd = 3,
col = "black"
)
\[P(3 < x < 6) \mid n = 13, \pi = 0.20\]
# Calculate probability that the number of defective lightbulbs is between 3 and 6
bulbs <- pbinom(q = 5,
size = 13,
prob = .2,
lower.tail = TRUE
) -
pbinom(q = 3,
size = 13,
prob = .2,
lower.tail = TRUE
)
# Round to four decimal places
round(bulbs, digits = 4)
## [1] 0.2226
# Graph poisson distribution of the number of special orders sent out by an automotive dealership every day
plot(0:12, dpois(0:12, lambda = 4.2), type = "h",
main = expression(paste("Poisson Distribution (", lambda," = 4.2)")),
xlab = "Number of Special Orders",
ylab = "Probability",
lwd = 3,
col = "black"
)
\[P(x \le 3), \lambda = 4.2\]
# Calculate probability that the number of special orders sent out in one day will be 3 or less
special_orders <- ppois(q = 3,
lambda = 4.2,
lower.tail = TRUE
)
# Round to four decimal places
round(special_orders, digits = 4)
## [1] 0.3954
# Graph hypergeometric distribution of the number of tested bottles that are contaminated, considering that 6 out of a sample size of 17 are contaminated, and that only 3 of those 17 are selected to be tested
plot(0:17, dhyper(0:17, m = 6, n = 17-6, k = 3), type = "h",
main = "Hypergeometric Distribution (S = 6, F = 11, n = 3)",
xlab = "Number of Tested Bottles That Are Contaminated",
ylab = "Probability",
lwd = 3,
col = "black"
)
\[P(x < 2) \mid S = 6, F = 11, n = 3\]
# Calculate probability that less than two of the bottles selected to be tested are contaminated
bottles <- phyper(q = 1,
m = 6,
n = 17-6,
k = 3,
lower.tail = TRUE
)
# Round to four decimal places
round(bottles, digits = 4)
## [1] 0.7279
# Graph hypergeometric distribution of the number of dismissed employees over 50 years of age, considering that 6 employees are over 50, 19 employees are under 50, and that 6 employees will be chosen at random to be dismissed
plot(0:25, dhyper(0:25, m = 6, n = 25-6, k = 6), type = "h",
main = "Hypergeometric Distribution (S = 6, F = 19, n = 6)",
xlab = "Number of Dismissed Employees Over 50 Years Old",
ylab = "Probability",
lwd = 3,
col = "black"
)
\[P(x > 50) \mid S = 6, F = 19, n = 6\]
# Calculate probability that out of the 6 employees that are randomly dismissed, that more than 1 are over 50 years of age
employees <- phyper(q = 1,
m = 6,
n = 25-6,
k = 6,
lower.tail = FALSE
)
# Round to four decimal places
round(employees, digits = 4)
## [1] 0.4529
# Graph distribution of steer weights in a herd with a mean weight of 800 lbs and a variance of 90,000
curve(dnorm(x, mean = 800, sd = 300), from = 0, to = 1800,
main = "Distribution of Steer Weight in a Herd",
xlab = "Weight of Steer (lbs)",
xaxt = "n",
ylab = "",
yaxt = "n",
lwd = 2,
col = "black"
)
axis(side = 1, at = seq(0,1800, by = 200))
\[P(1040 \le x \le 1460) \mid \mu = 800,
\sigma = 300\]
# Calculate probability that a steer has a weight between 1040 and 1460 lbs
steer <- pnorm(q = 1460,
mean = 800,
sd = 300
) -
pnorm(q = 1040,
mean = 800,
sd = 300
)
# Round to four decimal places
round(steer, digits = 4)
## [1] 0.198
# Graph distribution of ball bearing diameters given a mean diameter of 106 mm and a standard deviation of 4 mm
curve(dnorm(x, mean = 106, sd = 4), from = 92, to = 120,
main = "Distribution of Ball Bearing Diameters",
xlab = "Diameter (mm)",
xaxt = "n",
ylab = "",
yaxt = "n",
lwd = 2,
col = "black"
)
axis(side = 1, at = seq(92, 120, by = 4))
\[P(103 \le x \le 111) \mid \mu = 106, \sigma
= 4\]
# Calculate probability that a ball bearing's diameter will be between 103 and 111 mm
ball_bearing <- pnorm(q = 111,
mean = 106,
sd = 4
) -
pnorm(q = 103,
mean = 106,
sd = 4
)
# Round to four decimal places
round(ball_bearing, digits = 4)
## [1] 0.6677
# Graph distribution of the length of nails produced in a factory given a mean length of 3.34 cm and a standard deviation of 0.07 cm
curve(dnorm(x, mean = 3.34,sd = .07), from = 3.06, to = 3.62,
main = "Distribution of Nail Lengths",
xlab = "Nail Length (cm)",
xaxt = "n",
ylab = "",
yaxt = "n",
lwd = 2,
col = "black"
)
axis(side = 1, at = seq(3.06, 3.62, by = .04))
# Calculate the 3rd and 97th percentiles for the length of nails produced by the factory
bottom_three <- qnorm(p = .03, mean = 3.34, sd = .07)
top_three <- qnorm(p = .97, mean = 3.34, sd = .07)
# Round to two decimal places
round(x = c(bottom_three,
top_three),
digits = 2
)
## [1] 3.21 3.47
# Graph the distribution of test scores for a psychology class
curve(dnorm(x, mean = 75.8, sd = 8.1), from = 50, to = 100,
main = "Distribution of Psychology Test Scores",
xlab = "Test Scores",
xaxt = "n",
ylab = "",
yaxt = "n",
lwd = 2,
col = "black"
)
axis(side = 1, at = seq(50, 100, by = 5))
# Calculate the 91st percentile for test scores
minimum_A_score <- qnorm(p = .91, mean = 75.8, sd = 8.1)
# Round to the nearest whole number
round(minimum_A_score, digits = 0)
## [1] 87
# Graph the binomial distribution for the number of computers that will not crash from a sample size of 155 computers, given that each computer has a 61% chance to not crash in a day
plot(75:115, dbinom(75:115, size = 155, prob = .61), type = "h",
main = expression(paste("Binomial Distribution (n = 155, ", pi, " = 0.61)")),
xlab = "Number of Computers That Do Not Crash",
xaxt = "n",
ylab = "Probability",
lwd = 3,
col = "black"
)
axis(side = 1, at = seq(75, 115, by = 5))
\[P(x = 96) \mid n = 155, \pi =
0.61\]
# Calculate the probability that exactly 96 computers will not crash out of a sample size of 155
no_crash <- dnorm(x = 96,
mean = .61 * 155,
sd = sqrt(.61 * .39 * 155)
)
# Round to four decimal places
round(no_crash, digits = 4)
## [1] 0.0639