HW3

  1. The weights of steers in a herd are distributed normally. The variance is 40,000 and the mean steer weight is 1300 lbs. Find the probability that the weight of a randomly selected steer is greater than 979 lbs. (Round your answer to 4 decimal places)
# Let's find the SD first
sd <- sqrt(40000)
# the mean weight is 1300
m <- 1300

## Using pnorm, q=979
# since we want the area above the weight of 979, we must subtract the value of the pnorm function
round(1-pnorm(q=979, mean=m, sd=sd),4)
## [1] 0.9458
# the z score is (979-1300)/sd
z<- (979-1300)/sd
## 
## we could also use a z look-up table
## using 1-pnorm(-1.605), we can get the prob
round(1-pnorm(-1.605),4)
## [1] 0.9458
  1. SVGA monitors manufactured by TSI Electronics have life spans that have a normal distribution with a variance of 1,960,000 and a mean life span of 11,000 hours. If a SVGA monitor is selected at random, find the probability that the life span of the monitor will be more than 8340 hours. (Round your answer to 4 decimal places)
## Given: v=1,960,000, mean=11,000, find P>8340
v<-1960000
m<-11000
sd <- sqrt(v)
## the prob thatan SVGA lifespan is be more than 8340
round(1-pnorm(q=8340,mean=m,sd=sd),4)
## [1] 0.9713
## [1] 0.7260243
  1. Suppose the mean income of firms in the industry for a year is 80 million dollars with a standard deviation of 3 million dollars. If incomes for the industry are distributed normally, what is the probability that a randomly selected firm will earn between 83 and 85 million dollars? (Round your answer to 4 decimal places)
## given: mean = 80, sd = 3, find P(83 <=x <= 85)
## we need to find the difference between the curve
m <- 80

sd <- 3
### find prob below 85 million
prob_below85=pnorm(q=85,mean=m,sd=sd)
### find prob below 83 million
prob_below83=pnorm(q=83,mean=m,sd=sd)
## Answer: find the prob between 85 and 83
round(prob_below85-prob_below83,4)
## [1] 0.1109
  1. Suppose GRE Verbal scores are normally distributed with a mean of 456 and a standard deviation of 123. A university plans to offer tutoring jobs to students whose scores are in the top 14%. What is the minimum score required for the job offer? Round your answer to the nearest whole number, if necessary.
# set given values
sd <- 123
m <-456
top_14 <- 1-.14
## We need to find the Z value for P=.86
#using a look-up table, we get 1.08
## we can also use qnorm to get the Z value for p=.86
z <- qnorm(.86)
z
## [1] 1.080319
## we can use the formula
# z = (x - mean) / sd
# z*sd+mean = x
## this is the minimal value needed to geet into the university

z*sd+m
## [1] 588.8793
## we could also pass parameters to qnorm to get the same answer
round(qnorm(.86, mean = m, sd = sd))
## [1] 589
  1. The lengths of nails produced in a factory are normally distributed with a mean of 6.13 centimeters and a standard deviation of 0.06 centimeters. Find the two lengths that separate the top 7% and the bottom 7%. These lengths could serve as limits used to identify which nails should be rejected. Round your answer to the nearest hundredth, if necessary.
### Given m=6.13, we need to find the z values for the top and bottom 7%

m=6.13
sd=0.06
## bottom 7% length value
round(qnorm(.07,mean = m, sd= sd),2)
## [1] 6.04
## top 7% length value
round(qnorm(1-.07, mean=m,sd=sd),2)
## [1] 6.22
## These are the limits that the needs should conform to.
  1. An English professor assigns letter grades on a test according to the following scheme. A: Top 13% of scores B: Scores below the top 13% and above the bottom 55% C: Scores below the top 45% and above the bottom 20% D: Scores below the top 80% and above the bottom 9% F: Bottom 9% of scores Scores on the test are normally distributed with a mean of 78.8 and a standard deviation of 9.8. Find the numerical limits for a C grade. Round your answers to the nearest whole number, if necessary.
# We need to find the x values for the top and bottom limit of Z
## top limit of C
m <- 78.8
sd <- 9.8
round(qnorm(1-.45, mean=78.8,sd=sd))
## [1] 80
## bottom limit of C
round(qnorm(.20, mean=78.8,sd=sd))
## [1] 71
  1. Suppose ACT Composite scores are normally distributed with a mean of 21.2 and a standard deviation of 5.4. A university plans to admit students whose scores are in the top 45%. What is the minimum score required for admission? Round your answer to the nearest tenth, if necessary.
# given m=21.2, sd=5.4. 
# want top .45
## top .45 find the value at .55
m=21.2
sd=5.48
round(qnorm(1-.45, mean=m,sd=sd),1)
## [1] 21.9
  1. Consider the probability that less than 11 out of 151 students will not graduate on time. Assume the probability that a given student will not graduate on time is 9%. Approximate the probability using the normal distribution. (Round your answer to 4 decimal places.)

Could not figure how to solve this one out

  1. The mean lifetime of a tire is 48 months with a standard deviation of 7. If 147 tires are sampled, what is the probability that the mean of the sample would be greater than 48.83 months? (Round your answer to 4 decimal places)
