1 Answer to Question no. 2.24.

The given data are imported into R:

machine1 <- c(16.03,16.04,16.05,16.05,16.02,16.01,15.96,15.98,16.02,15.99)
machine2 <- c(16.02,15.97,15.96,16.01,15.99,16.03,16.04,16.02,16.01,16.00)


machine <- cbind(machine1, machine2)
machine <- as.data.frame(machine)
View(machine)
str(machine)
## 'data.frame':    10 obs. of  2 variables:
##  $ machine1: num  16 16 16.1 16.1 16 ...
##  $ machine2: num  16 16 16 16 16 ...

1.1 Answer a:

The Null hypothesis for the current experiment is that the mean of the filled net volumes by the two machines are equal. The alternative hypothesis is that the means of the filled net volumes are not equal.

If u1 and u2 are the means of the net filled volume of machine 1 and machine 2 respectively, then-

Null Hypothesis: Ho: u1 = u2

Alternative Hypothesis: u1 ≠ u2

1.2 Answer b:

Prior to performing the t-test, we check the normality and the equivalence of variance of the sample data-

library(lawstat)
## Warning: package 'lawstat' was built under R version 4.2.1
machine_levene_test <- machine
machine_levene_test <- stack(machine_levene_test)
levene.test(machine_levene_test$values, machine_levene_test$ind, location = "mean")
## 
##  Classical Levene's test based on the absolute deviations from the mean
##  ( none not applied because the location is not set to median )
## 
## data:  machine_levene_test$values
## Test Statistic = 0.3318, p-value = 0.5717
qqnorm(machine$machine1, col = "red", main = "Machine 1 fill")
qqline(machine$machine1)

qqnorm(machine$machine2, col = "blue", main = "Machine 2 fill")
qqline(machine$machine2)

From the normality check using the NPP plot, we see that both the data sets from the two different machines follow a fairly linear trend. Since the normality of the data distribution is a weak assumption, we can move forward with the current normality assumption.

From the Levene’s test we observe that the p-value is large (0.57). The null hypothesis in Leven’s test is that the variance of the different samples are equal. Since we have a large P-value, we cannot reject the null hypothesis. Hence, from leven’s test we conclude that the two machines have equal variances although in the original question it is stated that their standard deviations are different.

The test statistic for the t-test are shown as follows:

