The Wilcoxon signed rank test.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | x1(:) |
sample 1 (paired data) |
||
real(kind=wp), | intent(in) | :: | x2(:) |
sample 2 (paired data) |
||
real(kind=wp), | intent(out) | :: | w |
W statistic (sum of signed ranks) |
||
real(kind=wp), | intent(out) | :: | p |
p-value |
||
character(len=*), | intent(in) | :: | h1 |
: "two" (default), "lt", "gt" |
pure subroutine s_tst_signedrank_2s_core(x1, x2, w, p, h1) ! ==== Description !! The Wilcoxon signed rank test. ! ==== Declarations real(wp) , intent(in) :: x1(:) !! sample 1 (paired data) real(wp) , intent(in) :: x2(:) !! sample 2 (paired data) character(len=*), intent(in) :: h1 !! \( H_{1} \): "two" (default), "lt", "gt" real(wp) , intent(out) :: w !! W statistic (sum of signed ranks) real(wp) , intent(out) :: p !! p-value real(wp) , allocatable :: d(:) !! differences ! ==== Instructions ! get dims and allocate allocate(d( size(x1) )) ! compute differences and absolute values d = x1 - x2 ! use 1-sample signed-rank test with mu0 = 0 call s_tst_signedrank_1s_core(d, 0.0_wp, w, p, h1) ! deallocate deallocate(d) end subroutine s_tst_signedrank_2s_core