data1 %>%
group_by(Group) %>%
dplyr::summarise(Count = length(Thickness), Mean = mean(Thickness), SD = sd(Thickness))
## # A tibble: 3 x 4
## Group Count Mean SD
## <chr> <int> <dbl> <dbl>
## 1 Control 5 0.150 0.0569
## 2 GroupA 5 0.104 0.0146
## 3 GroupB 5 0.162 0.0549
kruskal.test(Thickness~Group, data1)
##
## Kruskal-Wallis rank sum test
##
## data: Thickness by Group
## Kruskal-Wallis chi-squared = 6.02, df = 2, p-value = 0.04929
boxplot(Thickness~Group, data1)
dunn_test(data1, Thickness~Group, p.adjust.method = "none")
## # A tibble: 3 x 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 Thickness Control GroupA 5 5 -2.05 0.0403 0.0403 *
## 2 Thickness Control GroupB 5 5 0.141 0.888 0.888 ns
## 3 Thickness GroupA GroupB 5 5 2.19 0.0284 0.0284 *
boxplot(Thickness~Group, data1)
normality2(data1$Thickness, data1$Group, data1)
## T statistic of Raw Data: 3.540633
## T statistic of Rank Data: 5.61607
## Difference: 2.075437
##
## Decision: Assume that the variables are not normally distirubted and use Kruskal-Wallis Test
data1 %>%
group_by(Group) %>%
dplyr::summarise(Count = length(Solubility), Mean = mean(Solubility), SD = sd(Solubility))
## # A tibble: 3 x 4
## Group Count Mean SD
## <chr> <int> <dbl> <dbl>
## 1 Control 5 23.5 13.7
## 2 GroupA 5 33.5 12.0
## 3 GroupB 5 25.2 14.5
kruskal.test(Solubility~Group, data1)
##
## Kruskal-Wallis rank sum test
##
## data: Solubility by Group
## Kruskal-Wallis chi-squared = 1.5, df = 2, p-value = 0.4724
boxplot(Solubility~Group, data1)
boxplot(Solubility~Group, data1)
normality2(data1$Solubility, data1$Group, data1)
## T statistic of Raw Data: 0.8278986
## T statistic of Rank Data: 0.7006762
## Difference: 0.1272223
##
## Decision: Assume that the variables are normally distirubted and use ANOVA. Check the number of observations per group
data1 %>%
group_by(Group) %>%
dplyr::summarise(Count = length(WeighChangeSoySauce), Mean = mean(WeighChangeSoySauce), SD = sd(WeighChangeSoySauce))
## # A tibble: 3 x 4
## Group Count Mean SD
## <chr> <int> <dbl> <dbl>
## 1 Control 5 9.82 0.328
## 2 GroupA 5 9.78 1.41
## 3 GroupB 5 9.59 0.860
kruskal.test(WeighChangeSoySauce~Group, data1)
##
## Kruskal-Wallis rank sum test
##
## data: WeighChangeSoySauce by Group
## Kruskal-Wallis chi-squared = 0.78, df = 2, p-value = 0.6771
boxplot(WeighChangeSoySauce~Group, data1, ylab="Weight Change (Soy Sauce)")
data1 %>%
group_by(Group) %>%
dplyr::summarise(Count = length(WeightChangeVegOil), Mean = mean(WeightChangeVegOil), SD = sd(WeightChangeVegOil))
## # A tibble: 3 x 4
## Group Count Mean SD
## <chr> <int> <dbl> <dbl>
## 1 Control 5 24.7 28.6
## 2 GroupA 5 4.67 1.66
## 3 GroupB 5 8.47 3.59
kruskal.test(WeightChangeVegOil~Group, data1)
##
## Kruskal-Wallis rank sum test
##
## data: WeightChangeVegOil by Group
## Kruskal-Wallis chi-squared = 8.06, df = 2, p-value = 0.01777
boxplot(WeightChangeVegOil~Group, data1, ylab="Weight Change (Vegetable Oil)")
dunn_test(data1, WeightChangeVegOil~Group)
## # A tibble: 3 x 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 WeightChangeVegOil Control GroupA 5 5 -2.83 0.00468 0.0140 *
## 2 WeightChangeVegOil Control GroupB 5 5 -1.20 0.229 0.229 ns
## 3 WeightChangeVegOil GroupA GroupB 5 5 1.63 0.104 0.208 ns
data1 %>%
group_by(Group) %>%
dplyr::summarise(Count = length(WeightChangeVinegar), Mean = median(WeightChangeVinegar), SD = sd(WeightChangeVinegar))
## # A tibble: 3 x 4
## Group Count Mean SD
## <chr> <int> <dbl> <dbl>
## 1 Control 5 15.3 7.55
## 2 GroupA 5 16.9 3.63
## 3 GroupB 5 9.93 7.90
kruskal.test(WeightChangeVinegar~Group, data1)
##
## Kruskal-Wallis rank sum test
##
## data: WeightChangeVinegar by Group
## Kruskal-Wallis chi-squared = 1.58, df = 2, p-value = 0.4538
boxplot(WeightChangeVinegar~Group, data1, ylab="Weight Change (Vinegar)")
boxplot(WeighChangeSoySauce~Group, data1)
normality2(data1$WeighChangeSoySauce, data1$Group, data1)
## T statistic of Raw Data: 0.1312943
## T statistic of Rank Data: 0.2439794
## Difference: 0.1126851
##
## Decision: Assume that the variables are normally distirubted and use ANOVA. Check the number of observations per group
boxplot(WeightChangeVegOil~Group, data1)
normality2(data1$WeightChangeVegOil, data1$Group, data1)
## T statistic of Raw Data: 3.121098
## T statistic of Rank Data: 10.02031
## Difference: 6.899214
##
## Decision: Assume that the variables are not normally distirubted and use Kruskal-Wallis Test
boxplot(WeightChangeVinegar~Group, data1)
normality2(data1$WeightChangeVinegar, data1$Group, data1)
## T statistic of Raw Data: 1.681052
## T statistic of Rank Data: 0.8388575
## Difference: 0.8421948
##
## Decision: Assume that the variables are not normally distirubted and use Kruskal-Wallis Test
data1 %>%
group_by(Group) %>%
dplyr::summarise(Count = length(Tear), Mean = mean(Tear), SD = sd(Tear))
## # A tibble: 3 x 4
## Group Count Mean SD
## <chr> <int> <dbl> <dbl>
## 1 Control 5 626. 108.
## 2 GroupA 5 304. 61.1
## 3 GroupB 5 686 131.
kruskal.test(Tear~Group, data1)
##
## Kruskal-Wallis rank sum test
##
## data: Tear by Group
## Kruskal-Wallis chi-squared = 9.5, df = 2, p-value = 0.008652
boxplot(Tear~Group, data1)
dunn_test(data1, Tear~Group)
## # A tibble: 3 x 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 Tear Control GroupA 5 5 -2.47 0.0133 0.0267 *
## 2 Tear Control GroupB 5 5 0.354 0.724 0.724 ns
## 3 Tear GroupA GroupB 5 5 2.83 0.00468 0.0140 *
data1 %>%
group_by(Group) %>%
dplyr::summarise(Count = length(TensileStrength), Mean = mean(TensileStrength), SD = sd(TensileStrength))
## # A tibble: 3 x 4
## Group Count Mean SD
## <chr> <int> <dbl> <dbl>
## 1 Control 5 40.3 6.33
## 2 GroupA 5 28.0 10.4
## 3 GroupB 5 23.6 4.42
kruskal.test(TensileStrength~Group, data1)
##
## Kruskal-Wallis rank sum test
##
## data: TensileStrength by Group
## Kruskal-Wallis chi-squared = 6.32, df = 2, p-value = 0.04243
boxplot(TensileStrength~Group, data1)
dunn_test(data1, TensileStrength~Group)
## # A tibble: 3 x 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 TensileStrength Control GroupA 5 5 -1.84 0.0660 0.132 ns
## 2 TensileStrength Control GroupB 5 5 -2.40 0.0162 0.0486 *
## 3 TensileStrength GroupA GroupB 5 5 -0.566 0.572 0.572 ns
data1 %>%
group_by(Group) %>%
dplyr::summarise(Count = length(Elongation), Mean = mean(Elongation), SD = sd(Elongation))
## # A tibble: 3 x 4
## Group Count Mean SD
## <chr> <int> <dbl> <dbl>
## 1 Control 5 72.3 14.4
## 2 GroupA 5 14.5 12.1
## 3 GroupB 5 92.9 47.0
kruskal.test(Elongation~Group, data1)
##
## Kruskal-Wallis rank sum test
##
## data: Elongation by Group
## Kruskal-Wallis chi-squared = 9.517, df = 2, p-value = 0.008578
boxplot(Elongation~Group, data1)
dunn_test(data1, Elongation~Group)
## # A tibble: 3 x 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 Elongation Control GroupA 5 5 -2.48 0.0132 0.0265 *
## 2 Elongation Control GroupB 5 5 0.354 0.723 0.723 ns
## 3 Elongation GroupA GroupB 5 5 2.83 0.00464 0.0139 *
boxplot(Tear~Group, data1)
normality2(data1$Tear, data1$Group, data1)
## T statistic of Raw Data: 26.04025
## T statistic of Rank Data: 17.42153
## Difference: 8.618724
##
## Decision: Assume that the variables are not normally distirubted and use Kruskal-Wallis Test
boxplot(Elongation~Group, data1)
normality2(data1$Elongation, data1$Group, data1)
## T statistic of Raw Data: 24.6373
## T statistic of Rank Data: 19.76467
## Difference: 4.872633
##
## Decision: Assume that the variables are not normally distirubted and use Kruskal-Wallis Test
data1 %>%
group_by(Group) %>%
dplyr::summarise(Count = length(SoilDegradationWithRain), Mean = mean(SoilDegradationWithRain), SD = sd(SoilDegradationWithRain))
## # A tibble: 3 x 4
## Group Count Mean SD
## <chr> <int> <dbl> <dbl>
## 1 Control 5 95.0 1.86
## 2 GroupA 5 97.0 0.903
## 3 GroupB 5 97.8 0.928
kruskal.test(SoilDegradationWithRain~Group, data1)
##
## Kruskal-Wallis rank sum test
##
## data: SoilDegradationWithRain by Group
## Kruskal-Wallis chi-squared = 6.26, df = 2, p-value = 0.04372
boxplot(SoilDegradationWithRain~Group, data1, ylab="Soil Degradation (With Rain)")
dunn_test(data1, SoilDegradationWithRain~Group)
## # A tibble: 3 x 9
## .y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
## 1 SoilDegradatio~ Contr~ GroupA 5 5 1.56 0.120 0.240 ns
## 2 SoilDegradatio~ Contr~ GroupB 5 5 2.47 0.0133 0.0400 *
## 3 SoilDegradatio~ GroupA GroupB 5 5 0.919 0.358 0.358 ns
data1 %>%
group_by(Group) %>%
dplyr::summarise(Count = length(SoilDegradationWithoutRain), Mean = mean(SoilDegradationWithoutRain), SD = sd(SoilDegradationWithoutRain))
## # A tibble: 3 x 4
## Group Count Mean SD
## <chr> <int> <dbl> <dbl>
## 1 Control 5 45.9 9.06
## 2 GroupA 5 43.6 17.0
## 3 GroupB 5 44.0 9.55
kruskal.test(SoilDegradationWithoutRain~Group, data1)
##
## Kruskal-Wallis rank sum test
##
## data: SoilDegradationWithoutRain by Group
## Kruskal-Wallis chi-squared = 0.06, df = 2, p-value = 0.9704
boxplot(SoilDegradationWithoutRain~Group, data1, ylab="Soil Degradation (Without Rain)")
boxplot(SoilDegradationWithRain~Group, data1)
normality2(data1$SoilDegradationWithRain, data1$Group, data1)
## T statistic of Raw Data: 4.252441
## T statistic of Rank Data: 4.194018
## Difference: 0.05842228
##
## Decision: Assume that the variables are normally distirubted and use ANOVA. Check the number of observations per group
boxplot(SoilDegradationWithoutRain~Group, data1)
normality2(data1$SoilDegradationWithoutRain, data1$Group, data1)
## T statistic of Raw Data: 0.06104471
## T statistic of Rank Data: 0.01757975
## Difference: 0.04346496
##
## Decision: Assume that the variables are normally distirubted and use ANOVA. Check the number of observations per group
data2 %>%
group_by(Group, time) %>%
get_summary_stats(score, type="mean_sd")
## # A tibble: 39 x 6
## Group time variable n mean sd
## <chr> <chr> <chr> <dbl> <dbl> <dbl>
## 1 A t1 score 5 1 0
## 2 A t10 score 5 1.4 0.548
## 3 A t12 score 5 1.4 0.548
## 4 A t14 score 5 1.8 0.837
## 5 A t16 score 5 1.8 0.837
## 6 A t18 score 5 2.4 0.548
## 7 A t2 score 5 1.4 0.548
## 8 A t20 score 5 2.8 1.10
## 9 A t22 score 5 3 1
## 10 A t24 score 5 3.4 0.894
## # ... with 29 more rows
bxp <- ggboxplot(
data2, x = "time", y = "score",
color = "Group", palette = "jco"
)
bxp
res.aov <- anova_test(
data = data2, dv = score, wid = id,
within = time, between = Group, type=3
)
get_anova_table(res.aov)
## ANOVA Table (type III tests)
##
## Effect DFn DFd F p p<.05 ges
## 1 Group 2 12 6.092 1.50e-02 * 0.331
## 2 time 12 144 39.153 2.44e-39 * 0.626
## 3 Group:time 24 144 1.700 3.00e-02 * 0.127
one.way <- data2 %>%
group_by(time) %>%
anova_test(dv = score, wid = id, between = Group) %>%
get_anova_table() %>%
adjust_pvalue(method = "bonferroni")
## Coefficient covariances computed by hccm()
## Coefficient covariances computed by hccm()
## Coefficient covariances computed by hccm()
## Coefficient covariances computed by hccm()
## Coefficient covariances computed by hccm()
## Coefficient covariances computed by hccm()
## Coefficient covariances computed by hccm()
## Coefficient covariances computed by hccm()
## Coefficient covariances computed by hccm()
## Coefficient covariances computed by hccm()
## Coefficient covariances computed by hccm()
## Coefficient covariances computed by hccm()
## Coefficient covariances computed by hccm()
one.way
## # A tibble: 13 x 9
## time Effect DFn DFd F p `p<.05` ges p.adj
## * <chr> <chr> <dbl> <dbl> <dbl> <dbl> <chr> <dbl> <dbl>
## 1 t1 Group 2 12 1.2 0.335 "" 0.167 1
## 2 t10 Group 2 12 6.12 0.015 "*" 0.505 0.195
## 3 t12 Group 2 12 9.69 0.003 "*" 0.618 0.039
## 4 t14 Group 2 12 3.63 0.059 "" 0.377 0.767
## 5 t16 Group 2 12 4.16 0.042 "*" 0.409 0.546
## 6 t18 Group 2 12 3.11 0.082 "" 0.341 1
## 7 t2 Group 2 12 0.75 0.493 "" 0.111 1
## 8 t20 Group 2 12 1.87 0.197 "" 0.237 1
## 9 t22 Group 2 12 5.63 0.019 "*" 0.484 0.247
## 10 t24 Group 2 12 6.5 0.012 "*" 0.52 0.156
## 11 t4 Group 2 12 1.3 0.308 "" 0.178 1
## 12 t6 Group 2 12 1.3 0.308 "" 0.178 1
## 13 t8 Group 2 12 4.31 0.039 "*" 0.418 0.507
pwc <- data2 %>%
group_by(time) %>%
pairwise_t_test(score ~ Group, p.adjust.method = "bonferroni")
pwc
## # A tibble: 39 x 10
## time .y. group1 group2 n1 n2 p p.signif p.adj p.adj.signif
## * <chr> <chr> <chr> <chr> <int> <int> <dbl> <chr> <dbl> <chr>
## 1 t1 score A B 5 5 0.454 ns 1 ns
## 2 t1 score A Control 5 5 0.147 ns 0.442 ns
## 3 t1 score B Control 5 5 0.454 ns 1 ns
## 4 t10 score A B 5 5 0.00468 ** 0.014 *
## 5 t10 score A Control 5 5 0.0512 ns 0.154 ns
## 6 t10 score B Control 5 5 0.218 ns 0.655 ns
## 7 t12 score A B 5 5 0.00099 *** 0.00297 **
## 8 t12 score A Control 5 5 0.0138 * 0.0413 *
## 9 t12 score B Control 5 5 0.175 ns 0.525 ns
## 10 t14 score A B 5 5 0.0205 * 0.0616 ns
## # ... with 29 more rows