b2p_text: Two-proportion design text

View source: R/stat_text.R

b2p_textR Documentation

Two-proportion design text

Description

Output two-proportion design text. The power or sample size (per group) will be calculated depending on the arguments given (i.e., either n1 or power should be NULL).

Usage

b2p_text(
  p1,
  p2,
  n1 = NULL,
  n2 = n1,
  power = NULL,
  alpha = 0.025,
  r = 0.5,
  arms = c("Experimental", "Control"),
  type = c("fisher", "UMPU", "approx.cor", "approx.unc"),
  cont.cor = TRUE
)

Arguments

p1, p2

the success rates for both groups (p1 > p2)

n1, n2

sample size for both groups

power, alpha

the power and one-sided significance level (type I error)

r

proportion assigned to group 1

arms

labels for the two groups

type

the type of test used to calculate power, see b2p

cont.cor

logical; if TRUE (default), the sample size will be calculated for the continuity corrected statistic

Value

A character string describing the two-stage design with attr(., "design") containing the design.

See Also

b2p; b2n

Other designs: bin1samp_text(), mtd_text(), simon_text(), twostg_text()

Examples

## basic usage (compare to a simon design)
p1 <- 0.5
p2 <- 0.3

b2p_text(p1, p2, power = 0.8)
b2p_text(p1, p2, n1 = 103)
b2p_text(p1, p2, power = 0.8, r = 2/3)

## Not run: 
## use cat and/or strwrap for improved formatting and writing
cat(strwrap(b2p_text(p1, p2, power = 0.8), width = 80), sep = '\n')

cat(b2p_text(p1, p2, power = 0.8), file = '~/simon_design.txt')

## End(Not run)


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