diff <- before - after
# Get number of positive signs
ncount <- sum(sign(diff[diff>0]))
# Signed test for the difference
binom.test(ncount, length(diff), 0.5)
##
## Exact binomial test
##
## data: ncount and length(diff)
## number of successes = 2, number of trials = 10, p-value = 0.1094
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
## 0.02521073 0.55609546
## sample estimates:
## probability of success
## 0.2
We are testing \(H_0: \mu_{Diff} = 0\) against \(H_1: \mu_{Diff} > 0\). Since the Signed rank test p-vale \(=0.1094\), we do not reject \(H_0\).