Load Library dan Import Dataset
library(readxl)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(DescTools)
## Warning: package 'DescTools' was built under R version 4.0.3
data <- read_xls("D:/DataCompetition/RASIO/data.xls")
Five-Number Summary
summary(data$QoL0)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 40.0 52.0 57.0 59.1 64.0 96.0
Split Data Berdasarkan Kategori Treatment
A <- data %>% filter(Treat=="A")
AB <- data %>% filter(Treat=="AB")
A
## # A tibble: 34 x 6
## id Treat QoL0 QoL1 QoL2 QoL3
## <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 r01 A 72 94 67 100
## 2 r02 A 48 54 63 68
## 3 r03 A 58 72 69 78
## 4 r04 A 54 91 92 95
## 5 r05 A 60 100 100 100
## 6 r06 A 65 80 83 82
## 7 r07 A 62 79 78 72
## 8 r08 A 45 98 96 93
## 9 r09 A 50 91 92 88
## 10 r10 A 57 98 100 100
## # ... with 24 more rows
AB
## # A tibble: 35 x 6
## id Treat QoL0 QoL1 QoL2 QoL3
## <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 r35 AB 59 69 80 82
## 2 r36 AB 67 97 96 97
## 3 r37 AB 45 94 95 95
## 4 r38 AB 52 75 87 72
## 5 r39 AB 49 94 93 95
## 6 r40 AB 40 100 99 94
## 7 r41 AB 61 99 98 100
## 8 r42 AB 51 91 94 96
## 9 r43 AB 57 84 83 82
## 10 r44 AB 64 99 98 93
## # ... with 25 more rows
Uji Normalitas
shapiro.test(data$QoL0)
##
## Shapiro-Wilk normality test
##
## data: data$QoL0
## W = 0.93307, p-value = 0.00114
Point A
Aframe <- data.frame(A)
wilcox.test(Aframe$QoL0,Aframe$QoL1,paired=TRUE,alternative="less")
## Warning in wilcox.test.default(Aframe$QoL0, Aframe$QoL1, paired = TRUE, : cannot
## compute exact p-value with ties
##
## Wilcoxon signed rank test with continuity correction
##
## data: Aframe$QoL0 and Aframe$QoL1
## V = 13, p-value = 5.985e-07
## alternative hypothesis: true location shift is less than 0
Point B
ABframe <- data.frame(AB)
wilcox.test(Aframe$QoL1,ABframe$QoL1,paired=F,alternative="less")
## Warning in wilcox.test.default(Aframe$QoL1, ABframe$QoL1, paired = F,
## alternative = "less"): cannot compute exact p-value with ties
##
## Wilcoxon rank sum test with continuity correction
##
## data: Aframe$QoL1 and ABframe$QoL1
## W = 510.5, p-value = 0.1563
## alternative hypothesis: true location shift is less than 0
Point C
pejA <- as.matrix(data.frame(A$QoL0,A$QoL1,A$QoL2,A$QoL3))
PageTest(pejA)
##
## Page test for ordered alternatives
##
## data: pejA
## L = 960, p-value = 1.476e-12