R: Internal functions: Calculate p-values from Complete...

calcPvalsMC {perm} | R Documentation

## Internal functions: Calculate p-values from Complete Enumeration or Monte Carlo

### Description

These internal functions are not meant to be called directly. This help is to explain the functions. The function `calcPvals` calculates p-values from a set of either completely enumerated test statistics (in which case all wgts are equal to one) or a set of test statistics from a network algorithm (in which case the wgts come from the network algorithm). The function `calcPvalsMC` calculates p-values and the associated confidence intervals from a Monte Carlo simulation. The p-values are estimated by (S+1)/(N+1) where S is the number of more extreme test statistics, and N is the number of Monte Carlo simulations. This estimator is guaranteed to be valid, and the confidence interval is the appropriate one associated with this estimator (see e.g., Fay, Kim, and Hachey, 2007).

### Usage

    calcPvalsMC(Tj, T0, digits, alternative = NULL, twosidedTstat = FALSE, p.conf.level=0.99)
    calcPvals(Tj, T0, digits, denom = NULL, wgts = NULL, twosidedTstat = FALSE)
    pCI(S, N, p.conf.level = 0.99)

### Arguments

`Tj` | numeric vector of values of test statistic
`T0` | observed value of test statistic
`digits` | number of significant digits for rounding (see details)
`alternative` | character vector: one of "less", "greater", "two.sided"
`twosidedTstat` | logical, TRUE denotes test statistic is twosided
`denom` | total number of test statistics
`wgts` | vector of weights the same length as Tj, NULL gives all ones
`S` | number of Monte Carlo replications equal or more extreme than T0
`N` | number of Monte Carlo replications
`p.conf.level` | confidence level for confidence intervals about Monte Carlo p-values

### References

Fay, MP, Kim, H-J, Hachey, M (2007). Journal of Computational and Graphical Statistics. 16:946-957. Available at http://www3.niaid.nih.gov/about/organization/dcr/BRB/staff/michael.htm

### See Also

Called from `permTS`, `permKS`, `permTREND`

[Package perm version 1.0-0.0 Index]