Skip to main content
added 92 characters in body
Source Link
BruceET
  • 57.6k
  • 2
  • 36
  • 94
head(cbind(before, after, increase, diff))

      before after increase diff
[1,]    192   195        3    3
[2,]    230   236        6    6
[3,]    202   197       -5   -5
[4,]    153   151       -2   -2
[5,]    239   249       10   10
[6,]    178   179        1    1

We show a stripchart (dotplot) of diff. Over 3/4, but not all, of the subjects show positive differences. [It would make no sense to show[For our purposes, individual graphs of before and after, which are not useful; they would not show pairing and so might be misleading.]

head(cbind(before, after, increase, diff))

      before after increase diff
[1,]    192   195        3    3
[2,]    230   236        6    6
[3,]    202   197       -5   -5
[4,]    153   151       -2   -2
[5,]    239   249       10   10
[6,]    178   179        1    1

We show a stripchart (dotplot) of diff. Over 3/4, but not all, of the subjects show positive differences. [It would make no sense to show individual graphs of before and after, which would not show pairing and so might be misleading.]

head(cbind(before, after, diff))

      before after diff
[1,]    192   195     3
[2,]    230   236     6
[3,]    202   197    -5
[4,]    153   151    -2
[5,]    239   249    10
[6,]    178   179     1

We show a stripchart (dotplot) of diff. Over 3/4, but not all, of the subjects show positive differences. [For our purposes, individual graphs of before and after are not useful; they would not show pairing and so might be misleading.]

added 92 characters in body
Source Link
BruceET
  • 57.6k
  • 2
  • 36
  • 94

In the case of actual experimental data, you would see before and after as you look at test scores, and increase would be available only on upon taking differences. [Please ignore the variable increase used only for simulation; it is the same as diff/]

In the case of actual experimental data, you would see before and after as you look at test scores, and increase would be available only on upon taking differences.

In the case of actual experimental data, you would see before and after as you look at test scores, and increase would be available only on upon taking differences. [Please ignore the variable increase used only for simulation; it is the same as diff/]

added 1121 characters in body
Source Link
BruceET
  • 57.6k
  • 2
  • 36
  • 94

Note on nonparametric tests: If data are not normal, you may choose to use a Wicoxon signed-rank test to judge whether differences are mostly positive. Equivalently, you might do a paired test on After and Before.

wilcox.test(diff)

        Wilcoxon signed rank test 
        with continuity correction

data:  diff
V = 4069, p-value = 3.052e-11
alternative hypothesis: true location is not equal to 0

wilcox.test(after, before, pair=T)

        Wilcoxon signed rank test 
        with continuity correction

data:  after and before
V = 4069, p-value = 3.052e-11
alternative hypothesis: 
  true location shift is not equal to 0

However, it would be incorrect to do a two-sample Mann-Whitney-Wilcoxon rank sum test as if Before and After were two independent samples.

wilcox.test(after, before)

        Wilcoxon rank sum test 
        with continuity correction

data:  after and before
W = 5602, p-value = 0.1416
alternative hypothesis: 
  true location shift is not equal to 0

Note on nonparametric tests: If data are not normal, you may choose to use a Wicoxon signed-rank test to judge whether differences are mostly positive. Equivalently, you might do a paired test on After and Before.

wilcox.test(diff)

        Wilcoxon signed rank test 
        with continuity correction

data:  diff
V = 4069, p-value = 3.052e-11
alternative hypothesis: true location is not equal to 0

wilcox.test(after, before, pair=T)

        Wilcoxon signed rank test 
        with continuity correction

data:  after and before
V = 4069, p-value = 3.052e-11
alternative hypothesis: 
  true location shift is not equal to 0

However, it would be incorrect to do a two-sample Mann-Whitney-Wilcoxon rank sum test as if Before and After were two independent samples.

wilcox.test(after, before)

        Wilcoxon rank sum test 
        with continuity correction

data:  after and before
W = 5602, p-value = 0.1416
alternative hypothesis: 
  true location shift is not equal to 0
added 741 characters in body
Source Link
BruceET
  • 57.6k
  • 2
  • 36
  • 94
Loading
Source Link
BruceET
  • 57.6k
  • 2
  • 36
  • 94
Loading