rm(list=ls())

Q1: The sample mean and standard deviation for the fatigue strength, in MPa of 70 steel connecting rods that were subject to fatigue testing are X̅= 408.2 and s=72.9. Note that this is Example 5.2 from the textbook.

  1. Setup the mean, sample standard deviation, and sample size as variables in R. (3 points)
Xbar <- 408.2
s <- 72.9
n <- 70
  1. Use R to define the z value that corresponds to an 95% confidence interval. Hint: Must use the qnorm function. (3 points)
zvalue <- qnorm(0.975) # Zvalue set up for an 85% CI
  1. Using the variables setup in parts a and b, construct an 95% confidence interval for the mean fatigue strength of the steel connecting rods. (3 points)
lowerbound <- Xbar-zvalue*s/sqrt(n)
upperbound <- Xbar+zvalue*s/sqrt(n)

lowerbound
## [1] 391.1224
upperbound
## [1] 425.2776

Q2: The article “An Automatic Visual System for Marble Tile Classification” L. Carrino, W. Polini, and S. Turchetta, Journal of Engineering Manufacture, 2002:1095-1108) describes a measure for the shade of marble tile in which the amount of light reflected by the tile is measured on a scale of 0-255. A perfectly black tile would reflect no light and measure 0, and a perfectly white tile would measure 255. A sample of nine Mezza Perla tiles were measured, with the following results: The results are in the .csv and .xlsx file titled ‘RAssignment2Table2.csv’ and ‘RAssignment2Table2.xlsx’ as well as pasted in the word file.

Load the data set and required library or set up the data set in R as shown in the 2nd procedure

library(readr)
## Warning: package 'readr' was built under R version 4.1.3
Question2 <- read_csv("RAssignment2Table2.csv")
## Rows: 9 Columns: 1
## -- Column specification --------------------------------------------------------
## Delimiter: ","
## dbl (1): Scale
## 
## i Use `spec()` to retrieve the full column specification for this data.
## i Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Procedure for setting up data 
shades <- c(204.999,206.149,202.102,207.048,203.496,206.343,203.496,206.676,205.831)

Use the R command t.test to construct a 95% confidence interval for the mean shade. Note that this is Exercise 7 in section 5.3 from the textbook. (9 points)

t.test(Question2, conf.level = 0.95) # 99% confidence Interval
## 
##  One Sample t-test
## 
## data:  Question2
## t = 358.32, df = 8, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  203.8066 206.4468
## sample estimates:
## mean of x 
##  205.1267
t.test(shades, conf.level = 0.95) # Example of a 99% confidence Interval
## 
##  One Sample t-test
## 
## data:  shades
## t = 358.32, df = 8, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  203.8066 206.4468
## sample estimates:
## mean of x 
##  205.1267

Q3: A tire manufacturer wishes to compare the tread wear of tires made of a new material with that of tires made of a conventional material. One tire of each type is placed on each front wheel of each of 10 front-wheel-drive automobiles. The results are in the .csv and .xlsx file titled ‘RAssignment2Table3.csv’ and ‘RAssignment2Table3.xlsx’ respectively and are pasted in the word file.

Find a 95% confidence interval for the mean difference in tread wear between the old and new materials via a paired design. Note that this is Table 5.1 and Figure 5.15 from the textbook. (9 points)

# Set up dataset in R or read in the .csv or .xlsx file
new <- c(4.35,5,4.21,5.03,5.71,4.61,4.7,6.03,3.8,4.7)
old <- c(4.19,4.62,4.04,4.72,5.52,4.26,4.27,6.24,3.46,4.5)

t.test(new, old, paired = TRUE)
## 
##  Paired t-test
## 
## data:  new and old
## t = 4.0186, df = 9, p-value = 0.003024
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.101403 0.362597
## sample estimates:
## mean of the differences 
##                   0.232

Q4: Four machines manufacture cylindrical steel pins. The pins are subject to length specification. A pin may meet the specification, or it may be too short or too long. A total of 1021 pins were sampled and categorized with respect to both length and diameter specifications. The results are shown in the .csv file titled ‘RAssignemnt2Table4.csv’ and .xlsx file titled ‘RAssignemnt2Table4.xlsx’ and are pasted in the word file.

Test the null hypothesis that the proportions of pins that are too thin, OK, or too thick with respect to the diameter specification do not depend on the classification with respect to the length specification. Note that this is example 6.23 from the textbook. (9 points)

Question4 <- read_csv("RAssignment2Table4.csv", col_names = FALSE)
## Rows: 3 Columns: 3
## -- Column specification --------------------------------------------------------
## Delimiter: ","
## dbl (3): X1, X2, X3
## 
## i Use `spec()` to retrieve the full column specification for this data.
## i Specify the column types or set `show_col_types = FALSE` to quiet this message.
chisq.test(Question4)
## 
##  Pearson's Chi-squared test
## 
## data:  Question4
## X-squared = 7.4605, df = 4, p-value = 0.1135