Learn R Programming

clinDR (version 2.4.1)

DRDensityPlot: Plot Bayes or confidence interval density contours over a grid of points (usually dose or time)

Description

Density plot for distributions conditional on a variable. A grid of values are specified for the conditioning variable, which is plotted on the horizontal axis. The conditioning variable is typically dose or time

Usage

DRDensityPlot(x,qL,qH,qlevL=c(0.025,0.05,0.10,0.25),
		xlim,ylim,xlab='x',ylab='y')

Value

Plotted output only.

Arguments

x

A grid of conditioning values to be plotted on the horizontal axis. This grid typically represents dose or time.

qL

Lower percentiles, confidence or probabiity levels. qL is a matrix with rows corresponding to x, and columns corresponding to qlevL. The percentiles must be increasing in order and less that 0.50.

qH

Upper percentiles, confidence or probabiity levels. qH levels correspond to the qL levels but are ordered from highest to lowest (1-qlevL), with the smallest greater than 0.50.

qlevL

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

xlim

Plot limits for the x-axis

ylim

Plot limits for the y-axis

xlab

x-axis label

ylab

y-axis label

Author

Neal Thomas

Details

The function takes as input percentiles defining confidence intervals or Bayesian probability intervals at different levels (e.g. 5,95, 25,75) for distributions conditional on a variable that is typically dose or time. Regions defined by different confidence/probability levels are represented by different levels of shading. The input parameter, qlevL, is used only to define the input in the matrices qL and qH. The qlevL is not used for any numerical calculations, which must be done before executing the function.

See Also

plotBdensity

Examples

Run this code

if (FALSE) {
data('metaData')
exdat<-metaData[metaData$taid==32,]

msSat<-sum((exdat$sampsize-1)*(exdat$sd)^2)/(sum(exdat$sampsize)-length(exdat$sampsize))
fitout<-fitEmax(exdat$rslt,exdat$dose,modType=3,count=exdat$sampsize,
								msSat=msSat)

dgrid<-seq(0,100,length=100)
seout95<-predict(fitout,dgrid,clev=0.95)
seout90<-predict(fitout,dgrid,clev=0.9)
seout80<-predict(fitout,dgrid,clev=0.8)
seout50<-predict(fitout,dgrid,clev=0.5)

qlev<-c(0.025,0.05,0.10,0.25)

qL<-cbind(seout95$ubdif,seout90$ubdif,seout80$ubdif,seout50$ubdif)
qH<-cbind(seout95$lbdif,seout90$lbdif,seout80$lbdif,seout50$lbdif)

DRDensityPlot(dgrid,qL,qH,qlevL=qlev,xlab='Dose',ylab='Diff with PBO')

}
# \dontshow{

dgrid<-seq(0,1,length=5)
qlev<-c(0.10,0.25)

qL<-matrix(c(0.000000, 0.000000,
1.181590, 1.093189,
1.301505, 1.220726,
1.354046, 1.273955,
1.384266, 1.303586),ncol=2,byrow=TRUE)

qH<-matrix(c(0.0000000, 0.0000000,
0.8083449, 0.8967468,
0.9604440, 1.0412232,
1.0158898, 1.0959808,
1.0436238, 1.1243036),ncol=2,byrow=TRUE)

DRDensityPlot(dgrid,qL,qH,qlevL=qlev,xlab='Dose',ylab='Diff with PBO')
# }

Run the code above in your browser using DataLab