s_tst_signedrank_2s_core Subroutine

private pure subroutine s_tst_signedrank_2s_core(x1, x2, w, p, h1)

The Wilcoxon signed rank test.

Arguments

Type IntentOptional 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"


Calls

proc~~s_tst_signedrank_2s_core~~CallsGraph proc~s_tst_signedrank_2s_core s_tst_signedrank_2s_core proc~s_tst_signedrank_1s_core s_tst_signedrank_1s_core proc~s_tst_signedrank_2s_core->proc~s_tst_signedrank_1s_core proc~f_dst_norm_cdf_core f_dst_norm_cdf_core proc~s_tst_signedrank_1s_core->proc~f_dst_norm_cdf_core proc~s_utl_rank s_utl_rank proc~s_tst_signedrank_1s_core->proc~s_utl_rank

Called by

proc~~s_tst_signedrank_2s_core~~CalledByGraph proc~s_tst_signedrank_2s_core s_tst_signedrank_2s_core proc~s_tst_signedrank_2s s_tst_signedrank_2s proc~s_tst_signedrank_2s->proc~s_tst_signedrank_2s_core interface~fsml_signedrank_paired fsml_signedrank_paired interface~fsml_signedrank_paired->proc~s_tst_signedrank_2s

Source Code

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