2.24

data1 <-read.csv("https://raw.githubusercontent.com/maryadepoju98/DesignExperiment/main/Question2_24.csv", header = TRUE)
head(data1)
##   Machine1 Machine2
## 1    16.00    16.02
## 2    16.04    15.97
## 3    16.05    15.96
## 4    16.05    16.01
## 5    16.02    15.99
## 6    16.01    16.03

a. Null and Alternate Hypothesis

\(H_0: \mu_1=\mu_2\) OR \(\mu_1 + mu_2 = 0\)

\(H_a: \mu1\neq\mu_2\) OR \(\mu_1 + mu_2 \neq 0\)

b. Hypothesis Testing

t.test(data1$Machine1, data1$Machine2, alternatives = c("two.sided"), var.equal=TRUE)
## 
##  Two Sample t-test
## 
## data:  data1$Machine1 and data1$Machine2
## t = 0.56105, df = 18, p-value = 0.5817
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.01921246  0.03321246
## sample estimates:
## mean of x mean of y 
##    16.012    16.005

We fail to reject the null hypothesis

c. P- VALUE:

The p-value for the test: 0.5817

d. Confidence Interval

(-0.01921246 , 0.03321246)

2.26 (a - use Levene’s test,b)

data2 <- read.csv("https://raw.githubusercontent.com/maryadepoju98/DesignExperiment/main/2_26.csv", header = TRUE)

a. Levene’s Test

#unified data one column with observation second column with factors like observation type
data3 <- read.csv("https://raw.githubusercontent.com/maryadepoju98/DesignExperiment/main/2_26a.csv", header = TRUE)
str(data3) #checking to see the structures of the data types
## 'data.frame':    20 obs. of  2 variables:
##  $ BuringTime: int  65 81 57 66 82 82 67 59 75 70 ...
##  $ Type      : int  1 1 1 1 1 1 1 1 1 2 ...
data3$Type <- as.factor(data3$Type)
str(data3)
## 'data.frame':    20 obs. of  2 variables:
##  $ BuringTime: int  65 81 57 66 82 82 67 59 75 70 ...
##  $ Type      : Factor w/ 2 levels "1","2": 1 1 1 1 1 1 1 1 1 2 ...
#performing leven's test
library(lawstat)
levene.test(data3$BuringTime, data3$Type, 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:  data3$BuringTime
## Test Statistic = 0.56923, p-value = 0.4603

the p-value is > 0.05 so we can validate that they have equal variances.

\(H_0: \sigma^2_1=\sigma^2_2\) OR \(\sigma^2_1 + \sigma^2_2 = 0\)

\(H_0: \sigma^2_1\neq\sigma^2_2\) OR \(\sigma^2_1\neq\sigma^2_2 = 0\)

b. Hypothesis testing

\(H_0: \mu_1=\mu_2\) OR \(\mu_1 + mu_2 = 0\)

\(H_a: \mu1\neq\mu_2\) OR \(\mu_1 + \mu_2 \neq 0\)

t.test(data2$Type1, data2$Type2, alternative = "two.sided", var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  data2$Type1 and data2$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

The p-value is > 0.05 so We fail to reject the hypothesis

2.29 (a,b,c,e)

data4 <- read.csv("https://raw.githubusercontent.com/maryadepoju98/DesignExperiment/main/2_29.csv", header = TRUE)
head(data4)
##   degree95C degree100C
## 1    11.176      5.263
## 2     7.089      6.748
## 3     8.097      7.461
## 4    11.739      7.015
## 5    11.291      8.133
## 6    10.759      7.418
mean(data4$degree95C)
## [1] 9.366625
mean(data4$degree100C)
## [1] 6.846625
sd(data4$degree95C)
## [1] 2.099564
sd(data4$degree100C)
## [1] 1.640427
t.test(data4$degree95C, data4$degree100C, alternative = "greater", var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  data4$degree95C and data4$degree100C
## 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

Null and Alternate Hypothesis

\(H_0: \mu_1=\mu_2\) OR \(\mu_1 + mu_2 = 0\)

\(H_a: \mu1\ > \mu_2\) OR \(\mu_1 + mu_2 \ > 0\)

95 Degrees mean : 9.366625 standard deviation: 2.0999564

100 Degrees mean: 6.846625 standard deviation: 1.640427

t = 2.6751

we reject the null hypothesis

b. P- VALUE

P vALUE: 0.009059

c. confidence interval:

(0.8608158, Infinity)

e. check probability normalness

We use the Levene’s test to see if the assumption is valid. If the Levene’s test, proves to be valid we can assume normality because we proved equal variance.

library(lawstat)
data5<-read.csv("https://raw.githubusercontent.com/maryadepoju98/DesignExperiment/main/2_29e.csv",header=FALSE)
data5$V2<-as.factor(data5$V2)
levene.test(data5$V1, data5$V2, 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:  data5$V1
## Test Statistic = 2.5625, p-value = 0.1317

The p value is > than 0.05 so we can assume the variances are equal and assume normality.