One Sample t-test
data: my_data$weight
t = -9.0783, df = 9, p-value = 7.953e-06
alternative hypothesis: true mean is not equal to 25
95 percent confidence interval:
17.8172 20.6828
sample estimates:
mean of x
19.25
Shapiro-Wilk normality test
data: weight[group == "Woman"]
W = 0.94266, p-value = 0.6101
res.ftest <-var.test(weight ~ group, data = my_data)res.ftest
F test to compare two variances
data: weight by group
F = 0.36134, num df = 8, denom df = 8, p-value = 0.1714
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
0.08150656 1.60191315
sample estimates:
ratio of variances
0.3613398
res <-t.test(women_weight, men_weight, var.equal =TRUE)res
Two Sample t-test
data: women_weight and men_weight
t = -2.7842, df = 16, p-value = 0.01327
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-29.748019 -4.029759
sample estimates:
mean of x mean of y
52.10000 68.98889
res <-t.test(weight ~ group, data = my_data, var.equal =TRUE)res
Two Sample t-test
data: weight by group
t = 2.7842, df = 16, p-value = 0.01327
alternative hypothesis: true difference in means between group Man and group Woman is not equal to 0
95 percent confidence interval:
4.029759 29.748019
sample estimates:
mean in group Man mean in group Woman
68.98889 52.10000
t.test(weight ~ group, data = my_data,var.equal =TRUE, alternative ="less")
Two Sample t-test
data: weight by group
t = 2.7842, df = 16, p-value = 0.9934
alternative hypothesis: true difference in means between group Man and group Woman is less than 0
95 percent confidence interval:
-Inf 27.47924
sample estimates:
mean in group Man mean in group Woman
68.98889 52.10000
res$p.value
[1] 0.0132656
res$estimate
mean in group Man mean in group Woman
68.98889 52.10000
# A tibble: 2 × 4
group count mean sd
<chr> <int> <dbl> <dbl>
1 Man 9 69.0 9.38
2 Woman 9 52.1 15.6
library("ggpubr")ggboxplot(my_data, x ="group", y ="weight", color ="group", palette =c("#00AFBB", "#E7B800"),ylab ="Weight", xlab ="Groups")
res <-wilcox.test(women_weight, men_weight)
Warning in wilcox.test.default(women_weight, men_weight): cannot compute exact
p-value with ties
res
Wilcoxon rank sum test with continuity correction
data: women_weight and men_weight
W = 15, p-value = 0.02712
alternative hypothesis: true location shift is not equal to 0
res <-wilcox.test(weight ~ group, data = my_data,exact =FALSE)res
Wilcoxon rank sum test with continuity correction
data: weight by group
W = 66, p-value = 0.02712
alternative hypothesis: true location shift is not equal to 0