hettmansperger_norton_test: Hettmansperger-Norton Trend Test for k-Samples

Description Usage Arguments Value References Examples

View source: R/S3method.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
11
12
13
14
15
16
17
18
19
20
21
22
23
hettmansperger_norton_test(x, ...)

## S3 method for class 'numeric'
hettmansperger_norton_test(
  x,
  y,
  na.rm = FALSE,
  alternative = c("decreasing", "increasing", "custom"),
  trend = NULL,
  pseudoranks = TRUE,
  ...
)

## S3 method for class 'formula'
hettmansperger_norton_test(
  formula,
  data,
  na.rm = FALSE,
  alternative = c("decreasing", "increasing", "custom"),
  trend = NULL,
  pseudoranks = TRUE,
  ...
)

Arguments

x

vector containing the observations

...

further arguments are ignored

y

vector specifiying the group to which the observations from the x vector belong to

na.rm

a logical value indicating if NA values should be removed

alternative

either decreasing (trend k, k-1, ..., 1) or increasing (1, 2, ..., k) or custom (then argument trend must be specified)

trend

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

pseudoranks

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

formula

formula object

data

data.frame containing the variables in the formula (observations and group)

Value

Returns an object.

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.

Happ M, Zimmermann G, Brunner E, Bathke AC (2020). Pseudo-Ranks: How to Calculate Them Efficiently in R. Journal of Statistical Software, Code Snippets, *95*(1), 1-22. doi: 10.18637/jss.v095.c01 (URL:https://doi.org/10.18637/jss.v095.c01).

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.