weighted.jonckheere.test: Weighted Jonckheere Terpstra testing

Description Usage Arguments Details Value Author(s) Examples

Description

A permutation based non-parametric trend testing

Usage

1
weighted.jonckheere.test(x, g, wt, id = factor(x), B=1e4, normalize.wts = FALSE, alternative = c("two.sided", "increasing", "decreasing"), grouping = c("none","by.groups","by.values"))

Arguments

x

a numeric vector containing values

g

an ordered factor or integer vector containing the groups

wt

a numeric vector the probability weight for data point

id

a factor that associates individuals to data points (see details)

B

the number of permutations

normalize.wts

whether the weights should be normalized to 1.0 for data points associated with single ids

alternative

whether the trend is increasing, decreasing or changing into any direction

grouping

determines the way how permutation takes id into account (see details)

Details

The null hypothesis of a equality between the groups g concerning the values x is tested.

The permutation test implented here is based upon the regular Jonckheere Terpstra test, but incorporates weights wt and the possiblity group data points by individuals id. When data points are grouped by individuals, either the x values (grouping == "by.groups") or the groups (by.values) are randomized by the permutation process. if grouping == "none" is selected, the permutation test will randomize both. In all cases, the weights (wt) remain unrandomized.

The weighted Jonckheere Terpstra statistic JT is calculated for n data points

JT = ∑_{i=1}^n ∑{j=1}^n w_i w_j U_{ij}

with i ≤q n and j ≤q n and i, j, n \in \mathcal{N}, weights w, values x and groups g.

U_{ij} = \begin{cases} 1 \mbox{if } g_i < g_j \mbox{and} x_i < x_j \\ 0.5 \mbox{if } g_i < g_j \mbox{and} x_i = x_j \end{cases}

In case of all weights identical to 1, this statistic is equal to the classical JT statistic.

The plot method for this function provides an easy overview of the permutation samples.

Value

An object of class weighted_jt_statistic, basically a list including elements

statistic

the reference Jonckheere Terpstra statistic

permutations

a vector of Jonckheere Terpstra statistics of permutations

alternative

the test setting - as determined by input parameters

mean.permutation

the mean of Jonckheere Terpstra statistics of permutations

std.permutation

the standard deviation of Jonckheere Terpstra statistics of permutations

n.permutations

the number of permutations - as determined by input parameters

est.p.value

the p value determined from a normal distribution approximated from permutations

exact.p.value

the p value determined from the permutated samples

Author(s)

Andreas Recke

Examples

1
2
3
4
5
6
  # load a single data set
  data(mrna)
  wttest <- with(mrna, weighted.jonckheere.test(x=mRNA.levels, g=gene.copies, id=id, wt = weights, B=1e4, alternative = "two.sided", grouping = "by.groups"))
  summary(wttest)
  # and plot
  plot(wttest)

wtJonckheere documentation built on May 2, 2019, 5:25 p.m.