?t.test
## starting httpd help server ... done
t.test(machine$machine1, machine$machine2, var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  machine$machine1 and machine$machine2
## t = 0.79894, df = 18, p-value = 0.4347
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.01629652  0.03629652
## sample estimates:
## mean of x mean of y 
##    16.015    16.005

From the t-test statistic we see that the P-value is large (0.43). Hence we conclude that there is not enough evidence to reject the null hypothesis. Hence the means of the filled volumes of the two machines are equal.

1.3 Answer c:

The P-value for the current test is 0.4347 which is large enough not to reject the Null hypothesis. That is the means of the two fill volumes are the same.

1.4 Answer d:

The 95% confidence interval on the difference in the mean is 0.01629652 < u1-u2 < 0.03629652. This means that we are 95% confident that the mean difference of the two samples are between 0.01 to 0.03

2 Answer to Question no. 2.24.

The given data are imported into R:

type1 <- c(65, 81, 57, 66, 82, 82, 67, 59, 75, 70)
type2 <- c(64, 71, 83, 59, 65, 56, 69, 74, 82, 79)
flares <- cbind(type1, type2)
flares <- as.data.frame(flares)
View(flares)
str(flares)
## 'data.frame':    10 obs. of  2 variables:
##  $ type1: num  65 81 57 66 82 82 67 59 75 70
##  $ type2: num  64 71 83 59 65 56 69 74 82 79

2.1 Answer a:

We perform the Leven’s test in r:

flares_levene_test <- flares
flares_levene_test <- stack(flares_levene_test)
str(flares_levene_test)
## 'data.frame':    20 obs. of  2 variables:
##  $ values: num  65 81 57 66 82 82 67 59 75 70 ...
##  $ ind   : Factor w/ 2 levels "type1","type2": 1 1 1 1 1 1 1 1 1 1 ...
levene.test(flares_levene_test$values, flares_levene_test$ind, location = "mean")
## 
##  Classical Levene's test based on the absolute deviations from the mean
##  ( none not applied because the location is not set to median )
## 
## data:  flares_levene_test$values
## Test Statistic = 0.0014598, p-value = 0.9699

If v1 and v2 are the variances of the two samples, for a standard Levene’s test, the two hypothesis are:

Null Hypothesis, Ho: v1 = v2

Alternative Hypothesis, Ha: v1 ≠ v2

From the test statistic, we observe that the P-value is 0.96 which is larger than our tolerance level. Hence, we cannot reject the Null hypothesis that the two sample variances are equal. Hence, the two sample variances are equal and we can proceed with the pooled variance t-test.

2.2 Answer b:

From Answer a, we confirmed the equality of variance, which is the strong assumption of the pooled t-test. Now we check the normality of the data-

qqnorm(flares$type1, col = "red", main = "Type 1 burning time")
qqline(flares$type1)

qqnorm(flares$type2, col = "blue", main = "Type 2 burning time")
qqline(flares$type2)

The normal probability plots show that the two sample data are distributed in a fairly straight line trend. The pooled t-test statistic are shown as follows:

If u1 and u2 are the mean burning times of type1 and type2 flares respectively, the two hypothesis are:

Null Hypothesis, Ho: u1 = u2

Alternative Hypothesis, Ha: u1 ≠ u2

t.test(flares$type1, flares$type2, var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  flares$type1 and flares$type2
## t = 0.048008, df = 18, p-value = 0.9622
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -8.552441  8.952441
## sample estimates:
## mean of x mean of y 
##      70.4      70.2

From the test statistic we see that the p-value is larger (0.96) than our tolerance level of α = 0.05. Hence, we cannot reject the null hypothesis. Thus, the mean burning times of the two samples of flares are the same.

3 Answer to Question no. 2.29.

The given data are imported into R:

t95 <- c(11.176, 7.089, 8.097, 11.739, 11.291, 10.759, 6.467, 8.315)
t100 <- c(5.263, 6.748, 7.461, 7.015, 8.133, 7.418, 3.772, 8.963)
thickness <- cbind(t95, t100)
thickness <- as.data.frame(thickness)
View(thickness)
str(thickness)
## 'data.frame':    8 obs. of  2 variables:
##  $ t95 : num  11.18 7.09 8.1 11.74 11.29 ...
##  $ t100: num  5.26 6.75 7.46 7.01 8.13 ...

3.1 Answer a:

Prior to performing a t-test, we check the equality of variance for the pooled t-test:

thickness_levene_test <- thickness
thickness_levene_test <- stack(thickness_levene_test)
levene.test(thickness_levene_test$values, thickness_levene_test$ind, location = "mean")
## 
##  Classical Levene's test based on the absolute deviations from the mean
##  ( none not applied because the location is not set to median )
## 
## data:  thickness_levene_test$values
## Test Statistic = 2.5625, p-value = 0.1317

We observe that the P-value for the Leven’s test is greater than our confidence level of 0.05. Hence, we cannot reject the null hypothesis in Leven’s test. Hence, the variance of the two samples equal. We can now proceed with the pooled t-test.

If u1 and u2 are the mean thickness of wafers cured under temperature 95 and 100 respectively, then for our t-test, the hypotheses are as shown:

Null hypothesis, Ho: u1 = u2

Alternative hypothesis, Ha: u1 > u2

Now we see the t-test statistic:

t.test(thickness$t95, thickness$t100, alternative = "greater", var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  thickness$t95 and thickness$t100
## t = 2.6751, df = 14, p-value = 0.009059
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
##  0.8608158       Inf
## sample estimates:
## mean of x mean of y 
##  9.366625  6.846625

From the one-tailed t-test, we observe that P-value (0.009) is smaller than our level of significance of 0.05. Hence, we have enough evidence to reject the null hypothesis. Hence, the mean thickness of the wafers baked at higher temperature of 100 degrees Celsius is lower than wafers baked at 95 degrees.

3.2 Answer b:

The P-Value from the test statistics 0.009. This is the probability of the two wafer thickness to be equal if the null hypothesis were true. Since this value is much lower than our level of significance of 0.05, we reject the null hypothesis.

3.3 Answer c:

The 95% confidence interval on the difference in means is: 0.86 < u1-u2 < infinity. This means that we are 95% confident that the mean difference between the thickness of wafers baked at 100 and 95 degrees are 0.86 or higher.

3.4 Answer d:

The assumptions of normality are checked using the following NPP plots:

qqnorm(thickness$t95, col = "red", ylab = "Sample thickness (kA)", main = "Temperature 95")
qqline(thickness$t95)

qqnorm(thickness$t100, col = "blue", ylab = "Sample thickness (kA)", main = "Temperature 100")
qqline(thickness$t100)

From the normal probability plot we observe that both the samples have the thickness values distributed in a farily linear pattern. From this we can conclude that the two samples have an approximately normal distribution.

4 Complete Code:

                                       #Answer to question no 2.24.
machine1 <- c(16.03,16.04,16.05,16.05,16.02,16.01,15.96,15.98,16.02,15.99)
machine2 <- c(16.02,15.97,15.96,16.01,15.99,16.03,16.04,16.02,16.01,16.00)
machine <- cbind(machine1, machine2)
machine <- as.data.frame(machine)
View(machine)
str(machine)
#Performing Levine Test
install.packages("lawstat")
library("lawstat")
machine_levene_test <- machine
machine_levene_test <- stack(machine_levene_test)
levene.test(machine_levene_test$values, machine_levene_test$ind, location = "mean")
#Checking Normality
qqnorm(machine$machine1, col = "red")
qqline(machine$machine1)
qqnorm(machine$machine2, col = "blue")
qqline(machine$machine2)
#performing t-test
?t.test
t.test(machine$machine1, machine$machine2, var.equal = TRUE)

                                      #Answer to question no 2.24.

type1 <- c(65, 81, 57, 66, 82, 82, 67, 59, 75, 70)
type2 <- c(64, 71, 83, 59, 65, 56, 69, 74, 82, 79)
flares <- cbind(type1, type2)
flares <- as.data.frame(flares)
View(flares)
str(flares)

#Performing Levine Test
flares_levene_test <- flares
flares_levene_test <- stack(flares_levene_test)
str(flares_levene_test)
levene.test(flares_levene_test$values, flares_levene_test$ind, location = "mean")

#Checking Normality
qqnorm(flares$type1, col = "red")
qqline(flares$type1)
qqnorm(flares$type2, col = "blue")
qqline(flares$type2)

#performing t-test
?t.test
t.test(flares$type1, flares$type2, var.equal = TRUE)

 
                                    #Answer to question no 2.29.

t95 <- c(11.176, 7.089, 8.097, 11.739, 11.291, 10.759, 6.467, 8.315)
t100 <- c(5.263, 6.748, 7.461, 7.015, 8.133, 7.418, 3.772, 8.963)
thickness <- cbind(t95, t100)
thickness <- as.data.frame(thickness)
View(thickness)
str(thickness)
#Performing Levine Test
thickness_levene_test <- thickness
thickness_levene_test <- stack(thickness_levene_test)
levene.test(thickness_levene_test$values, thickness_levene_test$ind, location = "mean")
#Checking Normality
qqnorm(thickness$t95, col = "red", main = "Temperature 95")
qqline(thickness$t95)
qqnorm(thickness$t100, col = "blue", main = "Temperature 100")
qqline(thickness$t100)

#performing t-test
?t.test
t.test(thickness$t95, thickness$t100, alternative = "greater", var.equal = TRUE)