# mean_pop = 48
# SD_pop = 7
# sample_n = 147
mean_pop <- 48
sample_n <- 147
SD_pop <- 7
## we need to find the SD of the sample size
SD_sample <- SD_pop/sqrt(sample_n) 
SD_sample
## [1] 0.5773503
# let's find the probability that the mean of the same is greater than 48.83
# we use 1 - the answer because the current formula will give us the prob area below.
round(1 - pnorm(48.83, mean=mean_pop, sd=SD_sample),4)
## [1] 0.0753
# we can also use
round(pnorm(48.83, mean=mean_pop, sd=SD_sample, lower.tail = FALSE),4)
## [1] 0.0753
  1. The quality control manager at a computer manufacturing company believes that the mean life of a computer is 91 months, with a standard deviation of 10. If he is correct, what is the probability that the mean of a sample of 68 computers would be greater than 93.54 months? (Round your answer to 4 decimal places)
# Given: pop_mean, pop_sd, n_sample=68, find(P > 93.54)
pop_mean <- 91
pop_sd <- 10
n_sample <- 68
SD_sample <- 10/sqrt(n_sample)
round(pnorm(93.54,mean=pop_mean,sd=SD_sample, lower.tail = FALSE),4)
## [1] 0.0181
  1. A director of reservations believes that 7% of the ticketed passengers are no-shows. If the director is right, what is the probability that the proportion of no-shows in a sample of 540 ticketed passengers would differ from the population proportion by less than 3%? (Round your answer to 4 decimal places)
# Using the following sqrt(npq) and mean=np
p_no_shows <- .07
p_do_shows <- .93
sample_n <- 540
## expected no shows?
m_sample <- sample_n*p_no_shows
sd_sample <- sqrt(sample_n * p_no_shows * p_do_shows)
sd_sample
## [1] 5.929081
## Prob that prop no shows < 3%
## 3% of the sample is .03 * 540
three_percent <- sample_n * .03
pnorm(three_percent, mean = m_sample, sd= sd_sample)
## [1] 0.0001347078
  1. A bottle maker believes that 23% of his bottles are defective. If the bottle maker is accurate, what is the probability that the proportion of defective bottles in a sample of 602 bottles would differ from the population proportion by greater than 4%? (Round your answer to 4 decimal places) Could not figure out how to solve this one

  2. A research company desires to know the mean consumption of beef per week among males over age 48. Suppose a sample of size 208 is drawn with x ̅ = 3.9 AssuesSD = 0.8 . Construct the 80% confidence interval for the mean number of lb. of beef per week among males over 48. (Round your answers to 1 decimal place)

m <- 3.9
SD <- 0.8
n = 208
SE <- (SD/sqrt(208))

# we will use a one tail test, which means that for an 80% confidence interval, we must divide .20/2
## qt will give the t
#QT can be used to find the Z value that needs to be used. In this case, we will supply N-1 degrees of freedom or 207
qt(1-.10,207)
## [1] 1.285655
## We use .90 because we want 5% at each end, with 207 used for degrees of Freedom
t <- qt(.20/2,207, lower.tail = FALSE)
bottom_limit <-m-t*SE
round(bottom_limit,1)
## [1] 3.8
upper_limit <- m+t*SE
round(upper_limit,1)
## [1] 4
  1. An economist wants to estimate the mean per capita income (in thousands of dollars) in a major city in California. Suppose a sample of size 7472 is drawn with x ̅ = 16.6. SD® = 11 . Construct the 98% confidence interval for the mean per capita income. (Round your answers to 1 decimal place)
#Using the same process above, we need to find the standard error - SE
# the DF will be 7471
m <- 16.6
SD <- 11
n <- 7472
df <- n -1
SE <- (SD/sqrt(n))
# We are using a one proporation test, therefore .02 must be divided by 2
t <- qt(.02/2,df, lower.tail = FALSE)
### Bottom Limit
bottom_limit <-m-t*SE
round(bottom_limit,1)
## [1] 16.3
## Upper limit
upper_limit <- m+t*SE
round(upper_limit,1)
## [1] 16.9
  1. Find the value of t such that 0.05 of the area under the curve is to the left of t. Assume the degrees of freedom equals 26.
## we can use the QT function in R or a T Student table. Using a one-sided tail, we divide .05 by 2.
qt(0.05/2, 26, lower.tail = FALSE)
## [1] 2.055529
  1. The following measurements ( in picocuries per liter ) were recorded by a set of helium gas detectors installed in a laboratory facility:
    383.6, 347.1, 371.9, 347.6, 325.8, 337 Using these measurements, construct a 90% confidence interval for the mean level of helium gas present in the facility. Assume the population is normally distributed.

Step 1. Calculate the sample mean for the given sample data. (Round answer to 2 decimal places)

Step 2. Calculate the sample standard deviation for the given sample data. (Round answer to 2 decimal places)

Step 3. Find the critical value that should be used in constructing the confidence interval. (Round answer to 3 decimal places)

Step 4. Construct the 90% confidence interval. (Round answer to 2 decimal places)

