bin1samp_power: Power for one-sample exact binomial designs

View source: R/desmon-extra.R

bin1samp_powerR Documentation

Power for one-sample exact binomial designs

Description

Determines the power and significance level for a one-sided, one-sample exact binomial test.

bin1samp_power accepts a single value or vector for n and/or r and will return a matrix with results for each combination. If only one value is given for each, a vector is returned.

Usage

bin1samp_power(p0, pa, n, r)

bin1samp_sim(p0, pa, n, r = seq.int(n), plot = TRUE)

Arguments

p0, pa

probability of success under the null and alternative hypotheses, respectively

n

sample size

r

a vector of critical values, typically the minimum number of successes required to reject pa

plot

logical; if TRUE, a the sequence of r versus type-I and type-II errors is plotted

Value

bin1samp_power returns a vector or matrix with the following:

type1

the overall type-I error

type2

the overall type-II error

bin1samp_sim returns a data frame with the following columns:

r

critical values

type1

the overall type-I errors

type2

the overall type-II errors

See Also

twostg_power; twostg_sim

Examples

p0 <- 0.1
pa <- 0.3
des <- desmon2:::bin1samp(p0, pa)
bin1samp_power(p0, pa, des['n'], des['r'] + 1L)

## compare
des[c('size', 'type2')]

bin1samp_power(p0, pa, des['n'], des['r'] + -2:2)
bin1samp_power(p0, pa, des['n'] + 0:1, des['r'] + -2:2)


## simulate over critical values
bin1samp_sim(p0, pa, des['n'])


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