kruskal_wallis_internal: Hettmansperger-Norton Trend Test for k-Samples

Description Usage Arguments Value References Examples

View source: R/kruskal_wallis.R

Description

This function calculates the Kruskal-Wallis test using pseudo-ranks under the null hypothesis H0F: F_1 = ... F_k.

Usage

1
2
3
4
5
6
7
8
kruskal_wallis_internal(
  data,
  group,
  na.rm,
  formula = NULL,
  pseudoranks = TRUE,
  ...
)

Arguments

data

numeric vector containing the data

group

factor specifying the groups

na.rm

a logical value indicating if NA values should be removed

formula

formula object

pseudoranks

logical value indicating if pseudo-ranks or ranks should be used

...

further arguments are ignored

Value

Returns a data.frame with the results

References

Brunner, E., Bathke, A.C., and Konietschke, F. (2018a). Rank- and Pseudo-Rank Procedures for Independent Observations in Factorial Designs - Using R and SAS. Springer Series in Statistics, Springer, Heidelberg. ISBN: 978-3-030-02912-8.

Hettmansperger, T. P., & Norton, R. M. (1987). Tests for patterned alternatives in k-sample problems. Journal of the American Statistical Association, 82(397), 292-299

Examples

1
2
3
4
5
x = c(1, 1, 1, 1, 2, 3, 4, 5, 6)
grp = as.factor(c('A','A','B','B','B','D','D','D','D'))

# calculate Kruskal-Wallis test using pseudo-ranks
kruskal_wallis_test(x, grp, na.rm = FALSE, pseudoranks = TRUE)

Example output

Kruskal-Wallis Test
 
Test Statistic:  6.736842 
Distribution of Statistic:  Chisq 
Degrees of Freedom:  2 
unweighted relative Effects / Pseudo-ranks:  TRUE
p-Value:  0.03444398 

pseudorank documentation built on Oct. 23, 2020, 7:15 p.m.