LIS 4273 Module #5 Assignment

#1. The director of manufacturing at a cookies company needs to determine whether a new machine is able to produce a particular type of cookies according to the manufacturer's specifications, which indicate that cookies should have a mean of 70 and standard deviation of 3.5 pounds. A sample of 49 cookies reveals a sample mean breaking strength of 69.1 pounds. 

A. State the null and alternative hypothesis -  

Null Hypothesis (H0) = Î¼= 70 means the mean breaking strength is 70 pounds. 

Alternative Hypothesis (H1): Î¼ =/ 70 means the mean breaking strength is not 70 pounds. 

 

B. Is their evidence that the machine is not meeting the manufacturer's specifications for average strength? Use a 0.05 level of significance - 

 

The Z-Score is -1.8, and the p-value is 0.07186. When the significance level is 0.05, the critical z-scores for the two-tailed test are -1.96 and 1.96. The null hypothesis is not rejected since the p-value is greater than the alpha level. 

z = (69.1 - 70) / (3.5 / sqrt(49)) = -1.8 

 

> #B 
> #mean specified by manufacturer 
> a <- 70 
> #standard deviation specified by manufacturer 
> s <- 3.5 
> #sample size 
> n <- 49 
> #sample mean  
> xbar <- 69.1 
> z <- (xbar-a)/(s/sqrt(n)) 
> z 
[1] -1.8 
> p_value <- 2 * (1-pnorm(abs(z))) 
> p_value 
[1] 0.07186064 
>  
> alpha <- .05 
>  
> z.half.alpha <- qnorm(1-alpha/2) 
> c(-z.half.alpha,z.half.alpha) 
[1] -1.959964  1.959964 
>  
> if(p_value < alpha) { 
+  result <- "Reject null hypothesis as the machine is not meeting the manufacturer's specifications." 
+ } else { 
+  result <- "Do not reject the null hypothesis as there is no evidence that shows 
+  the machine is not meeting the manufacturer's specifications. " 
+ } 
>  
> result 
[1] "Do not reject the null hypothesis as there is no evidence that shows the machine is not meeting the manufacturer's specifications. " 

 

C. Compute the p-value and interpret its meaning - 

 

The p-value is 0.07186, and since the value is greater than the alpha value, the null hypothesis is not rejected. Due to there not being enough evidence that the machine is not meeting the manufacturer's specifications. 

 

> #C 

> p_value <- 2 * (1-pnorm(abs(z))) 
> p_value 
[1] 0.07186064 
>  
> alpha <- .05 
> p_value < alpha 
[1] FALSE 

 

D. What would be your answer in (B) if the standard deviation were specified as 1.75 pounds?

 

As you can see the standard deviation is 1.75 pounds, then the new z-score is -3.6. This leads to the p-value being 0.000318. Since the new p-value is less than the level of significance of 0.05, the null hypothesis is rejected. 

 

> s.new <- 1.75 
> z.new <- (xbar-a) / (s.new/sqrt(n)) 
> z.new 
[1] -3.6 

 

E. What would be your answer in (B) if the sample mean were 69 pounds and the standard deviation is 3.5 pounds? -  

 

If the sample mean was 69 pounds and the standard deviation was 3.5 pounds, then the p-value would be 0.0455, which is less than the 0.05 significance level. Therefore, the null hypothesis will be rejected. 

 

> #E> xbar.new <- c(69.1) 
> z.new2 <- (xbar.new-a)/(s/sqrt(n)) 
> p_value.new2 <- 2 * (1-pnorm(abs(z.new2))) 
> p_value.new2 
[1] 0.04550026 
> p_value.new < alpha> TRUE 

 

#2 If x̅ = 85, σ = standard deviation = 8, and n=64, set up 95% confidence interval estimate of the population mean μ. 

 

The lower bound is calculated to be 83.04 and the upper bound is 86.96. So, at 95% confidence the population mean estimate should be between these two values. 
 

> #critical value for 95% confidence interval is 1.96. The same mean is 85. 
> UpperBound <- 85+(1.96* (8/sqrt(64))) 
> LowerBound <- 85-(1.96* (8/sqrt(64))) 
> c(LowerBound,UpperBound) 
[1] 83.04 86.96 

 

#3 The accompanying data are: x= girls and y =boys. (goals, time spend on assignment)  

 

> Girls.Goals <- c(4,5,6) 
> Girls.Grades <- c( 49,50,69) 
> Girls.Popular <- c(24,36,38) 
> Girls.Time <- c(19,22,28) 
> Girls.Total <- c(92,108,135) 
> Girls <- data.frame(Girls.Goals, Girls.Grades, Girls.Popular, Girls.Time, Girls.Total) 
>  
> Boys.Goals <- c(4,5,6) 
> Boys.Grades <- c(46.1,54.2,67.7) 
> Boys.Popular <-c(26.9,31.6,39.5) 
> Boys.Time <- c(18.9, 22.2, 27.8) 
> Boys.Total <- c(95.9, 113,141) 
> Boys <- data.frame(Boys.Goals, Boys.Grades, Boys.Popular, Boys.Time, Boys.Total) 
>  
> df <- data.frame(Girls, Boys) 
> corr_matrix <- cor(df) 
> plot(df) 
> cor(Girls, Boys) 
             Boys.Goals Boys.Grades Boys.Popular Boys.Time Boys.Total 
Girls.Goals    1.0000000   0.9897433    0.9894203 0.9890517  0.9904046 
Girls.Grades   0.8873565   0.9441243    0.9448614 0.9456833  0.9425629 
Girls.Popular  0.9244735   0.8605276    0.8593826 0.8580918  0.8629152 
Girls.Time     0.9819805   0.9989061    0.9990085 0.9991175  0.9986750 
Girls.Total    0.9892685   0.9999946    0.9999995 0.9999989  0.9999681 
>  
> cor.coeff <- cor(Girls.Goals, Boys.Time) 
> cor.coeff 
[1] 0.9890517 

 
a. Calculate the correlation coefficient for this data set -  

> cor(Girls, Boys) 
             Boys.Goals Boys.Grades Boys.Popular Boys.Time Boys.Total 
Girls.Goals    1.0000000   0.9897433    0.9894203 0.9890517  0.9904046 
Girls.Grades   0.8873565   0.9441243    0.9448614 0.9456833  0.9425629 
Girls.Popular  0.9244735   0.8605276    0.8593826 0.8580918  0.8629152 
Girls.Time     0.9819805   0.9989061    0.9990085 0.9991175  0.9986750 
Girls.Total    0.9892685   0.9999946    0.9999995 0.9999989  0.9999681 

 
b. Pearson correlation coefficient - 

> cor.coeff <- cor(Girls.Goals, Boys.Time) 
> cor.coeff 
[1] 0.9890517 

 
c. Create plot of the correlation -  





Comments