library(ggplot2)
library(ggfortify)
## Warning: namespace 'DBI' is not available and has been replaced
## by .GlobalEnv when processing object 'silent'

## Warning: namespace 'DBI' is not available and has been replaced
## by .GlobalEnv when processing object 'silent'

Chapter 4 Problem 4.40

Question: CFLBs. A manufacturer of compact fluorescent light bulbs advertises that the distribution of the lifespan of these light bulbs is nearly normal with a mean of 9,000 hours and a standard deviation of 1,000 hours.

  1. What is the probability that a randomly chosen light bulb lasts more than 10,500 hours?

First, we will need to figure out the z-score for this randomly chosen sample.

z = (x - mu) / sd Once that is calculated, you need to subtract 1 from the pnorm because we are looking for the probability of 10,500 or more.

x <- 10500
mu <- 9000
sd <- 1000
p <- 1 - pnorm(x, mu, sd)
prob <- round(p,4)
prob
## [1] 0.0668

Answer: The probability that the randomly chosen light bulb lasts more than 10,500 hours is 6.668%

  1. Describe the distribution of the mean lifespan of 15 lightbulbs.

Answer: We do know that the data is nearly normal and the standard deviation is known, however, the approximation of the mean will be poor because the sample size is small. The distribution could be anything with the small sample size.

  1. What is the probability that the mean lifespan of 15 randomly chosen light bulbs is more than 10,500 hours.

First, we need to find the z-score based on the sample size. The equation we will be using to find this is z = (x - mu) / S and s is calculated by finding S = sd / sqrt(n)

x <- 10500
mu <- 9000
sd <- 1000
n <- 15
smp15 <- sd/sqrt(n)
prob15 <- 1-pnorm(x, mu, smp15)
ans <- round(prob15, 4)
ans
## [1] 0

answer: The probability that the mean of lifespan of 15 randomly chosen light bulbs is more than 10,500 is 0!

  1. Sketch the two distributions (population and sampling) on the same scale

I used dnorm for plotting because it gives the denisty.

s <- seq(6000,12000,100)
plot(s, dnorm(s, mu, sd), type="l", xlab = "Lifespan of Lightbulbs", ylab = "", col="blue")
lines(s, dnorm(s, mu, smp15), col="red")

  1. We aren’t able to estimate the probability from parts (a) and (c) without a larger sample size.