plotB {clinDR}  R Documentation 
Plot a dose response curve fit by Bayes MCMC methods (with optional posterior interval bars). Also plot dose group means (with optional CI bars)
plotB(y,
dose,
parm,
sigma2,
count=rep(1,length(y)),
dgrid=sort(unique(c(seq(0,max(dose),length=50), dose))),
predict= TRUE,plotDif=FALSE,plotMed=FALSE,
plotResid=FALSE,clev=0.9,
binary=c('no','logit','probit','BinRes'),BinResLev,
BinResDir=c('>','<'),
activeControl=FALSE,ac,yac,
countac=rep(1,length(yac)),
labac='Act Comp',shapeac=8,colac='red',
symbol,symbolLabel='Group',symbolShape=8,
symbolColor='red',symbolSize=4,
xlim,ylim,xat=NULL,xlab="Dose",
ylab=ifelse(plotDif,"Diff with Comparator","Mean"),
modelFun=emaxfun,makePlot=TRUE,
...)
y 
Outcomes, which may be sample means (see 
dose 
Doses corresponding to outcomes 
parm 
Matrix of simultated parameter values (each row is a
simulated parameter vector). The 
sigma2 
Simulated draws from the residual variance (assumed
additive, homogeneous). The length of 
count 
Sample sizes for meansonly summarized data. 
dgrid 
The Bayes posterior summaries are evaluated and plotted on
the 
predict 
If TRUE(default), the plotted intervals are predictive intervals for the dose group sample means. 
plotDif 
Plot difference between doses and placebo.
It is assumed the lowest dose is placebo. If 
plotMed 
If TRUE, modelbased curves are medians rather than means. 
plotResid 
If TRUE, a plot of the residuals formed from the dose group means minus the posterior dose group means. 
clev 
Level for confidence and Bayes intervals 
binary 
If 
BinResLev 
A cut level for a responder variable formed from a
continuous endpoint. Rates are computed from the (continuous
outcome) model parameters assuming normally distributed residuals. The
input 
BinResDir 
If BinResDir='>', the responder variable is 1 when

activeControl 
When TRUE, active comparator data must be supplied. Each dose group (including PBO) are compared to the active comparator rather than PBO. 
ac 
Simulations from the posterior distribution of the mean response on active comparator. The number of simulations must match those for the dose response model. For binary data, the simulated values must be transformed to the proportion scale. This differs from the simulated model parameters. 
yac 
Outcomes for the active comparator group. The coding conventions for

countac 
Sample sizes for summarized data corresponding to 
labac 
xaxis label for the active control group. 
shapeac 
Shape of the symbol for the active control group. 
colac 
Color of the symbol for the active control group. 
symbol 
An optional grouping variable for the dose group sample means. 
symbolLabel 
Label given to symbol in plot legend. 
symbolShape 
A character vector with names giving the shapes assigned
to different levels of variable 
symbolColor 
A character vector with names giving the colors assigned
to different levels of variable 
symbolSize 
The size of the symbol for the dose group sample means.
Set 
xlim 
Plot limits for the xaxis 
ylim 
Plot limits for the yaxis 
xat 
The points at which tickmarks are to be drawn. Errors occur if the points are outside the range of xlim. By default (when NULL) tickmark locations are computed. 
xlab 
xaxis label 
ylab 
yaxis label 
modelFun 
The mean model function. The first argument is a
scalar dose, and the second argument is a matrix of parameter values.
The rows of the matrix are random draws of parameter vectors for the
model. The default function is the 4parameter Emax function 
makePlot 
If FALSE, create numerical output but no plot. 
... 
Parameters passed to generic plot function (not used) 
A sample of parameters from the joint posterior distribution must be supplied (typically produced by BUGS).
The Bayesian dose response curve is the Bayes posterior mean (or median) at each
value on dgrid
. The bar (interval) is the (clev/2,1clev/2)
Bayes posterior interval (which can differ from the Bayes HPD
interval). The intervals are plotted only at the dose levels included
in the study. Predictive intervals are formed by
adding independent random draws from the sampling distributions of the dose group
sample means to the population means.
The function generates random numbers when predict=TRUE
, so the random number generator/seed must
be set before the function is called for exact reproducibility.
Returns an object of class plotB
. Three inputs are saved for
later plotting: doses in the original design, dgrid, and clev.
The following matrices are saved:
pairwise 
The dose group means and their
differences with placebo. If a 
modelABS 
Modelbased posterior mean, median, posterior (clev/2,1clev/2) intervals for the population means and sample means. One row per dose group 
modelABSG 
Same as 
modelDIF 
Same as modelABS but with differences from placebo. 
modelDIFG 
Same as modelDIF but computed on the input grid of doses. 
PlotB can also be used with draws from a prior distribution to evaluate the prior dose response curve.
Neal Thomas
Spiegelhalter, D., Thomas, A., Best, N., and Lunn, D. (2003), WinBUGS User Manual Version 1.4, Electronic version www.mrcbsu.cam.ac.uk/bugs
plot.plotB
, plotD
, plot.fitEmax
## Not run:
data("metaData")
exdat<metaData[metaData$taid==6 & metaData$poptype==1,]
prior<emaxPrior.control(epmu=0,epsca=100,difTargetmu=0,difTargetsca=100,dTarget=80.0,
p50=3.75,sigmalow=0.01,sigmaup=20)
mcmc<mcmc.control(chains=3)
msSat<sum((exdat$sampsize1)*(exdat$sd)^2)/(sum(exdat$sampsize)length(exdat$sampsize))
fitout<fitEmaxB(exdat$rslt,exdat$dose,prior,modType=4,
count=exdat$sampsize,msSat=msSat,mcmc=mcmc)
parms<coef(fitout)[,1:4] #use first intercept
outB<plotB(exdat$rslt,exdat$dose,parms, sigma2=(sigma(fitout))^2,
ylab="Change in EDD")
plot(outB,plotDif=TRUE)
## End(Not run)