Vis_3d: Visulization of Probability, A-arm Selection Fraction and...

Description Usage Arguments Details Value Examples

View source: R/manual R codes.r

Description

Visulization probabilities against the A-arm fraction and Overall success rate plane via persp()

Usage

1
Vis_3d(g, title, zlims)

Arguments

g

grid matrices outputed from the function dist.2D ()

title

the name of the strategy. E.st or T.st

zlims

the minimum and maximum z-axis.

Details

x-axis indicates A-arm fraction and y-axis indicates the overall success rate, and z-axis indicates the probability.

Value

perspective plot with surface

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
library(combinat)
N <- 50
out<-serialTables(N)
ABSF<-sapply(out$Z, unlist)  
 
A.cnt <- relist((ABSF[,1]+ABSF[,2]),out$sk)
A.fraction<-apply(ABSF,1,A.frac)
A.fraction[1] <- 0.5
Success.cnt <- relist(ABSF[,1]+ABSF[,3],out$sk)
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()
grid.exp.ls<-dist.2D(Success.cnt,A.cnt,E.table.probability)

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()
grid.target.ls<-dist.2D(Success.cnt,A.cnt,T.table.probability) 
 
zlims<-range(c(grid.exp.ls[[N+1]]),c(grid.target.ls[[N+1]]))
par(bg="white",cex=1,col="black",mar=c(2,3.5,3,1))
Vis_3d(g=grid.exp.ls[[N+1]],title="Homogeneous E.st",zlims=zlims)
Vis_3d(g=grid.target.ls[[N+1]],title="Homogeneous T.st",zlims=zlims)

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