OSR: Weighed Average Favorable Outcomes Rate per Individual

Description Usage Arguments Value Examples

View source: R/manual R codes.r

Description

Weighted mean success rate per individual, named as overall success rate, since it calculates the sum of the multiplication of the probability and average success rate for all possible 2X2 tables when N patients.

Usage

1
OSR(xv, pv, sk)

Arguments

xv

a vector of average success fraction of two arms in all possible tables.

pv

a vector of occurence probabilities of all tables

sk

a list of list structure of matrices indicating all possible Bernoulli-outcomes of two arms.

Value

a vector of overall success rate 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)
success.fraction<-apply(ABSF,1,success.frac)
success.fraction[1]<-0.5
OSR(xv=success.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)
success.fraction<-apply(ABSF,1,success.frac)
success.fraction[1]<-0.5
OSR(xv=success.fraction,pv=T.table.probability.v,sk=out$sk) 

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