table.prob: Calculate Exact Probability of a 2X2 Table with...

Description Usage Arguments Value Examples

View source: R/manual R codes.r

Description

This function is to calculate the exact probability of every possible 2X2 table with two-armed Bernoulli-outcomes enumerated in the serialTables () when N patients to be treated.

Usage

1
table.prob(s1, p)

Arguments

s1

a list of probabilities to select A-arm for the all possible 2X2 tables based on E.st_utinity () or T.st_utinity ().

p

a vector of true success rates of two arms, a and b.

Value

a list of exact probabilities per 2X2 table.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(combinat) 
N <- 10
out <- serialTables(N)
ABSF<-sapply(out$Z, unlist)

#Probability to select the A-arm based on utinity function of E.st: E.st_utinity()
E.st_prob.A<-apply(ABSF,1,E.st_utinity)
E.table.probability<-table.prob(relist( E.st_prob.A,out$sk),p=c(0.8,0.6))
E.table.probability.v<-unlist(E.table.probability)
E.table.probability.v

#Probability to select the A-arm based on utinity function of T.st: T.st_utinity() 
T.st_prob.A<-apply(ABSF,1,T.st_utinity,w=0.5)
T.table.probability<-table.prob(relist(T.st_prob.A,out$sk),p=c(0.8,0.6))
T.table.probability.v<-unlist(T.table.probability)
T.table.probability.v

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