Question 1:

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?

# 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

Question 2:

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?

# 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

Question 3:

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?

# 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

Question 4:

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?

# 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

Question 5:

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?

# 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

Question 6:

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.

# 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

Question 7:

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.

# 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

Question 8:

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.

# 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

Question 9:

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.

# 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

Question 10:

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%. Approximate the (binomial) probability using the normal distribution.

# 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