pr_table: Probability table

View source: R/tables.R

pr_tableR Documentation

Probability table

Description

A single-stage function for calculating the probabilities of crit or fewer (greater if greater = TRUE) events for true but unknown probabilities of the event occurring.

Usage

pr_table(prob, n, crit, greater = FALSE, digits = getOption("digits"))

Arguments

prob

a vector of probabilities for event

n, crit

sample size and critical number of events, respectively; note that the probabilities will always be calculated as weakly less or greater than crit, i.e., Pr(>= crit) or Pr(<= crit) depending if greater is TRUE or FALSE

greater

logical; direction of crit: if FALSE, the probabilities are calculated for crit or fewer events; if TRUE, the probabilities are calculated for crit or more events

digits

number of digits past the decimal point to keep

See Also

blt_table; dlt_table

Examples

prob <- c(1, 5, 1:5 * 10) / 100

## probabilities of crit or fewer events given true but unknown prob
pr_table(prob, n = 15, crit = 3, greater = FALSE)

## probabilities of crit or more events given true but unknown prob
pr_table(prob, n = 15, crit = 3, greater = TRUE)

## compare
1 - as.numeric(pr_table(prob, n = 15, crit = 2, greater = FALSE)[2L, ])


raredd/desmon2 documentation built on Feb. 9, 2023, 12:09 p.m.