O_A_frac: Overall Fraction of A-arm Selection per Individual

Description Usage Arguments Value Examples

View source: R/manual R codes.r

Description

Average the fraction of A-arm selection per individual.

Usage

1
O_A_frac(fv, pv, sk)

Arguments

fv

a vector of the A-arm selection fraction out of two-armed Bernoulli in all possible tables.

pv

a vector of occurence probabilities of all tables

sk

a list of list structure of matrices with indicating all possible Bernoulli-outcomes when N patients treated.

Value

a vector of mean of A-arm selection fraction of a series of patients n=0,1,2,...,N.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(combinat) 
N <- 10
out <- serialTables(N)
ABSF<-sapply(out$Z, unlist)
#all possible 2X2 tables

E.st_prob.A<-apply(ABSF,1,E.st_utinity)
#Probability to select the A-arm based on utinity function of E.st.
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)
A.fraction<-apply(ABSF,1,A.frac)
A.fraction[1]<-0.5
O_A_frac(fv=A.fraction,pv=E.table.probability.v,sk=out$sk)

#Probability to select the A-arm based on utinity function of T.st.
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)
A.fraction<-apply(ABSF,1,A.frac)
A.fraction[1]<-0.5
O_A_frac(fv=A.fraction,pv=T.table.probability.v,sk=out$sk) 

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