Given a posterior (or prior) sample of the parameters, this function inverts the given functional form to obtain samples from the MTD distribution.
1  find.x(ff, ptox, alpha)

ff 
A string indicating the functional form of the doseresponse curve. Options are

ptox 
The required probability of DLT. For example, if the MTD distribution is sought then set 
alpha 
A sample from the posterior (or prior) distribution of the parameter(s). 
Given a posterior (or prior) sample of the parameters, this function inverts the given functional form to obtain samples from the MTD distribution or any other targeted quantile.
Michael Sweeting mjs212@medschl.cam.ac.uk (University of Cambridge, UK), drawing on code originally developed by J. Jack Lee and Nan Chen, Department of Biostatistics, the University of Texas M. D. Anderson Cancer Center
Sweeting M., Mander A., Sabin T. bcrm: Bayesian Continual Reassessment Method Designs for Phase I DoseFinding Trials. Journal of Statistical Software (2013) 54: 1–26. http://www.jstatsoft.org/article/view/v054i13
bcrm
, getprior
, Posterior.exact
, Posterior.BRugs
, Posterior.R2WinBUGS
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  ## Doseescalation cancer trial example as described in Neuenschwander et al 2008.
## Predefined doses
dose<c(1,2.5,5,10,15,20,25,30,40,50,75,100,150,200,250)
## Prespecified probabilities of toxicity
## [dose levels 1115 not specified in the paper, and are for illustration only]
p.tox0<c(0.010,0.015,0.020,0.025,0.030,0.040,0.050,0.100,0.170,0.300,0.400,0.500,0.650
,0.800,0.900)
## Data from the first 5 cohorts of 18 patients
tox<c(0,0,0,0,0,0,2,0,0,0,0,0,0,0,0)
notox<c(3,4,5,4,0,0,0,0,0,0,0,0,0,0,0)
## Target toxicity level
target.tox<0.30
## Prior distribution for the MTD given a lognormal(0,1.34^2) distribution for alpha
## and a power model functional form
prior.alpha<list(3,0,1.34^2)
ff<"power"
samples.alpha<getprior(prior.alpha,2000)
mtd<find.x(ff,target.tox,alpha=samples.alpha)
hist(mtd)
## Standardised doses
sdose<find.x(ff,p.tox0,alpha=1)
## Posterior distribution of the MTD (on standardised dose scale) using data
## from the cancer trial described in Neuenschwander et al 2008.
## Using rjags
posterior.samples<Posterior.rjags(tox,notox,sdose,ff,prior.alpha
,burnin.itr=2000,production.itr=2000)
posterior.mtd<find.x(ff,target.tox,alpha=posterior.samples)
hist(posterior.mtd)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.