A researcher wishes to conduct a study of the color preferences of new car buyers. Suppose that 50% of this population prefers the color red. If 20 buyers are randomly selected, what is the probability that between 9 and 12 (both inclusive) buyers would prefer red?
# Parameters
n <- 20 # Total number of buyers selected
p_red <- 0.5 # Probability of preferring the color red
k_values <- 9:12 # Values of k (number of buyers who prefer red)
prob<-dbinom(0:n, n, p_red)
# Round the result to four decimal places
rounded_probability <- round(sum(prob[k_values]), 4)
rounded_probability
## [1] 0.6167
barplot(prob, xlab="Buyers", ylab="P(Prefers Red)")
A quality control inspector has drawn a sample of 13 light bulbs from a recent production lot. Suppose 20% of the bulbs in the lot are defective. What is the probability that less than 6 but more than 3 bulbs from the sample are defective?
# Parameters
n <- 13 # Total number of bulbs in the sample
p_defective <- 0.2 # Probability of a bulb being defective
k_values <- 4:5 # Values of k (number of defective bulbs)
# Calculate the probabilities using dbinom
probabilities <- dbinom(k_values, size = n, prob = p_defective)
# Sum the probabilities for k between 4 and 5
total_probability <- sum(probabilities)
# Round the result to four decimal places
rounded_probability <- round(total_probability, 4)
rounded_probability
## [1] 0.2226
barplot(
dbinom(
0:n, size = n, prob = p_defective
),
xlab="Success", ylab="Probability")
The auto parts department of an automotive dealership sends out a mean of 4.2 special orders daily. What is the probability that, for any day, the number of special orders sent out will be no more than 3?
# Mean (average rate)
lambda <- 4.2
# Values of k (number of special orders)
k_values <- 3
# Calculate the probabilities
probabilities <- ppois(k_values, lambda, lower.tail = TRUE)
# Sum the probabilities for k ≤ 3
total_probability <- sum(probabilities)
# Print the result
round(total_probability, 4)
## [1] 0.3954
barplot(probabilities <- ppois(0:3, lambda), xlab="Special Orders", ylab="Probability")
A pharmacist receives a shipment of 17 bottles of a drug and has 3 of the bottles tested. If 6 of the 17 bottles are contaminated, what is the probability that less than 2 of the tested bottles are contaminated?
# Parameters
N <- 17 # Total number of bottles in the shipment
K <- 6 # Total number of contaminated bottles
n <- 3 # Number of bottles tested
# Values of x (number of tested bottles that are contaminated)
x_values <- 0:1
# Calculate the probabilitieS
probabilities <- dhyper(x_values, m = K, n = N - K, k = n)
# Sum the probabilities for x < 2
total_probability <- round(sum(probabilities), 4)
# Print the result
total_probability
## [1] 0.7279
barplot(
probabilities <- dhyper(0:n, m = K, n = N - K, k = n),
xlab="Bottles",
ylab="Probability")
A town recently dismissed 6 employees in order to meet their new budget reductions. The town had 6 employees over 50 years of age and 19 under 50. If the dismissed employees were selected at random, what is the probability that more than 1 employee was over 50?
# Parameters
N <- 25 # Total number of employees
K <- 6 # Total number of employees over 50
n <- 6 # Number of employees dismissed
# Values of x (number of dismissed employees over 50)
x_values <- 2:6
# Calculate the probabilities using dhyper
probabilities <- dhyper(x_values, m = K, n = N - K, k = n)
# Sum the probabilities for x > 1
total_probability <- sum(probabilities)
# Round the result to four decimal places
rounded_probability <- round(total_probability, 4)
rounded_probability
## [1] 0.4529
barplot(
probabilities <- dhyper(x_values, m = K, n = N - K, k = n),
xlab="Dismissed over 50 y",
ylab="Probability")
The weights of steers in a herd are distributed normally. The variance is 90,000 and the mean steer weight is 800 lbs. Find the probability that the weight of a randomly selected steer is between 1040 and 1460 lbs.
# Parameters
mean_weight <- 800
variance <- 90000
std_deviation <- sqrt(variance)
lower_bound <- 1040
upper_bound <- 1460
# Calculate Z-scores
z_lower <- (lower_bound - mean_weight) / std_deviation
z_upper <- (upper_bound - mean_weight) / std_deviation
# Calculate the probability
probability <- pnorm(z_upper) - pnorm(z_lower)
round(probability, 4)
## [1] 0.198
plot(seq(400, 1200, by = 10), dnorm(seq(400, 1200, by = 10), mean_weight, std_deviation),
type = "l", xlab = "Weight (lbs)", ylab = "Probability Density",
main = "Normal Distribution of Steer Weights")
The diameters of ball bearings are distributed normally. The mean diameter is 106 millimeters and the standard deviation is 4 millimeters. Find the probability that the diameter of a selected bearing is between 103 and 111 millimeters.
# Parameters
mean_diameter <- 106
std_deviation <- 4
lower_bound <- 103
upper_bound <- 111
# Calculate Z-scores
z_lower <- (lower_bound - mean_diameter) / std_deviation
z_upper <- (upper_bound - mean_diameter) / std_deviation
# Calculate the probability
probability <- pnorm(z_upper) - pnorm(z_lower)
round(probability, 4)
## [1] 0.6677
The lengths of nails produced in a factory are normally distributed with a mean of 3.34 centimeters and a standard deviation of 0.07 centimeters. Find the two lengths that separate the top 3% and the bottom 3%. These lengths could serve as limits used to identify which nails should be rejected.
# Parameters
mean_length <- 3.34
std_deviation <- 0.07
# Find the z-scores for the 3rd and 97th percentiles
z_03 <- qnorm(0.03)
z_97 <- qnorm(0.97)
# Calculate the lengths corresponding to the percentiles
length_bottom_3_percent <- z_03 * std_deviation + mean_length
length_top_3_percent <- z_97 * std_deviation + mean_length
# Print the results
cat("Length for the bottom 3%:", round(length_bottom_3_percent, 4), "\n")
## Length for the bottom 3%: 3.2083
cat("Length for the top 3%:", round(length_top_3_percent, 4))
## Length for the top 3%: 3.4717
A psychology professor assigns letter grades on a test according to
the following scheme.
A: Top 9% of scores
B: Scores below the top 9% and above the bottom 63%
C: Scores below the top 37% and above the bottom 17%
D: Scores below the top 83% and above the bottom 8%
F: Bottom 8% of scores
Scores on the test are normally distributed with a mean of 75.8 and a
standard deviation of 8.1. Find the minimum score required for an A
grade.
# Given parameters
mean_score <- 75.8
std_deviation <- 8.1
percentile <- 0.91 # The top 9%
# Find the Z-score for the top 9%
z_score <- qnorm(percentile)
# Calculate the minimum score required for an A grade
minimum_score <- z_score * std_deviation + mean_score
# Round to the nearest whole number
minimum_score_rounded <- round(minimum_score)
cat("The minimum score required for an A grade is approximately", minimum_score_rounded)
## The minimum score required for an A grade is approximately 87
Consider the probability that exactly 96 out of 155 computers will not crash in a day. Assume the probability that a given computer will not crash in a day is 61%.
# Parameters
n <- 155 # Total number of computers
p <- 0.61 # Probability that a computer will not crash
k <- 96 # Number of computers that will not crash
# Calculate the binomial coefficient
binomial_coefficient <- choose(n, k)
# Calculate the probability
probability <- binomial_coefficient * p^k * (1 - p)^(n - k)
(round(probability, 4))
## [1] 0.064
This is the probability of exactly 96 computers not crashing out of 155 when each computer has a 61% chance of not crashing.