samplesize.bin: Sample Size for 2-sample Binomial

Description Usage Arguments Value AUTHOR Examples

View source: R/samplesize.bin.s

Description

Computes sample size(s) for 2-sample binomial problem given vector or scalar probabilities in the two groups.

Usage

1
samplesize.bin(alpha, beta, pit, pic, rho=0.5)

Arguments

alpha

scalar ONE-SIDED test size, or two-sided size/2

beta

scalar or vector of powers

pit

hypothesized treatment probability of success

pic

hypothesized control probability of success

rho

proportion of the sample devoted to treated group (0 <\code{rho} < 1)

Value

TOTAL sample size(s)

AUTHOR

Rick Chappell
Dept. of Statistics and Human Oncology
University of Wisconsin at Madison
[email protected]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
alpha <- .05
beta <- c(.70,.80,.90,.95)


# N1 is a matrix of total sample sizes whose
# rows vary by hypothesized treatment success probability and
# columns vary by power
# See Meinert's book for formulae.


N1 <- samplesize.bin(alpha, beta, pit=.55, pic=.5)
N1 <- rbind(N1, samplesize.bin(alpha, beta, pit=.60, pic=.5))
N1 <- rbind(N1, samplesize.bin(alpha, beta, pit=.65, pic=.5))
N1 <- rbind(N1, samplesize.bin(alpha, beta, pit=.70, pic=.5))
attr(N1,"dimnames") <- NULL


#Accounting for 5% noncompliance in the treated group
inflation <- (1/.95)**2
print(round(N1*inflation+.5,0))

harrelfe/Hmisc documentation built on Oct. 3, 2019, 9:34 p.m.