zikw: Modified Kruskal Wallis test (ZIKW) for zero-inflated data

Description Usage Arguments Value References Examples

View source: R/zi_kw_test.R

Description

Modified Kruskal Wallis test (ZIKW) for zero-inflated data

Usage

1
zikw(x, group, perm = FALSE, perm.n = 10000)

Arguments

x

a numeric vector of data values with groups defined by the group parameter, or a list of numeric data vectors with each vector in the list as one group.

group

a vector giving the groups for the corresponding elements of x. Ignored if x is a list.

perm

use permutations to calculate the pvalue

perm.n

number of permutations used for pvalue calculation

Value

modified Kruskal Wallis test statistic and pvalue

References

Wanjie Wang, Eric Z. Chen and Hongzhe Li (2015). Rank-based tests for compositional distributions with a clump of zeros. Submitted.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## x is a list
x <- list(group1 = c(rep(0,5),rlnorm(20, meanlog = 0, sdlog = 1)),
     group2=c(rep(0,10),rlnorm(20, meanlog = 1, sdlog = 1)),
     group3=c(rep(0,15),rlnorm(20, meanlog = 2, sdlog = 1)))
zikw(x, perm = FALSE)
## x is a vector
x <- c(c(rep(0,5),rlnorm(20, meanlog = 0, sdlog = 1)),
    c(rep(0,10),rlnorm(20, meanlog = 1, sdlog = 1)),
    c(rep(0,15),rlnorm(20, meanlog = 2, sdlog = 1)))
group <- c(rep('group1',25),rep('group2',30),rep('group3',35))
zikw(x, group, perm = FALSE)
## use permutations to calculate the pvalue
## Not run: zikw(x, group, perm = TRUE)

chvlyl/ZIR documentation built on Oct. 14, 2021, 12:50 a.m.