hettmansperger_norton_test_internal: Hettmansperger-Norton Trend Test for k-Samples

Description Usage Arguments Value References Examples

View source: R/hettmansperger.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
hettmansperger_norton_test_internal(
  data,
  group,
  na.rm,
  alternative = c("decreasing", "increasing", "custom"),
  formula = NULL,
  trend = NULL,
  pseudoranks = TRUE,
  ...
)

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

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
6
7
8
9
# 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))

Example output

Hettmansperger-Norton Trend Test
 
Alternative:  decreasing 
Test Statistic:  6.994803 
Distribution of Statistic:  Standard-Normal 
unweighted relative Effects / Pseudo-ranks:  TRUE
p-Value:  1.32816e-12 
Hettmansperger-Norton Trend Test
 
Alternative:  increasing 
Test Statistic:  -6.994803 
Distribution of Statistic:  Standard-Normal 
unweighted relative Effects / Pseudo-ranks:  TRUE
p-Value:  1 
Hettmansperger-Norton Trend Test
 
Alternative:  custom 
Trend:  1 3 2 
Test Statistic:  -3.786608 
Distribution of Statistic:  Standard-Normal 
unweighted relative Effects / Pseudo-ranks:  TRUE
p-Value:  0.9999236 

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