BAEssd-package: Bayesian Average Error approach to Sample Size Determination

Description Details Examples

Description

Employes a Bayesian average error based approach to sample size determination. Several functions are included for sample size calculation for common designs in clinical trials including one- and two-sample binary and normal responses. These functions are grouped in "suites" that pertain to each type of example.

Details

Package: BAEssd
Type: Package
Version: 1.0.1
Date: 2010-06-18
Suggests: mvtnorm
License: GPL-2
LazyLoad: yes

Before any calculations can be made, first identify the example of interest and the corresponding suite of functions:

binom1.1sided One sample, binary response, one-sided hypothesis.
binom1.2sided One sample, binary response, two-sided hypothesis.
binom2.1sided Two indepednent samples, binary response, one-sided hypothesis.
binom2.2sided Two independent samples, binary response, two-sided hypothesis.
norm1KV.1sided One sample, normal response, known variance, one-sided hypothesis.
norm1KV.2sided One sample, normal response, known variance, two-sided hypothesis.
norm1UV.2sided One sample, normal response, unknown variance, two-sided hypothesis.
norm2KV.2sided Two independent samples, normal response,
known variance, two-sided hypothesis.

After selecting the suite of functions of interest, the suite must be generated with appropriate parameters. Then, the corresponding ssd function can be used to calculate the sample size. The two primary constraints for choosing a sample size are the bound on the Total Error to maintain and the weight given to controlling the Average Type-I Error (as opposed to the Average Type-II Error).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
############################################################
# Calculate the sample size required for a one-sample 
# normal experiment with known variance (sigma2=25) with
# the hypothesis of interest being
#     H0: theta==0   vs.   H1: theta!=0
#
# where theta is the mean of the normal distribution. For
# details on the prior used, see documentation for
# norm1KV.2sided().

# generate suite of functions
f1 <- norm1KV.2sided(sigma=5,theta0=0,prob=0.5,mu=2,tau=1)

# attach suite
attach(f1)

# calculate sample size for TE bound of 0.25 and weight 0.5
ssd.norm1KV.2sided(alpha=0.25,w=0.5)

# detach suite
detach(f1)


############################################################
# Calculate the sample size required for a two-sample 
# experiment with a binary response in which the hypothesis
# of interest is
#     H0: p1==p2   vs.   H1: p1!=p2
#
# where p1 is the response rate for group 1 and p2 is the
# response rate for group 2, independent samples. For
# details on the prior used, see documentation for
# binom2.2sided().

# generate suite of functions
f2 <- binom2.2sided(prob=0.5,a0=1,b0=1,a1=1,b1=1,a2=1,b2=1)

# attach suite
attach(f2)

# calculate sample size for TE bound of 0.25 and weight 0.5
#   - here the log marginal distribution (logm) is part of the suite.
ssd.binom(alpha=0.25,w=0.5,logm=logm,two.sample=TRUE)

# detach suite
detach(f2)

BAEssd documentation built on May 2, 2019, 3 a.m.