drugData<-read.csv("VAS DATA.csv")
drugData
## Group VAS_before VAS_after
## 1 A 86 71
## 2 A 77 59
## 3 A 75 44
## 4 A 83 49
## 5 A 72 32
## 6 A 70 42
## 7 A 77 38
## 8 A 76 36
## 9 A 85 33
## 10 A 79 29
## 11 A 71 37
## 12 A 76 62
## 13 A 68 29
## 14 A 69 41
## 15 A 80 38
## 16 A 72 40
## 17 B 84 82
## 18 B 74 73
## 19 B 75 77
## 20 B 79 81
## 21 B 77 76
## 22 B 80 74
## 23 B 82 80
## 24 B 61 60
## 25 B 85 86
## 26 B 68 61
## 27 B 69 67
## 28 B 72 70
## 29 B 70 72
## 30 B 73 69
## 31 B 74 73
## 32 B 66 62
drugDataA<-subset(drugData,drugData$Group=="A")
drugDataA
## Group VAS_before VAS_after
## 1 A 86 71
## 2 A 77 59
## 3 A 75 44
## 4 A 83 49
## 5 A 72 32
## 6 A 70 42
## 7 A 77 38
## 8 A 76 36
## 9 A 85 33
## 10 A 79 29
## 11 A 71 37
## 12 A 76 62
## 13 A 68 29
## 14 A 69 41
## 15 A 80 38
## 16 A 72 40
drugDataB<-subset(drugData,drugData$Group=="B")
drugDataB
## Group VAS_before VAS_after
## 17 B 84 82
## 18 B 74 73
## 19 B 75 77
## 20 B 79 81
## 21 B 77 76
## 22 B 80 74
## 23 B 82 80
## 24 B 61 60
## 25 B 85 86
## 26 B 68 61
## 27 B 69 67
## 28 B 72 70
## 29 B 70 72
## 30 B 73 69
## 31 B 74 73
## 32 B 66 62
#Ho:VAS before test= VAS after test
#H1: VAS after test<VAS score before test
#Use one sample paired test (1 sample 2 conditions)
#Since it is a single sample with pre and post scenarios on ample samples.
#We go for Pairwise t test
t.test(drugDataA$VAS_before,drugDataA$VAS_after,alternative = "greater",paired = T)
##
## Paired t-test
##
## data: drugDataA$VAS_before and drugDataA$VAS_after
## t = 12.021, df = 15, p-value = 2.111e-09
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## 28.61447 Inf
## sample estimates:
## mean of the differences
## 33.5
#P-value<0.05 (LOS) .Hence we reject Null Hypothesis.
#Ho:VAS before test= VAS after test
#H1: VAS after test<VAS score before test
#Use one sample paired test (1 sample 2 conditions)
#Since it is a single sample with pre and post scenarios on ample samples.
#We go for Pairwise t test
t.test(drugDataB$VAS_before,drugDataB$VAS_after,alternative = "greater",paired = T)
##
## Paired t-test
##
## data: drugDataB$VAS_before and drugDataB$VAS_after
## t = 2.4252, df = 15, p-value = 0.01419
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## 0.4503799 Inf
## sample estimates:
## mean of the differences
## 1.625
#P-Value is less than 0.05 (LOS) Hence we reject Null hypothesis
#Ho:VAS after test (A)= VAS after test (B)
#H1: VAS after test (B)<VAS score after test (A)
#Use one sample paired test (1 sample 2 conditions)
#Since we have to compare 2 samples and there is single factor with only 2 levels,
#we apply t test for 2 independent samples
t.test(VAS_after~Group,data=drugData,alternative="greater",var.equal=T)
##
## Two Sample t-test
##
## data: VAS_after by Group
## t = -8.4275, df = 30, p-value = 1
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## -36.26715 Inf
## sample estimates:
## mean in group A mean in group B
## 42.5000 72.6875
#P-value is >0.0 (LOS) Hence we accpet Null hypothesis
library(ggplot2)
ggplot(data=drugData,aes(x=Group,y=VAS_after))+
geom_boxplot()
