Martijn Wieling
University of Groningen
R
: wilcox.test()
t.test()
wilcox.test(diffEN$Diff, diffNL$Diff, alternative = "greater") # 1st > 2nd?
#
# Wilcoxon rank sum exact test
#
# data: diffEN$Diff and diffNL$Diff
# W = 315, p-value = 0.0025
# alternative hypothesis: true location shift is greater than 0
library(effsize)
cliff.delta(diffEN$Diff, diffNL$Diff)
#
# Cliff's Delta
#
# delta estimate: 0.50718 (large)
# 95 percent confidence interval:
# lower upper
# 0.13076 0.75579
english_score | diff | abs_diff | rank | signed_rank |
---|---|---|---|---|
7.33 | -0.17 | 0.17 | 1 | -1 |
8.32 | 0.82 | 0.82 | 4 | 4 |
6.24 | -1.26 | 1.26 | 5 | -5 |
5.19 | -2.31 | 2.31 | 6 | -6 |
6.82 | -0.68 | 0.68 | 2 | -2 |
8.21 | 0.71 | 0.71 | 3 | 3 |
R
: wilcox.test()
(same as for Mann-Whitney U)wilcox.test(dat$english_score, alternative = "two.sided", mu = 7.5)
#
# Wilcoxon signed rank test with continuity correction
#
# data: dat$english_score
# V = 73215, p-value = 0.0011
# alternative hypothesis: true location is not equal to 7.5
pval <- wilcox.test(dat$english_score, alternative = "two.sided", mu = 7.5)$p.value
zval <- qnorm(pval/2, lower.tail = FALSE) # pval/2 because of two-tailed test
n <- nrow(dat)
(effectsize <- zval/sqrt(n))
# [1] 0.14651
levels(datNL$Sound) # shows which level is first, and which is second
# [1] "T" "TH"
# formula interface with alternative='less': first level < second level?
wilcox.test(Frontness ~ Sound, data = datNL, paired = TRUE, alternative = "less")
#
# Wilcoxon signed rank exact test
#
# data: Frontness by Sound
# V = 57, p-value = 0.067
# alternative hypothesis: true location shift is less than 0
cliff.delta(Frontness ~ Sound, data = datNL) # effect size for Wilcoxon test
#
# Cliff's Delta
#
# delta estimate: -0.22438 (small)
# 95 percent confidence interval:
# lower upper
# -0.54654 0.15563
+
(higher), -
(lower) and 0
(no change: ignored)+
to proportions -
+
(or -
) (about same number of +
’s as -
’s)+
(and/or -
)+
’s and -
’s does)subject | pos. /$\theta$/ | pos. /t/ | pos /$\theta$/ - /t/ | sign |
---|---|---|---|---|
1 | 0.738 | 0.781 | -0.043 | - |
2 | 0.767 | 0.766 | 0.001 | + |
3 | 0.879 | 0.884 | -0.005 | - |
4 | 0.761 | 0.748 | 0.013 | + |
5 | 0.774 | 0.748 | 0.027 | + |
6 | 0.749 | 0.752 | -0.003 | - |
… | … | … | … |
binom.test(x = 12, n = 19, p = 0.5, alternative = "greater")
#
# Exact binomial test
#
# data: 12 and 19
# number of successes = 12, number of trials = 19, p-value = 0.18
# alternative hypothesis: true probability of success is greater than 0.5
# 95 percent confidence interval:
# 0.41806 1.00000
# sample estimates:
# probability of success
# 0.63158
shapiro.test(spanish[spanish$Group == "LargeCity", ]$Score)
#
# Shapiro-Wilk normality test
#
# data: spanish[spanish$Group == "LargeCity", ]$Score
# W = 0.92, p-value = 0.35
We suspected that the Spanish language proficiency of social workers in larger cities was different from that of social workers from smaller cities and towns (simply due to their different exposure to the language). We wished to test this since training programs may differ depending on proficiency levels. Our \(H_0: \mu_l = \mu_{s}\) and our \(H_a: \mu_l \neq \mu_{s}\). We obtained data from twenty randomly selected social workers, ten from each group, verified that the samples were roughly normally distributed, and tested whether the groups differed in means (see Figure 1 for the box plots), obtaining \(t(18)= 0.98, p = 0.34\). The more urban group scored 28.4 and was 0.44 sd better than the other group with score 26.2 (Cohen’s \(d\): medium effect). We retained the null hypothesis that the groups do not differ, as the \(p\)-value was higher than the \(\alpha\)-value (significance threshold) of 0.05.
Thank you for your attention!