Description Usage Arguments Value Examples
View source: R/manual R codes.r
Visulize the OSRs and A-arm selection Fraction of homogeneous E.st and homogeneous T.st when N patients treated in a plot.
1  | Vis_OSR_A.fra(d, title)
 | 
d | 
 data of matrix with two colums, separately store the values based on the E.st and T.st  | 
title | 
 the name of the plot.  | 
the 2-D plot
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  | library(combinat)
N <- 20
out<-serialTables(N)
ABSF<-sapply(out$Z, unlist)  
 
A.fraction<-apply(ABSF,1,A.frac)
A.fraction[1] <- 0.5
Success.fraction <-success.fraction<-apply(ABSF,1,success.frac)
Success.fraction[1] <- 0.5
E.st_prob.A<-apply(ABSF,1,E.st_utinity)
#Probability to select the A-arm based on utinity function of E.st: E.st_utinity()
a<-0.8
#ture success rate of A-arm treatment
b<-0.6
#ture success rate of B-arm treatment
E.table.probability<-table.prob(relist(E.st_prob.A,out$sk),p=c(a,b))
#exact probability per 2X2 table based on utinity function of E.st: E.st_utinity()
w=0.5
#homogeneous optimistic attitude with w=0.5
T.st_prob.A<-apply(ABSF,1,T.st_utinity,w=0.5)
#Probability to select the A-arm based on utinity function of T.st: T.st_utinity()
a<-0.8
#ture success rate of A-arm treatment
b<-0.6
#ture success rate of B-arm treatment
T.table.probability<-table.prob(relist(T.st_prob.A,out$sk),p=c(a,b))
#exact probability per 2X2 table based on utinity function of T.st: T.st_utinity()
#Comparison of A-arm Fraction and OSRs of homogeneous E.st and T.st
E.table.prob.v<- unlist(E.table.probability)
E.mean.selectionA.per.n<-O_A_frac(fv=A.fraction,pv=E.table.prob.v,sk=out$sk) 
E.mean.success.per.n<-OSR(xv=success.fraction,pv=E.table.prob.v,sk=out$sk) 
T.table.prob.v<- unlist(T.table.probability)
T.mean.selectionA.per.n<-O_A_frac(fv=A.fraction,pv=T.table.prob.v,sk=out$sk) 
T.mean.success.per.n<-OSR(xv=success.fraction,pv=T.table.prob.v,sk=out$sk) 
par(mar=c(4,4,3,1),mfrow=c(1,2))
Vis_OSR_A.fra(d=cbind(E.mean.selectionA.per.n,T.mean.selectionA.per.n),title="A-arm Fraction of E.st vs T.st")
Vis_OSR_A.fra(d=cbind(E.mean.success.per.n,T.mean.success.per.n),title="OSRs of E.st vs T.st")
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.