Entering Data
type <- c("Type1", "Type1", "Type1", "Type1", "Type1", "Type1", "Type1", "Type1", "Type1", "Type1", "Type2", "Type2", "Type2", "Type2", "Type2", "Type2", "Type2", "Type2", "Type2", "Type2")
data <- c(65, 81, 57, 66, 82, 82, 67, 59, 75, 70, 64, 71, 83, 59, 65, 56, 69, 74, 82, 79)
A <- cbind(type,data)
BT <- as.data.frame(A)
BT$type <- as.factor(BT$type)
BT$data <- as.numeric(BT$data)
Ans (a) Using Levene’s test to prove equality of the two variances:
library (lawstat)
levene.test(BT$data, BT$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: BT$data
## Test Statistic = 0.0014598, p-value = 0.9699
We can see that the P-Value is 0.99699 which is very large when compared to the alpha value 0.05. This shows a weak evidence against the null hypothesis, so we fail to reject the null hypothesis.
Ans (b) Using the Two sample t-Test to test the hypothesis that the mean burning times are equal:
dat1 <- BT %>% filter (type=="Type1") %>% select (data)
dat2 <- BT %>% filter (type=="Type2") %>% select (data)
t.test(dat1, dat2, var.equal=TRUE)
##
## Two Sample t-test
##
## data: dat1 and dat2
## 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
Null hypothesis: Ho : u1=u2 : u1-u2=0
Alternative hypothesis: Ha : u1/=u2 : u1-u2 /= 0
The P-Value is 0.9622 which is greater than 0.05. Hence, we do not reject the null hypothesis Ho and the mean burning times are equal.
Source Code
# All R code used in document
type <- c("Type1", "Type1", "Type1", "Type1", "Type1", "Type1", "Type1", "Type1", "Type1", "Type1", "Type2", "Type2", "Type2", "Type2", "Type2", "Type2", "Type2", "Type2", "Type2", "Type2")
data <- c(65, 81, 57, 66, 82, 82, 67, 59, 75, 70, 64, 71, 83, 59, 65, 56, 69, 74, 82, 79)
A <- cbind(type,data)
BT <- as.data.frame(A)
BT$type <- as.factor(BT$type)
BT$data <- as.numeric(BT$data)
library (lawstat)
levene.test(BT$data, BT$type, location="mean")
library(dplyr)
dat1 <- BT %>% filter (type=="Type1") %>% select (data)
dat2 <- BT %>% filter (type=="Type2") %>% select (data)
t.test(dat1, dat2, var.equal=TRUE)