-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_5025211234.R
More file actions
144 lines (110 loc) · 2.91 KB
/
A_5025211234.R
File metadata and controls
144 lines (110 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# NOMOR 1 #
#1 Point A
before <- c(78, 75, 67, 77, 70, 72, 78, 74, 77)
after <- c(100, 95, 70, 90, 90, 90, 89, 90, 100)
difference <- after - before
difference
mean(difference)
sd(difference)
#1 Point B
t.test(after, before, paired = TRUE)
#1 Point C
#Jawaban ada di README.md
# NOMOR 2 #
#Install package BSDA
install.packages("BSDA")
library(BSDA)
#2 Point A
#Jawaban ada di README.md
#2 Point B
tsum.test(mean.x = 23500, s.x = 3900, n.x = 100)
#2 Point C
#Jawaban ada di README.md
# NOMOR 3 #
#3 Point A
#Jawaban ada di README.md
#3 Point B
tsum.test(mean.x=3.64, s.x = 1.67, n.x = 19,
mean.y =2.79 , s.y = 1.32, n.y = 27,
alternative = "greater", var.equal = TRUE)
#3 Point C
#Install package Mosaic
install.packages("mosaic")
library(mosaic)
plotDist(dist = 't', df = 2, col = "blue")
#3 Point D
qchisq(p = 0.05, df = 2, lower.tail = FALSE)
#3 Point E
#Jawaban ada di README.md
#3 Point F
#Jawaban ada di README.md
# NOMOR 4 #
#4 Point A
#pertama
dataoneway <- read.table("https://rstatisticsandresearch.weebly.com/uploads/1/0/2/6/1026585/onewayanova.txt", h = T)
attach(dataoneway)
names(dataoneway)
#kedua
dataoneway$Group <- as.factor(dataoneway$Group)
dataoneway$Group = factor(dataoneway$Group, labels = c("Kucing Oren", "Kucing Hitam", "Kucing Putih"))
class(dataoneway$Group)
#ketiga
Group1 <- subset(dataoneway, Group == "Kucing Oren")
Group2 <- subset(dataoneway, Group == "Kucing Hitam")
Group3 <- subset(dataoneway, Group == "Kucing Putih")
#keempat
qqnorm(Group1$Length)
qqline(Group1$Length)
qqnorm(Group2$Length)
qqline(Group2$Length)
qqnorm(Group3$Length)
qqline(Group3$Length)
#4 Point B
bartlett.test(Length ~ Group, data = dataoneway)
#4 Point C
model1 = lm(Length ~ Group, data = dataoneway)
anova(model1)
#4 Point D
#Jawaban ada di README.md
#4 Point E
TukeyHSD(aov(model1))
#4 Point F
install.packages("ggplot2")
library("ggplot2")
ggplot(dataoneway, aes(x = Group, y = Length)) + geom_boxplot(fill = "grey80", colour = "black") + scale_x_discrete() + xlab("Treatment Group") + ylab("Length (cm)")
# NOMOR 5 #
#5 Point A
install.packages("multcompView")
library(readr)
library(ggplot2)
library(multcompView)
library(dplyr)
GTL <- read_csv("GTL.csv")
head(GTL)
str(GTL)
qplot(x = Temp, y = Light, geom = "point", data = GTL) + facet_grid(.~Glass, labeller = label_both)
#5 Point B
#pertama
GTL$Glass <- as.factor(GTL$Glass)
GTL$Temp_Factor <- as.factor(GTL$Temp)
str(GTL)
#kedua
anova <- aov(Light ~ Glass*Temp_Factor, data = GTL)
summary(anova)
#5 Point C
data_summary <- group_by(GTL, Glass, Temp) %>%
summarise(mean = mean(Light), sd = sd(Light)) %>%
arrange(desc(mean))
print(data_summary)
#5 Point D
tukey <- TukeyHSD(anova)
print(tukey)
#5 Point E
#pertama
tukey.cld <- multcompLetters4(anova, tukey)
print(tukey.cld)
#kedua
cld <- as.data.frame.list(tukey.cld$`Glass:Temp_Factor`)
data_summary$Tukey <- cld$Letters
print(data_summary)
# Alhamdulillah, Terimakasih, bismillah lulus :)