Description Usage Arguments Details Value Examples

Function to obtain "Importance Sampling"-based estimates of p-values for z-scores maximized over subsets (of traits or subtypes), with possible restrictions and weights. Should not be called directly. See details.

1 2 3 |

`t.vec` |
Numeric vector of (positive) points for which to calculate p-values, i.e. observed Z-max values. No default. |

`k` |
Integer (currently less than 30). The number of studies (traits) or subtypes being analyzed. No default. |

`search` |
0, 1 or 2. Search option, with 0 indicating subtype analysis, 1 and 2 denote one-sided and two-sided subset-search. No default. |

`side` |
Either 1 or 2. For two-tailed tests (where absolute values of Z-scores are maximized), side should be 2. For one-tailed tests side should be 1 (positive tail is assumed). No default. Ignored when search is 2. |

`ncase` |
The number of cases in each of the |

`ncntl` |
Same as |

`pool` |
TRUE indicates case-complement analysis, FALSE indicated case-control analysis. No default when |

`rmat` |
A |

`cor.numr` |
Logical. Whether to consider correlation in the numerator of the meta-analysis statistic. No default, ignored when |

`sizes` |
Sizes of equivalence classes of traits. By default, no two traits or studies are equivalent. This argument is for internal use. |

`nsamp` |
Number of importance sampling replicates. Default is 50. See details. |

`sub.def` |
A function to restrict subsets, e.g., order restrictions in subtype analysis. Should accept a subset (a logical vector of size k) as its first argument and should return TRUE if the subset satisfies restrictions and FALSE otherwise. Default is NULL implying all (2^k - 1) subsets are considered in the maximum. |

`sub.args` |
Other arguments to be passed to |

`wt.def` |
A function that gives weight of one subset with respect to another. Should accept two subsets as first two argumets and return a single positive weight. Default NULL. Currently this option is not implemented and the argument is ignored. |

`wt.args` |
Other arguments to be passed to |

The function is vectorized to handle blocks of SNPs at a time. Currently weight options are ignored.
This is a helper function that is called internally by `h.traits`

and `h.types`

and should not be called directly. The arguments of this function that have defaults, can be customized using
the argument `pval.args`

in `h.traits`

and `h.types`

.
Using a higher value of `nsamp`

such as 500, will give more accurate answers but can become extremely
slow particularly if `k`

is high (~10). Generally, even 10 replicates can give reasonably accurate answers. Does not
depend on how small the p-value is.

A numeric vector of estimated p-values.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ```
set.seed(123)
# Subset definition
sub.def <- function(logicalVec) {
# Only allow the cummulative subsets:
# TRUE FALSE FALSE FALSE ...
# TRUE TRUE FALSE FALSE ...
# TRUE TRUE TRUE FALSE ...
# etc
sum <- sum(logicalVec)
ret <- all(logicalVec[1:sum])
ret
}
nsnp <- 3
k <- 5
t.vec <- 1.5 + 3*runif(nsnp)
ncase <- matrix(1000, nrow=k, ncol=nsnp)
ncntl <- matrix(1000, nrow=k, ncol=nsnp)
p.tube(t.vec, k, 0, 2, ncase, ncntl, FALSE, NULL, TRUE,
nsamp=100, sub.def=sub.def)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.