QUESTION 1 (2.24)

M1<-c(16.03,16.04,16.05,16.05,16.02,16.01,15.96,15.98,16.02,15.99)
M2<-c(16.02,15.97,15.96,16.01,15.99,16.03,16.04,16.02,16.01,16.00)
machine22<-cbind(M1,M2) 
mAB<- as.data.frame(machine22) 

Question 1a)

Stating the Hypothesis

The is Ho:u1=u2 or u1=u2

Alternative Hypothesis that is Ha: u1\("\neq"\) u2 meaning u1\("\neq"\) u2

{r,warning=FALSE}

Question 1b

alpha level of 0.05

t.test(mAB$M1,mAB$M2,var.equal=TRUE)
## 
##  Two Sample t-test
## 
## data:  mAB$M1 and mAB$M2
## 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

Question 1b

p-value = 0.4347 is greater than value of significance (alpha=0.05) is , we fail to reject the null hypothesis, stating that both samples are equal

Question 1c

The p value is 0.4347

Question 1d

-0.01629652<u1-u2<0.03629652

Question 2.26 a

TypeAB<-c("Type1","Type1","Type1","Type1","Type1","Type1","Type1","Type1","Type1","Type1","Type2","Type2","Type2","Type2","Type2","Type2","Type2","Type2","Type2","Type2")
dat0<- c(65,81,57,66,82,82,67,59,75,70,64,71,83,59,65,56,69,74,82,79)
dat1 <- cbind(TypeAB,dat0)
dat2<- as.data.frame(dat1)
dat2$TypeAB <- as.factor(dat2$TypeAB)
dat2$dat0<-as.numeric(dat2$dat0)

Using levene’s test to prove equality of variance

library(lawstat)
levene.test(dat2$dat0,dat2$TypeAB,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:  dat2$dat0
## Test Statistic = 0.0014598, p-value = 0.9699

Since the p-value is 0.9699 which is greater than (alpha=0.05)

null hypothesis is accepted stating that the variances are equal.

QUESTION 2B

The Null hypothesis- Ho: u1=u2 u1=u2

Alternative hypothesis- Ha: u1\("\neq"\) u2 meaning u1\("\neq"\) u2

library(dplyr)
data0<- dat2 %>% filter(TypeAB=="Type1") %>% select (dat0) 
data1<- dat2 %>% filter(TypeAB=="Type2") %>% select(dat0)
t.test(data0,data1,var.equal= TRUE)
## 
##  Two Sample t-test
## 
## data:  data0 and data1
## 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

p value obtained is 0.9622 which is greater than alpha level(0.05)

b). p value 0.9622

QUESTION 2.29

thick95<-c(11.176,7.089,8.097,11.739,11.291,10.759,6.467,8.315)
thick100<-c(5.263,6.748,7.461,7.015,8.133,7.418,3.772,8.963)
dat<-cbind(thick100,thick95)
dat1<- as.data.frame(dat)

let

u1= mean of thickness 95

u2= mean of thickness 100

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

p-value is 0.009059 is less than our reference value of alpha

QUESTION 2.29 b

the p- value is 0.009059

Question 2.29 c

Question 2.29 e

Checking for Normality

qqnorm(dat1$thick100,main=" for thick 100")
qqline(dat1$thick100)

qqnorm(dat1$thick95,main="for thick 95")
qqline(dat1$thick95)

refore make conclusions that it approximately follows a normal distribution because both plots follows a striaght line.