A.frac: Calculate the Fraction of A-arm Selection of Two-armed...

Description Usage Arguments Details Value Examples

View source: R/manual R codes.r

Description

Calculate the fraction of A_armed for every 2X2 table numerated in the serialTables () when N patients to be treated.

Usage

1
A.frac(x)

Arguments

x

a vector of 4 elements including A$Success, A$Failure, B$Success, and B$Failure.

Details

A and B are examples of two arms, which resulting in favorable outcomes (success) and unfavorable outcomes (failure).

Value

the fraction of A-arm selected

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
AS<-13
#  the successful counts of A treatment
AF<-5
#  the failures of A treatment
BS<-2
# the successful counts of B treatment
BF<-1
#the failures of B treatment
N<- AS+AF+BS+BF
A.frac(x=c(AS,AF,BS,BF))

library(combinat) 
N <- 10
out <- serialTables(N)
ABSF<-sapply(out$Z, unlist)
A.fraction<-apply(ABSF,1,A.frac)
# the fraction of A-arm selected per table.
A.fraction

ryamada22/SelfDecABP documentation built on May 28, 2019, 10:44 a.m.