Вы находитесь на странице: 1из 5

STEEF CONER MARCEL

201134972720164
TUGAS STATISTIK INDIVIDU II
CHAPTER 11
Nomor 21
(a)
Tipe1 <- c(3.03,5.53,5.60,9.30,9.92,12.51,12.95,15.21,16.04,16.84)
Tipe2 <- c(3.19,4.26,4.47,4.53,4.67,4.69,12.78,6.79,9.37,12.75)

#memunculkan tipe 1
#memunculkan tipe 1

dataframetipe12 <- data.frame(Tipe1, Tipe2)


t.test(Tipe1, Tipe2,var.equal=TRUE) #Rlab 7a metode distribusi menganggap bahwa variasi sama
Hasil: Two Sample t-test
data: Tipe1 and Tipe2
t = 2.0723, df = 18, p-value = 0.05288
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.05444249 7.94044249
sample estimates:
mean of x mean of y
10.693 6.750
Metode manual
mdiff <- mean(Tipe1) - mean(Tipe2)
sp2 <- ( (length(Tipe1)-1) * var(Tipe1) + (length(Tipe2)-1) * var(Tipe2) ) /
( length(Tipe1) + length(Tipe2) - 2)
sp <- sp2^.5
sp
Hasil: 4.254586
LL <- signif(mdiff - qt(.975, df= length(Tipe1) + length(Tipe2) - 2) * sp, digits = 2)
UL <- signif(mdiff + qt(.975, df= length(Tipe1) + length(Tipe2) - 2) * sp, digits = 2)
LL; UL
Hasil: -5; 13
(b)
wilcox.test(Tipe1, Tipe2,conf.int=T)
paired
Hasil: Wilcoxon rank sum test

#non-parametric Rlab7a pakai yang independence, jangan pakai

data: Tipe1 and Tipe2


W = 75, p-value = 0.06301
alternative hypothesis: true location shift is not equal to 0
95 percent confidence interval:
-0.16 8.48
sample estimates:
difference in location
4.35
(c)

boxplot (Tipe1, Tipe2)


#metode yang paling baik adalah normal theory karena distribusi normal
itu menyebar cenderung symetric menggunakan Mann-whitney U-test
Hasil:

Nomor 48
Tipe1 <- c(24.6,17.0,16.0,10.4,8.2,7.9,8.2,7.9,5.8,5.4,5.1,4.7)
Tipe2 <- c(10.1,5.7,5.6,3.4,6.5,0.7,6.5,0.7,6.1,4.7,2.0,2.9)

#memunculkan data tipe 1


#memunculkan data tipe 2

dataframetipe12 <- data.frame(Tipe1, Tipe2)


shapiro.test(Tipe1)
#Parameter, METHOD BASED ON NORMAL DISTRIBUTION
Hasil: Shapiro-Wilk normality test
data: Tipe1
W = 0.8106, p-value = 0.01239
shapiro.test(Tipe2)
Hasil: Shapiro-Wilk normality test
data: Tipe2
W = 0.9447, p-value = 0.5612

Beda <- Tipe2 - Tipe1


shapiro.test(Beda)
Hasil: Shapiro-Wilk normality test
data: Beda
W = 0.913, p-value = 0.2333
#Parametric approach
t.test(Tipe1, Tipe2,paired=T,conf.level = 0.9)
Hasil: Paired t-test
data: Tipe1 and Tipe2
t = 4.0012, df = 11, p-value = 0.002082
alternative hypothesis: true difference in means is not equal to 0

90 percent confidence interval:


3.045192 8.004808
sample estimates:
mean of the differences
5.525
#nonparametric
wilcox.test(Tipe1, Tipe2,paired=T)
Hasil: Wilcoxon signed rank test with continuity correction
data: Tipe1 and Tipe2
V = 77, p-value = 0.00324
alternative hypothesis: true location shift is not equal to 0
#membandingkan
t.test(sqrt(Tipe2), sqrt(Tipe1), alternative="less", paired= T)
Hasil: Paired t-test
data: sqrt(Tipe2) and sqrt(Tipe1)
t = -4.6398, df = 11, p-value = 0.0003584
alternative hypothesis: true difference in means is less than 0
95 percent confidence interval:
-Inf -0.6390743
sample estimates:
mean of the differences
-1.042635
#p-value = 0.0003584
#HO ditolak karena terdapat penurunan signifikan jumlah urine protein
#original scale
t.test(Tipe1, Tipe2)
Hasil: Welch Two Sample t-test
data: Tipe1 and Tipe2
t = 2.874, df = 15.354, p-value = 0.01138
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
1.435629 9.614371
sample estimates:
mean of x mean of y
10.100 4.575
#log scale
log.1 <- log(Tipe1)
log.2 <- log(Tipe2)

#mengubah data menjadi log

var(log.1)

#membandingkan variansinya

Hasil: 0.27383
var(log.2)

Hasil: 0.7520682
var.test(log.1,log.2)
Hasil: F test to compare two variances

#melihat kesamaan variansinya

data: log.1 and log.2


F = 0.3641, num df = 11, denom df = 11, p-value = 0.1084
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
0.104817 1.264783
sample estimates:
ratio of variances
0.3641026
#t-test on the log transformed data
t <- t.test(Tipe1, Tipe2,var.equal=T)
t

CHAPTER 13
Nomor 4
#data <- matrix(c(86, 55,
263, 360),2,2,byrow = TRUE)
colnames(data) <- c("Male","Female")
rownames(data) <- c("Mentioned","Notmentioned")
data

#Rlab1

(Xsq <- chisq.test(data))


#attribute
#p-Value= 7.646e-05,
Jawaban = datanya berbeda antara male dan female karena menolak H0

Nomor 7
#Nilai <- matrix(c(8,15,13,14,15,19,15,4,7,3,1,4),4,3,byrow = TRUE) #Melihat subjek pelajaran
apakah berhubungan atau tidak
colnames(data) <- c("Psy", "Bio", "Otr")
#bisa dikatakan
independen atau dependence?
rownames(data) <- c("gradeA","gradeB","gradeC","gradeD-F")
Nilai
chisq.test(Nilai)
#p-value = 0.06925
Jawaban = datanya dependence karena menolak H0
Nomor 9
#bi<matrix(c(14,16,8,2,133,180,93,81,12,14,12,1,241,285,139,153,11,6,8,17,259,265,221,204),6,4,byrow =
TRUE)
colnames(bi) <- c("S&S", "Emma", "SdnI", "SdnII")
rownames(bi) <- c("aPBsuch", "aNPBsuch", "andFBI", "andNFBI", "thePBon", "theNPBon")
bi
bi1 <- data.frame(rowSums(bi[,1:3]), bi[,4])

Hasil:
S&S Emma SdnI SdnII
aPBsuch 14 16 8 2
aNPBsuch 133 180 93 81
andFBI 12 14 12 1
andNFBI 241 285 139 153
thePBon 11 6 8 17
theNPBon 259 265 221 204

rowSums.bi...1.3.. bi...4.
aPBsuch
38
aNPBsuch
406
andFBI
38
andNFBI
665
thePBon
25
theNPBon
745

2
81
1
153
17
204

#Testing for H1
chisq.test(bi1) #p-Value= 1.67e-05, H1 rejected
Hasil: Pearson's Chi-squared test
data: bi1
X-squared = 52.4363, df = 15, p-value = 4.783e-06

Вам также может понравиться