Z.value: Calculate a Z score from a Wilcoxon statistic and a set of...

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/Z.value.R

Description

The mean of a Wilcoxon statistic is unaffected by correlation within the variable under test, but its variance is. This function uses a set of Wilcoxon statistics generated from permuted data to estimate the variance empirically, and thus calculate a Z score.

Usage

1
  Z.value(W, Wstar, n.in, n.out)

Arguments

W

Wilcoxon statistic for observed data.

Wstar

A vector of Wilcoxon statistics for a set of permuted data.

n.in

The number of items (SNPs) in the regions to be tested.

n.out

The number of items (SNPs) in the control regions.

Value

A list with two elements:

Z.theoretical

which uses the theoretical mean of the Wilcoxon distribution under the null generated from n.in, n.out above

Z.empirical

which uses Wstar to calculate an empirical estimate of the mean of the Wilcoxon distribution under the null

Note

The function can also deal with combining W statistics from multiple strata, as is typical in a meta analysis of GWAS data, using van Elteren's method. Strata may be defined by different geography or different SNP chips.

Author(s)

Chris Wallace

See Also

wilcoxon

Examples

1
2
3
4
5
6
7
8
x <- exp(-rexp(1000)) # uniform
y <- exp(-rexp(1000,0.8)) # skewed towards 0
W <- wilcoxon(p=c(x,y),snps.in=1:1000)

p.perm <- matrix(sample(c(x,y),replace=TRUE,size=10000),ncol=5)
Wstar <- wilcoxon(p=p.perm,snps.in=1:1000)

Z.value(W=W, Wstar=Wstar, n.in=1000, n.out=1000)

Example output

Loading required package: snpStats
Loading required package: survival
Loading required package: Matrix
$Z.theoretical

	Wilcoxon theoretical mean

data:  W
Z = 3.1023, p-value = 0.00192


$Z.empirical

	Wilcoxon empirical mean

data:  W
Z = 3.2212, p-value = 0.001277

wgsea documentation built on May 29, 2017, 7:02 p.m.