fsml_kruskalwallis Interface

public interface fsml_kruskalwallis

The Kruskal-Wallis H-test is used to determine whether samples originate from the same distribution without assuming normality. It is therefore considered a nonparametric alternative to the one-way ANOVA (Analysis of Variance).

Hypotheses:

The null hypothesis and alternative hypothesis are defined as: : The populations have the same distribution (medians are equal), and : At least one population differs from the others.

Procedure:

The data is passed to the procedure as a rank-2 array x, where each column is a group of observations. All values are ranked across the entire dataset, with tied values assigned the average rank.

The Kruskal-Wallis H-statistic (h) is computed as: where: - is the total number of observations, - is the number of groups, - is the number of observations in group , and - is the sum of ranks in group .

The degrees of freedom are: and returned as df.

The p-value (p) is computed from the chi-squared distribution:

It is computed using the elemental procedure f_dst_chi2_cdf_core.

The Kruskal-Wallis test assumes that: a) all groups are independent, b) the response variable is ordinal or continuous, c) the group distributions have the same shape, and d) observations are independent both within and between groups.

Calls

interface~~fsml_kruskalwallis~~CallsGraph interface~fsml_kruskalwallis fsml_kruskalwallis proc~s_tst_kruskalwallis s_tst_kruskalwallis interface~fsml_kruskalwallis->proc~s_tst_kruskalwallis proc~s_err_print s_err_print proc~s_tst_kruskalwallis->proc~s_err_print proc~s_tst_kruskalwallis_core s_tst_kruskalwallis_core proc~s_tst_kruskalwallis->proc~s_tst_kruskalwallis_core proc~f_utl_r2c f_utl_r2c proc~s_err_print->proc~f_utl_r2c proc~f_dst_chi2_cdf_core f_dst_chi2_cdf_core proc~s_tst_kruskalwallis_core->proc~f_dst_chi2_cdf_core proc~s_utl_rank s_utl_rank proc~s_tst_kruskalwallis_core->proc~s_utl_rank proc~f_dst_gammai_core f_dst_gammai_core proc~f_dst_chi2_cdf_core->proc~f_dst_gammai_core

Module Procedures

public impure subroutine s_tst_kruskalwallis(x, h, df, p)

Impure wrapper procedure for s_tst_kruskalwallis_core.

Arguments

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

2D array, each column is a group

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

Kruskal-Wallis H-statistic

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

degrees of freedom (k - 1)

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

p-value from chi-squared distribution