fsml_ttest_2sample Interface

public interface fsml_ttest_2sample

The 2-sample t-test determines if two population means and are the same. The procedure can handle 2-sample t-tests for equal variances and Welch's t-tests for unequal variances.

Hypotheses:

The null hypothesis and alternative hypothesis can be written as: : , and :

Procedure:

The procedure defaults to Welch's t-test for unequal variances if eq_var is not specified. In this case, the test statstic is calculated as follows: where and are the sample means and are the sample standard deviations, and and are the sample sizes. The degrees of freedom is approximated with the Welch–Satterthwaite equation:

If variances are assumed to be equal (eq_var = .true.), the procedure conducts a 2 sample t-test for equal variances, using the pooled standard deviation to calculate the t-statistic:

In case of assumed equal variances, the degrees of freedom is calculated as follows:

Calls

interface~~fsml_ttest_2sample~~CallsGraph interface~fsml_ttest_2sample fsml_ttest_2sample proc~s_tst_ttest_2s s_tst_ttest_2s interface~fsml_ttest_2sample->proc~s_tst_ttest_2s proc~s_err_print s_err_print proc~s_tst_ttest_2s->proc~s_err_print proc~s_tst_ttest_2s_core s_tst_ttest_2s_core proc~s_tst_ttest_2s->proc~s_tst_ttest_2s_core proc~f_utl_r2c f_utl_r2c proc~s_err_print->proc~f_utl_r2c proc~f_dst_t_cdf_core f_dst_t_cdf_core proc~s_tst_ttest_2s_core->proc~f_dst_t_cdf_core proc~f_sts_mean_core f_sts_mean_core proc~s_tst_ttest_2s_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

Module Procedures

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

Impure wrapper procedure for s_tst_ttest_2s_core.

Arguments

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

x1 vector (samples)

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

x2 vector (samples)

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

logical, intent(in), optional :: eq_var

true if equal variances assumed

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

option: two (default), le, ge