values <- c(383.6,347.1,371.9,347.8,325.8,337)
mean <- mean(values)
sd <- sd(values)
n <- length(values)
# find the standard error
se <- sd/sqrt(n)
df = n - 1
# find the t value
t <- qt(.10/2,df, lower.tail = FALSE)

t
## [1] 2.015048
## construct the 90% confidence interval

### Bottom Limit
bottom_limit <-mean-t*se
round(bottom_limit,2)
## [1] 334.38
## Upper limit
upper_limit <- mean+t*se
round(upper_limit,2)
## [1] 370.02
  1. A random sample of 16 fields of spring wheat has a mean yield of 46.4 bushels per acre and standard deviation of 2.45 bushels per acre. Determine the 80% confidence interval for the true mean yield. Assume the population is normally distributed.

Step 1. Find the critical value that should be used in constructing the confidence interval. (Round answer to 3 decimal places)

Step 2. Construct the 80% confidence interval. (Round answer to 1 decimal place)

n <- 16
mean <- 46.4
sd <- 2.45
se <- sd / sqrt(n)
se
## [1] 0.6125
t<qt(.10, n - 1, lower.tail = FALSE)
## [1] FALSE
## Bottom Limit
bottom_limit <-mean-t*se
round(bottom_limit,1)
## [1] 45.2
## Upper limit
upper_limit <- mean+t*se
round(upper_limit,1)
## [1] 47.6
  1. A toy manufacturer wants to know how many new toys children buy each year. She thinks the mean is 8 toys per year. Assume a previous study found the standard deviation to be 1.9. How large of a sample would be required in order to estimate the mean number of toys bought per child at the 99% confidence level with an error of at most 0.13 toys? (Round your answer up to the next integer)
# z value for 99 confidence
z <- qnorm(.01/2, lower.tail = FALSE)
me <- 0.13
sd < 1.9
## [1] FALSE
## n = (z * (s/ME))^2
## Reference Stats and Data Models, p534
n <- (z * sd / me)^2
round(n)
## [1] 2357
  1. A research scientist wants to know how many times per hour a certain strand of bacteria reproduces. He believes that the mean is 12.6. Assume the variance is known to be 3.61. How large of a sample would be required in order to estimate the mean number of reproductions per hour at the 95% confidence level with an error of at most 0.19 reproductions? (Round your answer up to the next integer)
m <- 12.6
v <- 3.61
sd <-sqrt(v)
## find z for 95 confidence. We will usee a one-tail proporation so 
z <- qnorm(.05/2, lower.tail = FALSE)
me <- 0.19
## Using the formula n 
## n = (z * (s/ME))^2
## Reference Stats and Data Models, p534
n <- (z * sd / me)^2
round(n)
## [1] 384
  1. The state education commission wants to estimate the fraction of tenth grade students that have reading skills at or below the eighth grade level.

Step 1. Suppose a sample of 2089 tenth graders is drawn. Of the students sampled, 1734 read above the eighth grade level. Using the data, estimate the proportion of tenth graders reading at or below the eighth grade level. (Write your answer as a fraction or a decimal number rounded to 3 decimal places)

sample_n <- 2089
read_above_8th <- 1734
read_at_or_below <- (sample_n - read_above_8th)/sample_n
round(read_at_or_below,3)
## [1] 0.17

Step 2. Suppose a sample of 2089 tenth graders is drawn. Of the students sampled, 1734 read above the eighth grade level. Using the data, construct the 98% confidence interval for the population proportion of tenth graders reading at or below the eighth grade level. (Round your answers to 3 decimal places) p <- 0.17 q <- 1 - p

## Using the sampling distribution model for a proporation SD = sqrt(p*q/n)
# We get the following
p <- 0.17
q <- 1 - p
n = 2089
se <- sqrt(p*q/n)
# m +- z*se
z <- qt(.02/2, n - 1, lower.tail = FALSE)
z
## [1] 2.328135
#top_bound

top<- p + z * se
round(top,3)
## [1] 0.189
#lower_bound
bottom<- p - z * se
round(bottom,3)
## [1] 0.151
  1. An environmentalist wants to find out the fraction of oil tankers that have spills each month.

Step 1. Suppose a sample of 474 tankers is drawn. Of these ships, 156 had spills. Using the data, estimate the proportion of oil tankers that had spills. (Write your answer as a fraction or a decimal number rounded to 3 decimal places)

n<-474
p.spills <- 156/n
q.no_spills <- 1 - p.spills
# proportion of oil tanks that had spills
round(p.spills,3)
## [1] 0.329

Step 2. Suppose a sample of 474 tankers is drawn. Of these ships, 156 had spills. Using the data, construct the 95% confidence interval for the population proportion of oil tankers that have spills each month. (Round your answers to 3)

# 
n<-474
p.spills <- 156/n
q.no_spills <- 1 - p.spills
se <- sqrt(p.spills*q.no_spills/n)
# the standard error using SQRT(pq/n)

z <- qt(.05/2, n - 1, lower.tail = FALSE)

## upper bound
upper <- p.spills - z * se
round(upper, 3)
## [1] 0.287
## lower bound
lower <- p.spills + z * se
round(lower,3)
## [1] 0.372