Highland_Distribution_Week3_Assignment
docx
keyboard_arrow_up
School
Boston College *
*We aren’t endorsed by this school
Course
021
Subject
Industrial Engineering
Date
Feb 20, 2024
Type
docx
Pages
10
Uploaded by AdmiralArtJackal44
Highland_Week3_ Assignment_Distributions
1.
The probability of k
successes (buyers preferring red) in n
trials (total buyers) in a binomial distribution is given by the probability mass function (PMF): P
(
X
=
k
) = (
n k
) pk (1
−
p
)
n
−
k
where n
is the number of trials, k
is the number of successful trials, and p
is the probability of success on each trial.
# Parameters
> n <- 20 # Total number of buyers
> p <- 0.5 # Probability of preferring red
> # Sequence of possible number of successes
> k <- 0:n
> # Calculating the binomial probabilities
> probabilities <- dbinom(k, size = n, prob = p)
> # Plotting the PMF
> barplot(probabilities, names.arg = k, col = 'red',
+ main = "Binomial Distribution: Probability of Buyers Preferring Red",
+ xlab = "Number of Buyers Preferring Red", ylab = "Probability")
> # Adding more details to the plot
> abline(h = seq(0, max(probabilities), by = 0.05), col = "grey", lty = 3) # Grid lines
> # Calculate the probability
> prob = pbinom(k_high, n, p) - pbinom(k_low, n, p)
> # Round the answer to four decimal places
> rounded_prob = round(prob, 4)
> rounded_prob
[1] 0.6167
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. Page 1
of 10
Highland_Week3_ Assignment_Distributions
What is the probability that less than 6 but more than 3 bulbs from the sample are defective? Round your answer to four decimal places.
# Parameters
> n <- 13 # Number of trials (bulbs sampled)
> p <- 0.20 # Probability of success (bulb being defective)
> # Sequence from 0 to n
> x <- 0:n
> # Binomial probabilities
> probabilities <- dbinom(x, size = n, prob = p)
> # Plotting
> plot(x, probabilities, type = "h", lwd = 2, col = "blue",
+ main = "Binomial Distribution of Defective Bulbs",
+ xlab = "Number of Defective Bulbs", ylab = "Probability")
> abline(h = 0, col = "gray") # Add a horizontal line at 0 for reference
> # Probability calculation for less than 6 but more than 3 defective bulbs
> prob_less_than_6 <- pbinom(5, size = n, prob = p) # P(X < 6)
> prob_more_than_3 <- pbinom(3, size = n, prob = p) # P(X <= 3)
> # Final probability: P(3 < X < 6)
> final_prob <- prob_less_than_6 - prob_more_than_3
> # Round the answer to four decimal places
> rounded_final_prob <- round(final_prob, 4)
> rounded_final_prob
[1] 0.2226
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? Round your answer to four decimal places
Page 2
of 10
Highland_Week3_ Assignment_Distributions
# Parameters
> lambda <- 4.2 # Mean number of special orders sent out daily
> # Sequence from 0 to a reasonable upper limit (for plotting)
> x <- 0:10
> # Poisson probabilities
> probabilities <- dpois(x, lambda)
> # Plotting
> plot(x, probabilities, type = "h", lwd = 2, col = "red",
+ main = "Poisson Distribution of Daily Special Orders",
+ xlab = "Number of Special Orders", ylab = "Probability")
> abline(h = 0, col = "gray") # Add a horizontal line at 0 for reference
> # Probability calculation for no more than 3 special orders
> prob_no_more_than_3 <- ppois(3, lambda)
> # Round the answer to four decimal places
> rounded_prob_no_more_than_3 <- round(prob_no_more_than_3, 4)
> rounded_prob_no_more_than_3
[1] 0.3954
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? Round your answer to four decimal places.
Page 3
of 10
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Highland_Week3_ Assignment_Distributions
# Parameters
> N <- 17 # Total number of bottles
> K <- 6 # Number of contaminated bottles
> n <- 3 # Number of bottles tested
> # Sequence of possible successes in the sample
> x <- 0:min(n, K)
> # Calculating hypergeometric probabilities
> probabilities <- dhyper(x, K, N-K, n)
> # Plotting the distribution
> barplot(probabilities, names.arg = x, col = 'blue',
+ main = "Hypergeometric Distribution: Probability of Contaminated Bottles",
+ xlab = "Number of Contaminated Bottles in Sample", ylab = "Probability")
> # Calculating the probability of less than 2 contaminated bottles in the sample
> prob_less_than_2 <- sum(dhyper(0:1, K, N-K, n))
> # Rounding the result to four decimal places
> rounded_prob <- round(prob_less_than_2, 4)
> # Printing the rounded probability
> print(paste("Probability of less than 2 contaminated bottles in the sample:", rounded_prob))
[1] "Probability of less than 2 contaminated bottles in the sample: 0.7279"
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? Round your answer to four decimal places.
Page 4
of 10
Highland_Week3_ Assignment_Distributions
# Parameters
> N <- 25 # Total number of employees
> K <- 6 # Number of employees over 50
> n <- 6 # Number of dismissed employees
> # Sequence of possible successes (over 50) in the sample (dismissed employees)
> x <- 0:K
> # Calculating hypergeometric probabilities
> probabilities <- dhyper(x, K, N-K, n)
> # Plotting the distribution
> barplot(probabilities, names.arg = x, col = 'darkgreen',
+ main = "Hypergeometric Distribution: Employees Over 50 Dismissed",
+ xlab = "Number of Employees Over 50 Dismissed", ylab = "Probability")
> # Calculating the probability of more than 1 employee over 50 being dismissed
> # P(X > 1) = 1 - P(X <= 1) = 1 - sum of probabilities of 0 and 1
> prob_more_than_1 <- 1 - sum(dhyper(0:1, K, N-K, n))
> # Rounding the result to four decimal places
> rounded_prob <- round(prob_more_than_1, 4)
> # Printing the rounded probability
> print(paste("Probability of more than 1 employee over 50 being dismissed:", rounded_prob))
[1] "Probability of more than 1 employee over 50 being dismissed: 0.4529"
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. Round your answer to four decimal places. First, let's calculate the standard deviation from the given variance: σ = √90,000= 300
Then, we use the pnorm
function in R to find the cumulative probability for each bound and subtract the lower bound probability from the upper bound Page 5
of 10
Highland_Week3_ Assignment_Distributions
probability to get the probability of a steer's weight being between 1040 and 1460 lbs.
# Parameters
> mean <- 800 # Mean weight
> variance <- 90000
> sd <- sqrt(variance) # Standard deviation
> # Bounds
> lower_bound <- 1040
> upper_bound <- 1460
> # Plotting the distribution
> x <- seq(400, 1200, length.out = 300)
> y <- dnorm(x, mean, sd)
> plot(x, y, type = "l", lwd = 2, col = "blue", main = "Normal Distribution of Steer Weights",
+ xlab = "Weight (lbs)", ylab = "Density")
> abline(v = c(lower_bound, upper_bound), col = "red", lwd = 2, lty = 2)
> # Calculating the probability of a steer's weight being between 1040 and 1460 lbs
> prob <- pnorm(upper_bound, mean, sd) - pnorm(lower_bound, mean, sd)
> # Rounding the result to four decimal places
> rounded_prob <- round(prob, 4)
> # Printing the rounded probability
> print(paste("Probability of a steer's weight being between 1040 and 1460 lbs:", rounded_prob))
[1] "Probability of a steer's weight being between 1040 and 1460 lbs: 0.198"
> 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. For this scenario, given that the diameters of ball bearings follow a normal distribution with a mean (
μ
) of 106 millimeters and a standard deviation (
σ
) of 4 millimeters, we can calculate the probability of selecting a bearing with Page 6
of 10
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Highland_Week3_ Assignment_Distributions
a diameter between 103 and 111 millimeters using the normal distribution properties.
# Parameters
> mean <- 106 # Mean diameter
> sd <- 4 # Standard deviation
> # Bounds
> lower_bound <- 103
> upper_bound <- 111
> # Plotting the normal distribution
> x <- seq(95, 117, by = 0.1) # Creating a range of diameters for plotting
> y <- dnorm(x, mean, sd) # Calculating the density of these diameters
> plot(x, y, type = "l", lwd = 2, col = "blue", main = "Normal Distribution of Ball Bearing Diameters",
+ xlab = "Diameter (mm)", ylab = "Density")
> abline(v = c(lower_bound, upper_bound), col = "red", lwd = 2, lty = 2) # Marking
the range of interest
> # Calculating the probability of a bearing's diameter being between 103 and 111 mm
> prob <- pnorm(upper_bound, mean, sd) - pnorm(lower_bound, mean, sd)
> # Rounding the result to four decimal places
> rounded_prob <- round(prob, 4)
> # Printing the rounded probability
> print(paste("Probability of a bearing's diameter being between 103 and 111 mm:", rounded_prob))
[1] "Probability of a bearing's diameter being between 103 and 111 mm: 0.6677"
Page 7
of 10
Highland_Week3_ Assignment_Distributions
The two lengths that separate the top 3% and bottom 3% of nails produced in the factory, given that the lengths are normally distributed with a mean of 3.34 cm and a standard deviation of 0.07 cm, we can use the qnorm
function in R. The qnorm
function is used to find the quantile (the inverse of the cumulative distribution function) of the normal distribution.
For the bottom 3%, we find the quantile at p
=0.03, and for the top 3%, we find the quantile at p
=0.97 (since 100% - 3% = 97%).
# Parameters
> mean_length <- 3.34 # Mean length of nails
> sd_length <- 0.07 # Standard deviation of lengths
> # Finding the lengths that separate the top 3% and bottom 3%
> lower_bound <- qnorm(0.03, mean_length, sd_length) # Bottom 3%
> upper_bound <- qnorm(0.97, mean_length, sd_length) # Top 3%
> # Rounding to the nearest hundredth
> lower_bound_rounded <- round(lower_bound, 2)
> upper_bound_rounded <- round(upper_bound, 2)
> # Printing the results
> cat("The length that separates the bottom 3% is:", lower_bound_rounded, "cm\n")
The length that separates the bottom 3% is: 3.21 cm
> cat("The length that separates the top 3% is:", upper_bound_rounded, "cm\n")
The length that separates the top 3% is: 3.47 cm
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. Round your answer to the nearest whole number, if necessary. # Parameters
> mean_score <- 75.8 # Mean of the scores
> sd_score <- 8.1 # Standard deviation of the scores
> # Finding the minimum score for an A grade (top 9%)
> min_A_grade <- qnorm(0.91, mean_score, sd_score)
> # Rounding to the nearest whole number
> min_A_grade_rounded <- round(min_A_grade)
> # Printing the result
> cat("The minimum score required for an A grade is:", min_A_grade_rounded, "\n")
The minimum score required for an A grade is: 87 Page 8
of 10
Highland_Week3_ Assignment_Distributions
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. Round your answer to four decimal places. My calculation steps:
1.
Calculate the mean (
μ
) and standard deviation (
σ
) of the binomial distribution
:
For a binomial distribution, μ
=
n
⋅
p
and σ = √
n
⋅
p
⋅
(1
−
p
), where n
=155 is the number of trials (computers) and p
=0.61 is the probability of success (a computer not crashing).
2.
Apply the continuity correction
: Since we're approximating a discrete distribution with a continuous one, we adjust our target value of 96 by 0.5 for both ends to include 96 exactly in our calculation.
3.
Use the normal distribution to approximate the probability
:
We calculate the Z-scores for 95.5 (just before 96) and 96.5 (just after 96) using the formula Z
= x
−
μ/ σ
.
We then find the probabilities corresponding to these Z-scores using the cumulative distribution function (CDF) of the normal distribution and subtract them to get the probability of exactly 96.
> # Parameters
> mean_score <- 75.8 # Mean of the scores
> sd_score <- 8.1 # Standard deviation of the scores
> # Finding the minimum score for an A grade (top 9%)
> min_A_grade <- qnorm(0.91, mean_score, sd_score)
> # Rounding to the nearest whole number
> min_A_grade_rounded <- round(min_A_grade)
> # Printing the result
> cat("The minimum score required for an A grade is:", min_A_grade_rounded, "\n")
The minimum score required for an A grade is: 87 > # Parameters
> n <- 155 # Number of computers
> p <- 0.61 # Probability of not crashing
> x <- 96 # Target value
> # Calculate mean and standard deviation
> mu <- n * p
> sigma <- sqrt(n * p * (1 - p))
> # Apply continuity correction and calculate Z-scores
> z_lower <- (x - 0.5 - mu) / sigma
> z_upper <- (x + 0.5 - mu) / sigma
> # Use the normal distribution to approximate the probability
> prob_lower <- pnorm(z_lower)
> prob_upper <- pnorm(z_upper)
> prob_exact <- prob_upper - prob_lower
Page 9
of 10
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Highland_Week3_ Assignment_Distributions
> # Round the answer to four decimal places
> rounded_prob <- round(prob_exact, 4)
> # Print the result
> cat("The approximated probability of exactly 96 computers not crashing is:", rounded_prob, "\n")
The approximated probability of exactly 96 computers not crashing is: 0.0638 Page 10
of 10