Assignment week 4.1 : Analysis of data one and two group comparison

Statistic summary of the two group

setwd("C:/TMHG531/assignment")
ind.dat2 <- read.csv("ind_t_test2.csv")
summary(ind.dat2[ind.dat2$group==1,2])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    29.0    39.0    47.0    66.0    94.5   135.0
summary(ind.dat2[ind.dat2$group==2,2])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    12.0    51.0   111.0   133.9   134.5  1000.0
sd(ind.dat2[ind.dat2$group==1,2])
## [1] 36.8588
sd(ind.dat2[ind.dat2$group==2,2])
## [1] 195.6781

Boxplot of Amylase level among the two groups of patients

#box plot of amylase level among the two group
boxplot(amylase~group, data=ind.dat2, main="Amylase level among the two group of patients",
        xlab="group", ylab="amylase level")

F-test to compare variane of data

H0 The two sample have equal variance σ1² = σ2²
H1 The two sample have unequal variance σ1² ≠ σ2²
var.test(ind.dat2[ind.dat2$group==1,2],ind.dat2[ind.dat2$group==2,2])
## 
##  F test to compare two variances
## 
## data:  ind.dat2[ind.dat2$group == 1, 2] and ind.dat2[ind.dat2$group == 2, 2]
## F = 0.035481, num df = 14, denom df = 22, p-value = 8.191e-08
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.01403261 0.09984197
## sample estimates:
## ratio of variances 
##         0.03548119

T-test for two sample with different variance

H0 The amylase level between the two group is not difference µ1² = µ2²
H1 The amylase level between the two group is difference µ1² ≠ µ2²
t.test(ind.dat2[ind.dat2$group==1,2],ind.dat2[ind.dat2$group==2,2],var.equal = FALSE,paired = FALSE)
## 
##  Welch Two Sample t-test
## 
## data:  ind.dat2[ind.dat2$group == 1, 2] and ind.dat2[ind.dat2$group == 2, 2]
## t = -1.621, df = 24.346, p-value = 0.1179
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -154.31906   18.49297
## sample estimates:
## mean of x mean of y 
##    66.000   133.913

Result

F-test T-test
Group N DF Mean SD Ratio of Varience f-value p-value Decision t-value p-value 95% CI Decision
1 15 14 66.000 36.859 0.03548119 0.035 < 0.001 Reject -1.621 0.1179 -154.31906 - 18.49297 Accept
2 23 22 133.913 195.678

According to the F-test comparing variane of data of the two group, the p-value is less than 0.001 which less than the significant level of 0.05. Therefore, the null hypothesis is rejected and that the two group have unequal variance of data.

As a result of performing of T-test for two sample which have unequal variance, the p-value is 0.1179 which greater than the significant level of 0.05. Therefore, the null hypothesis is accepted and that the amylase level in the two group is not difference statistically significance.