Learn R Programming

pseudorank (version 1.0.4)

hettmansperger_norton_test_internal: Hettmansperger-Norton Trend Test for k-Samples

Description

This function calculates the Hettmansperger-Norton trend test using pseudo-ranks under the null hypothesis H0F: F_1 = ... F_k.

Usage

hettmansperger_norton_test_internal(
  data,
  group,
  na.rm,
  alternative = c("decreasing", "increasing", "custom"),
  formula = NULL,
  trend = NULL,
  pseudoranks = TRUE,
  ...
)

Value

Returns a data.frame with the results

Arguments

data

numeric vector containing the data

group

ordered factor vector for the groups

na.rm

a logical value indicating if NA values should be removed

alternative

either decreasing or increasing

formula

formula object

trend

custom numeric vector indicating the trend for the custom alternative, only used if alternative = "custom"

...

further arguments are ignored

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

Run this code
# create some data, please note that the group factor needs to be ordered
df <- data.frame(data = c(rnorm(40, 3, 1), rnorm(40, 2, 1), rnorm(20, 1, 1)),
  group = c(rep(1,40),rep(2,40),rep(3,20)))
df$group <- factor(df$group, ordered = TRUE)

# you can either test for a decreasing, increasing or custom trend
hettmansperger_norton_test(df$data, df$group, alternative="decreasing")
hettmansperger_norton_test(df$data, df$group, alternative="increasing")
hettmansperger_norton_test(df$data, df$group, alternative="custom", trend = c(1, 3, 2))

Run the code above in your browser using DataLab