#Uji Independensi Chi Square
Terapi<-matrix(c(82, 18, 68, 32), byrow=T, nrow=2)
dimnames(Terapi)<-list(kelompok=c("I", "II"), StatusPenyakit=c("sembuh", "Tidak Sembuh"))
addmargins(Terapi)
## StatusPenyakit
## kelompok sembuh Tidak Sembuh Sum
## I 82 18 100
## II 68 32 100
## Sum 150 50 200
chisq.test(Terapi)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: Terapi
## X-squared = 4.5067, df = 1, p-value = 0.03376
#Koefisien Kontingensi
N<-sum(Terapi)
xsquared<-4.5067
KoefisienKontingensi<-sqrt((xsquared)/(N+xsquared))
KoefisienKontingensi
## [1] 0.1484484