combineGroupedPValues {metapod} | R Documentation

## Combine grouped p-values

### Description

Combine p-values from grouped hypothesis tests using a variety of meta-analysis methods. Each group of p-values is defined as those assigned to the same level of the grouping factor.

### Usage

    combineGroupedPValues(
      p.values,
      grouping,
      method = c("simes", "holm-min", "berger", "fisher", "pearson", "wilkinson",
        "stouffer"),
      weights = NULL,
      log.p = FALSE,
      min.n = 1,
      min.prop = 0.5
    )

### Arguments

`p.values` | A numeric vector containing p-values for individual tests.
`grouping` | A vector or factor of length equal to `p.values`, specifying the group to which each test is assigned. Alternatively, an rle object where each run corresponds to a group and specifies the entries of `p.values` belonging to that group. This assumes that `p.values` is ordered such that all entries in the same group are adjacent to each other.
`method` | String specifying the method to use to combine p-values.
`weights` | A numeric vector of length equal to `p.values`, containing a positive weight for each test. Alternatively `NULL`, in which case equal weights are assigned to all tests.
`log.p` | Logical scalar indicating whether the p-values in `p.values` are log-transformed.
`min.n` | Integer scalar specifying the minimum number of individual nulls to reject when testing the joint null.
`min.prop` | Numeric scalar in [0, 1], specifying the minimum proportion of individual nulls to reject when testing the joint null.

### Details

`min.prop` and `min.n` only have an effect for `method="wilkinson"` and `"holm-min"`.

`weights` only has an effect for `method="simes"`, `"holm-min"` and `"stouffer"`.

### Value

A list containing:

- `p.value`, a named numeric vector of length equal to the number of unique levels in `grouping`. This contains the combined p-value for each group, log-transformed if `log.p=TRUE`. Each entry is named according to the group.

- `representative`, a named integer scalar specifying the index of representative test for each group. Each index refers to an entry of `p.values` and is named according to its group.

- `influential`, a logical vector of length equal to `p.values`. Entries are `TRUE` for any p-value that is deemed “influential” to the final combined p-value for its group.

### Author(s)

Aaron Lun

### Examples

    p <- runif(10000)
    g <- sample(100, 10000, replace=TRUE)

    fish <- combineGroupedPValues(p, g, method="fisher")
    hist(fish$p.value)

    z <- combineGroupedPValues(p, g, method="stouffer", weights=rexp(10000))
    hist(z$p.value)

    simes <- combineGroupedPValues(p, g, method="simes")
    hist(simes$p.value)

    berger <- combineGroupedPValues(p, g, method="berger")
    hist(berger$p.value)

[Package metapod version 1.2.0 Index]