1 2.24

#2.24

#Defining the samples
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)

mean(m1)
## [1] 16.015
mean(m2)
## [1] 16.005
#Calculating the variance
c1<-0.015^2
c1
## [1] 0.000225
c2<-0.018^2
c2
## [1] 0.000324

2 2.26

#2.26
library(lawstat)

#Defining the samples
t1<-c(65,81,57,66,82,82,67,59,75,70)
t2<-c(64,71,83,59,65,56,69,74,82,79)
n<-c(1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2)
dat<-c(t1,t2)
dat2<-data.frame(dat,n)
dat2
##    dat n
## 1   65 1
## 2   81 1
## 3   57 1
## 4   66 1
## 5   82 1
## 6   82 1
## 7   67 1
## 8   59 1
## 9   75 1
## 10  70 1
## 11  64 2
## 12  71 2
## 13  83 2
## 14  59 2
## 15  65 2
## 16  56 2
## 17  69 2
## 18  74 2
## 19  82 2
## 20  79 2
#a) Levene's test for the variances
levene.test(dat2$dat,dat2$n,location = c("mean"),trim.alpha = 0.05)
## 
##  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$dat
## Test Statistic = 0.0014598, p-value = 0.9699
#b)t-test for the mean
t.test(t1,t2,var.equal = FALSE,conf.level = 0.95)
## 
##  Welch Two Sample t-test
## 
## data:  t1 and t2
## t = 0.048008, df = 17.998, p-value = 0.9622
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -8.552517  8.952517
## sample estimates:
## mean of x mean of y 
##      70.4      70.2

3 2.29

#2.29

#Defining the samples
t_95<-c(11.176,7.089,8.089,11.739,11.291,10.759,6.467,8.315)
t_100<-c(5.263,6.748,7.461,7.015,8.133,7.418,3.772,8.963)

t.test(t_95,t_100,alternative = c("greater"), var.equal = FALSE,conf.level = 0.95)
## 
##  Welch Two Sample t-test
## 
## data:  t_95 and t_100
## t = 2.6735, df = 13.224, p-value = 0.009453
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
##  0.8525701       Inf
## sample estimates:
## mean of x mean of y 
##  9.365625  6.846625
mean(t_95)
## [1] 9.365625
mean(t_100)
## [1] 6.846625
sd(t_95)
## [1] 2.100257
sd(t_100)
## [1] 1.640427
sd(t_95)^2
## [1] 4.41108
sd(t_100)^2
## [1] 2.690999
#c) Check normality
qqnorm(t_95,main="Normal Q-Q Plolt",xlab="95 degrees",col="blue")
qqline(t_95,col="blue")

qqnorm(t_100,main="Normal Q-Q Plolt",xlab="100 degrees",col="red")
qqline(t_100,col="red")

e) According with the Q-Q plots for both 95 and 100 degrees, the data looks fairly normal distributed.