s_tst_ttest_paired Subroutine

public impure subroutine s_tst_ttest_paired(x1, x2, t, df, p, h1)

Impure wrapper procedure for s_tst_ttest_paired_core.

Arguments

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

x1 vector (samples)

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

x2 vector (samples); must be same length as x1

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

test statistic

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

degrees of freedom

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

p-value

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

option: two (default), le, ge


Calls

proc~~s_tst_ttest_paired~~CallsGraph proc~s_tst_ttest_paired s_tst_ttest_paired proc~s_err_print s_err_print proc~s_tst_ttest_paired->proc~s_err_print proc~s_tst_ttest_paired_core s_tst_ttest_paired_core proc~s_tst_ttest_paired->proc~s_tst_ttest_paired_core proc~f_utl_r2c f_utl_r2c proc~s_err_print->proc~f_utl_r2c proc~s_tst_ttest_1s_core s_tst_ttest_1s_core proc~s_tst_ttest_paired_core->proc~s_tst_ttest_1s_core proc~f_dst_t_cdf_core f_dst_t_cdf_core proc~s_tst_ttest_1s_core->proc~f_dst_t_cdf_core proc~f_sts_mean_core f_sts_mean_core proc~s_tst_ttest_1s_core->proc~f_sts_mean_core proc~f_dst_betai_core f_dst_betai_core proc~f_dst_t_cdf_core->proc~f_dst_betai_core

Called by

proc~~s_tst_ttest_paired~~CalledByGraph proc~s_tst_ttest_paired s_tst_ttest_paired interface~fsml_ttest_paired fsml_ttest_paired interface~fsml_ttest_paired->proc~s_tst_ttest_paired

Source Code

impure subroutine s_tst_ttest_paired(x1, x2, t, df, p, h1)

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

! ==== Declarations
  real(wp)         , intent(in)           :: x1(:) !! x1 vector (samples)
  real(wp)         , intent(in)           :: x2(:) !! x2 vector (samples); must be same length as x1
  character(len=*) , intent(in), optional :: h1    !! \( H_{1} \) option: two (default), le, ge
  real(wp)         , intent(out)          :: t     !! test statistic
  real(wp)         , intent(out)          :: df    !! degrees of freedom
  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))
     t  = c_sentinel_r
     df = c_sentinel_r
     p  = c_sentinel_r
     return
  endif

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

  ! check if x1 and x2 have same size
  if (size(x1) .ne. size(x2)) then
     ! write error message and assign sentinel value if invalid
     call s_err_print(fsml_error(4))
     t  = c_sentinel_r
     df = c_sentinel_r
     p  = c_sentinel_r
     return
  endif

! ---- conduct test

  ! call pure procedure
  call s_tst_ttest_paired_core(x1, x2, t, df, p, h1_w)

end subroutine s_tst_ttest_paired