plotBdensity: Density plot displaying Bayes prior or posterior dose...

View source: R/plotBdensity.R

plotBdensityR Documentation

Density plot displaying Bayes prior or posterior dose response

Description

Density plot over a grid of doses displaying the prior or posterior distribution for the mean dose response computed from simulated input model parameters.

Usage

plotBdensity(dgrid, 
      parm, 
      modelFun=emaxfun,
      qlevL=c(0.025,0.05,0.10,0.25),
      plotDif= FALSE,
      logit= FALSE, ...)

Arguments

dgrid

The Bayes prior or posterior summaries are evaluated and plotted on the dgrid dosing values

parm

Matrix of simultated parameter values (each row is a simulated parameter vector). The parm values must be constructed for use in the model function modFun. The default is a 4-parameter Emax model with parameters (log(ED50),lambda,Emax,E0). For a 3-parameter model, set lambda=1 for each simulated parameter vector.

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 4-parameter Emax function emaxfun.

qlevL

Intervals are formed with percentile boundaries at (qlevL,1-qlevL). qlevL must be increasing between (0,0.5).

plotDif

If TRUE, plot difference between doses and placebo.

logit

Default is F. If T, inverse logit transform applied to Emax function output for comparison to dose group sample proportions.

...

Parameters passed to generic plot function

Details

A sample of parameters from the joint prior or posterior distribution must be supplied (typically produced by BUGS). A density plot with contours corresponding to the perentiles in qlevL created by function DRDensityPlot .

Value

A list containing two matrices with the number of rows equal to the number dose grid points, and columns corresponding to percentiles in qlevL:

qL

Lower perentiles from qlevL

qH

Upper percentiles 1-qlevL.

Author(s)

Neal Thomas

References

Spiegelhalter, D., Thomas, A., Best, N., and Lunn, D. (2003), WinBUGS User Manual Version 1.4, Electronic version www.mrc-bsu.cam.ac.uk/bugs

See Also

plot.plotB, plotD, plot.fitEmax, DRDensityPlot

Examples


## Not run: 
data("metaData")
exdat<-metaData[metaData$taid==6 & metaData$poptype==1,]

prior<-emaxPrior.control(epmu=0,epsca=10,difTargetmu=0,difTargetsca=10,dTarget=80.0,
        p50=3.75,sigmalow=0.01,sigmaup=20)
mcmc<-mcmc.control(chains=3)

msSat<-sum((exdat$sampsize-1)*(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

dgrid<-seq(0,1,length=100)

pout<-plotBdensity(dgrid,parm=parms)

pout2<-plotBdensity(dgrid,parm=parms,plotDif=TRUE,
       xlab='Dose',ylab='Dif with PBO')

## End(Not run)


clinDR documentation built on Aug. 9, 2023, 9:08 a.m.