Last data update: 2014.03.03

R: Single arm, assurance calculator for single or multi-stage...
binom_one_assuranceR Documentation

Single arm, assurance calculator for single or multi-stage binomial trials.

Description

Computes the assurance of a given trial design given a prior assurance distribution.

Usage

binom_one_assurance(failure, success, n, ass.dist,
 type="continuous", lower=0, upper=1, ...)

plot_binomassurance(failure, success, n, ass.dist,type="continuous",
	ndivisions=1000, xlim=c(0,1), xaxs="i", yaxs="i", ylim=NULL,
	main="Assurance distribution", col="red", col.fill="green", lwd=2,
	xlab="Probability of successful treatment",
	ylab="Prior assurance probability" ,...)

Arguments

failure

A vector of the number of failures required to stop for futility, if not able to stop NA or a character string should be provided

success

A vector of the number of successes required to stop for efficacy, if not able to stop NA or a character string should be provided

n

A vector of the total number of patients to recruit up to each stage of the trial

ass.dist

Distribution of prior probability for assurance. May be different to prior information.

type

Tells the program you are passing it a continuous distribution ("continuous") or a discrete distribution ("discrete") for the assurance distribution

ndivisions

The number of points calculated for the plot

lower, upper

Range of the distribution to use

col.fill

Colour of the true positive results in the graph

xlim, xaxs, yaxs, ylim, main, col, lwd, xlab, ylab

Different defaults for plotting parameters

...

Additional plotting parameters to pass to plot function

See Also

binom_one_power, binom_one_alpha

Examples

# Simon's two stage design
failure=c(0,3)
success=c(NA,4)
n=c(7,18)
p0=0.1
p1=0.3

# continuous assurance distribution
ass.dist = function(p) dbeta(p,4,18)

# assurance
binom_one_assurance(failure,success,n,ass.dist)

# plot
plot_binomassurance(failure,success,n,ass.dist,ndivisions=1000)

# discrete assurance distribution
ass.dist = matrix(c(0.2,0.3,0.4,0.3,0.4,0.3),ncol=2)

# assurance
binom_one_assurance(failure,success,n,ass.dist,type="discrete")

# plot
plot_binomassurance(failure,success,n,ass.dist,type="discrete",
                    ndivisions=1000)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(EurosarcBayes)
Loading required package: shiny
Loading required package: VGAM
Loading required package: stats4
Loading required package: splines
Loading required package: data.table
Loading required package: plyr
Loading required package: clinfun
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/EurosarcBayes/binom_one_assurance.Rd_%03d_medium.png", width=480, height=480)
> ### Name: binom_one_assurance
> ### Title: Single arm, assurance calculator for single or multi-stage
> ###   binomial trials.
> ### Aliases: binom_one_assurance plot_binomassurance
> 
> ### ** Examples
> 
> # Simon's two stage design
> failure=c(0,3)
> success=c(NA,4)
> n=c(7,18)
> p0=0.1
> p1=0.3
> 
> # continuous assurance distribution
> ass.dist = function(p) dbeta(p,4,18)
> 
> # assurance
> binom_one_assurance(failure,success,n,ass.dist)
[1] 0.38488
> 
> # plot
> plot_binomassurance(failure,success,n,ass.dist,ndivisions=1000)
> 
> # discrete assurance distribution
> ass.dist = matrix(c(0.2,0.3,0.4,0.3,0.4,0.3),ncol=2)
> 
> # assurance
> binom_one_assurance(failure,success,n,ass.dist,type="discrete")
[1] 0.7438106
> 
> # plot
> plot_binomassurance(failure,success,n,ass.dist,type="discrete",
+                     ndivisions=1000)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>