The calculation of the p-value that accounts for the finite sample size uses a formula from Davison and Hinkley (1997), Bootstrap Methods and their Application, chapter 4, p. 161.

calcPvalFromBS(
  testStat,
  bsStat,
  corrected = FALSE,
  alternative = c("greater", "less")
)

Arguments

testStat

a numeric, test statistic.

bsStat

a numeric vector with statistic from bootstrapping.

corrected

a logical; if TRUE, calculates a p-value that accounts for the finite sample size; default FALSE.

alternative

either of "less" or "greater"; default "greater"

Value

a scalar with the p-value

Examples

library(ARCOS)
ARCOS::calcPvalFromBS(2, rnorm(1000))
#> [1] 0.021