empval: Get empirical p-value

View source: R/RcppExports.R

empvalR Documentation

Get empirical p-value

Description

Calculate empirical p-values from real values and simulated values

Usage

empval(stat, sim)

Arguments

stat

A numeric vector of calculated statistic from the actual data

sim

A numeric vector (or matrix) of simulated statistics, e.g. by Monte-Carlo methods.

Details

The estimate of the P-value is obtained as \hat{p}=(r+1)/(n+1), where n is the number of replicate samples that have been simulated and r is the number of these replicates that produce a test statistic greater than or equal to that calculated for the actual data.

Value

A vector of empirical p-values, of the same length as the input

Author(s)

Jitao David Zhang <jitao_david.zhang@roche.com>

References

  • Davison AC, Hinkley DV (1997) Bootstrap methods and their applications. Cambridge University Press, Cambridge, United Kindom.

  • North BV, Curtis D, Sham PC (2002) A note on the calculation of empirical p values from Monte Carlo Procedures. Am J Hum Genet. 2002 August; 71(2):439–441.

Examples

set.seed(1995)
testStat <- c(-100, -3, -1, 0, 1, 3, 100)
testSim <- rnorm(1000)
empval(stat=testStat, sim=testSim)

bedapub/ribiosMath documentation built on Jan. 29, 2023, 1:48 p.m.