binsim: Simulation for Power of a Sequential Fisher's Exact Test

View source: R/binsim.R

binsimR Documentation

Simulation for Power of a Sequential Fisher's Exact Test

Description

Performs a simulation to estimate the power of Fisher's Exact under group sequential monitoring.

Usage

binsim(
  nsamp,
  n,
  p1,
  p2,
  inf.times,
  upper,
  lower = rep(1.5, length(inf.times)),
  p.con = 0.5,
  alt = "less"
)

Arguments

nsamp

Number of simulated trials

n

Total sample size for each trial

p1

Success probability for group 1 (control)

p2

Success probability for group 2

inf.times

Information times of analyses (as fractions)

upper

Upper boundary (p-value scale, so test rejects for values smaller than the 'upper' boundary)

lower

Lower boundary (p-value scale)

p.con

Proportion randomized to control (group 1)

alt

Direction of the alternative (one of greater, less or two.sided)

Details

Calls fisher.test. If the experimental group (2) has a higher event rate than the control group (1), then 'less' is the appropriate direction for a one-sided test.

Value

A vector of length nsamp, giving the test result for each simulated trial, coded 1 if the upper boundary was crossed, -1 if the lower boundary was crossed, and coded 0 if neither was (only the first boundary crossing is recorded).

Author(s)

R Gray

See Also

b2p; fisher.test

Examples

binsim(20, 50, 0.1, 0.5, c(0.5, 1), c(0.05, 0.05), c(0.5, 0.5), alt = 'less')


raredd/desmon documentation built on May 7, 2024, 3:46 p.m.