s_tst_signedrank_1s Subroutine

public impure subroutine s_tst_signedrank_1s(x, mu0, w, p, h1)

Impure wrapper procedure for s_tst_signedrank_1s_core.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x(:)

x vector (samples)

real(kind=wp), intent(in) :: mu0

population mean (null hypothesis expected value)

real(kind=wp), intent(out) :: w

W statistic (sum of signed ranks)

real(kind=wp), intent(out) :: p

p-value

character(len=*), intent(in), optional :: h1

: "two" (default), "lt", "gt"


Calls

proc~~s_tst_signedrank_1s~~CallsGraph proc~s_tst_signedrank_1s s_tst_signedrank_1s proc~s_err_print s_err_print proc~s_tst_signedrank_1s->proc~s_err_print proc~s_tst_signedrank_1s_core s_tst_signedrank_1s_core proc~s_tst_signedrank_1s->proc~s_tst_signedrank_1s_core proc~f_utl_r2c f_utl_r2c proc~s_err_print->proc~f_utl_r2c 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_1s~~CalledByGraph proc~s_tst_signedrank_1s s_tst_signedrank_1s interface~fsml_signedrank_1sample fsml_signedrank_1sample interface~fsml_signedrank_1sample->proc~s_tst_signedrank_1s

Source Code

impure subroutine s_tst_signedrank_1s(x, mu0, w, p, h1)

! ==== Description
!! Impure wrapper procedure for `s_tst_signedrank_1s_core`.

! ==== Declarations
  real(wp)         , intent(in)           :: x(:) !! x vector (samples)
  real(wp)         , intent(in)           :: mu0  !! population mean (null hypothesis expected value)
  character(len=*) , intent(in), optional :: 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
  character(len=16)                       :: h1_w !! final value for h1

! ==== Instructions

! ---- handle input

  ! assume two-sided, overwrite if option is passed
  h1_w = "two"
  if (present(h1)) h1_w = h1

  ! check if h1 (tail) options are valid
  if (h1_w .ne. "lt" .and. h1_w .ne. "gt" .and. h1_w .ne. "two") then
     ! write error message and assign sentinel value if invalid
     call s_err_print(fsml_error(2))
     w  = c_sentinel_r
     p  = c_sentinel_r
     return
  endif

  ! check if size is valid
  if (size(x) .le. 1) then
     ! write error message and assign sentinel value if invalid
     call s_err_print(fsml_error(4))
     w  = c_sentinel_r
     p  = c_sentinel_r
     return
  endif

! ---- conduct test

  ! call pure procedure
  call s_tst_signedrank_1s_core(x, mu0, w, p, h1_w)

end subroutine s_tst_signedrank_1s