emaxsimB {clinDR}  R Documentation 
Simulate dose response data and apply 4 or 3 parameter sigmoidal or hyperbolic Bayesian estimation. The prior distribution is input by the user with default values for some parameters based on the empirical distribution estimated from dose response metaanalyses. For binary response data, the Emax model is fit on the logit scale, and then backtransformed
emaxsimB(nsim, genObj, prior, modType = 4,
binary = FALSE, seed=12357,
check = FALSE, nproc=parallel::detectCores(),
negEmax = FALSE, ed50contr = NULL,
lambdacontr = NULL, testMods = NULL,
idmax = length(doselev),
mcmc = mcmc.control(),
customCode=NULL, customParms=NULL,
description = "")
nsim 
Number of simulation replications 
genObj 
Object containing inputs and function to create simulated
data sets. These objects are created by special constructor
functions; the current choices are 
prior 
Prior specification through an object of type 'emaxPrior' or 'prior'.
See 
modType 
When 
binary 
When specified, the Emax model is fit on the logit scale, and then the results are backtransformed to proportions. 
seed 
Seed for random number generator used to create data. A separate
seed can be passed to 
check 
When 
nproc 
The number of processors to use in parallel computation of the
simulations, which are divided into equalsized computational blocks. When 
negEmax 
When 
ed50contr 
A vector of ED50 values for creating a global null test using the MCPMOD package DoseFinding based on Emax modelbased contrasts. The default is 3 contrasts: the midpoint between pbo and the lowest dose, the midpoint between the 2 highest doses, and the median of the dose levels. When there are <=4 doses including pbo, the medianbased contrast is excluded. 
lambdacontr 
Hill parameters matched to the ed50contr. The default value is 1 for each contrast model. 
testMods 
The model object for a MCPMOD test
created by 
idmax 
Index of the default dose group for comparison to placebo. Most analysis functions allow other dose groups to be specified. The default is the index of the highest dose. 
mcmc 
MCMC settings created using 
customCode 
An optional user supplied function that computes custom
estimates/decision criteria from each simulated data set and its Bayesian
model fit. The output are stored in a list, 
customParms 
Optional parameters that can be passed to

description 
Optional text describing the simulation setting that is stored with the simulation output. 
The Bayesian model fits are implemented in rstan
using function
fitEmaxB
. The function compileStanModels
must be
executed once to create compiled STAN
code before emaxsimB
can be used.
Continuous data can be simulated from any dose response curve with homogeneous normally distributed residuals.
Binary data are handled similarly. The models are fit on the logit scale and then backtransformed for estimation of dose response. Reduced linear models are selected based on the corresponding likelihood deviance.
MCPMOD tests are created from contrasts based on the Emax function using
the DoseFinding
package. Different
ED50 and lambda (Hill) parameters can be specified to form the contrasts. A contrast
matrix output from the DoseFinding package can be specified instead, allowing for
other contrast choices.
Customized code:
For binary data, the inputs to the function customCode for each simulated data set
will be (parms,pVal,dose,y), where parms is the matrix of parameters
generated from the posterior distribution with columns in the order given in
function emaxfun
, pVal is the MCPMOD pvalue, dose and y are
the patientlevel simulated data. For continuous data, the inputs
are (parms,residSD,pVal,dose,y), where residSD
are the variance
parameters generated from their posterior distribution. The customParms
supply other userinputs
such as a target efficacy level. When it is not null, the customCode
inputs must be (parms,pVal,dose,y,customParms) or (parms,residSD,pVal,dose,y,customParms).
A list is returned with class(emaxsim) containing:
description 
User description of simulation 
localParm 

binary 
Binary response data. 
modType 
Type of Emax model fit (3 or 4 parameters) 
genObj 
List object with data and function used to generate study data 
pop 
Matrix with rows containing population parameters for each simulation. Type of parameter depends on constructor function generating study data. 
popSD 
Vector containing the population SD used to generate
continuous data. 
mcmc 
mcmc input settings 
prior 
Input prior distribution. 
est 
Matrix with posterior median parameter estimates for each simulation:
(led50,lambda,emax,e0,difTarget) or (led50,emax,e0,difTarget). The 
estlb,estub 
Array with lower posterior (0.025,0.05,0.1) and upper posterior (0.975,0.95,0.9) percentiles of the model parameters. The array ordering is model parameters, simulation, and percentile. 
residSD 
The posterior median of the residual SD for each simulation. 
pVal 
The 
selContrast 
The index of the test contrast producing the smallest pvalue. 
testMods 
Object of class Mods from R package 
gofP 
Goodness of fit test computed by 
negEmax 
User input stored for subsequent reference. 
predpop 
Matrix with population means for each dose group 
mv 
Matrix with rows containing dose group sample means 
sdv 
Matrix with rows containing dose group sample SD 
msSat 
Pooled withindose group sample variance 
fitpredv 
Matrix with rows containing dose groups means estimated by the posterior medians of the MCMC generated values. 
sepredv 
Matrix with rows containing SE (posterior SD) associated with fitpredv 
fitdifv 
Matrix with rows containing dose groups mean differences wih placebo estimated by the posterior medians of the differences of the MCMC generated values. 
sedifv 
Matrix with rows containing SE (posterior SD) for the differences with placebo 
lb,ub 
Array with lower posterior (0.025,0.05,0.1) and upper posterior (0.975,0.95,0.9) percentiles of differences between dose group means and placebo. The array ordering is dose group minus placebo, simulation, and percentile. 
divergence 
The proportion of divergent MCMC iterations from each simulated analysis. 
rseed 
Starting random
number seed for each simulated data set set that can be assigned to 
idmax 
Index of default dose group for comparison to placebo (e.g., for plotting Zstatistics). 
customOut 
List with customized output. It will be 
The default modType was changed from 3 to 4 for clinDR version >2.0
Neal Thomas
Thomas, N., Sweeney, K., and Somayaji, V. (2014). Metaanalysis of clinical dose response in a large drug development portfolio, Statistics in Biopharmaceutical Research, Vol. 6, No.4, 302317. <doi:10.1080/19466315.2014.924876>
Thomas, N., and Roy, D. (2016). Analysis of clinical doseresponse in smallmolecule drug development: 20092014. Statistics in Biopharmaceutical Research, Vol. 6, No.4, 302317 <doi:10.1080/19466315.2016.1256229>
print.emaxsimB
,
summary.emaxsimB
, plot.emaxsimB
,
coef.emaxsimB
, sigma.emaxsimB
,
emaxfun
## Not run:
### emaxsimB changes the random number seed
nsim<50
idmax<5
doselev<c(0,5,25,50,100)
n<c(78,81,81,81,77)
Ndose<length(doselev)
### population parameters for simulation
e0<2.465375
ed50<67.481113
dtarget<100
diftarget<2.464592
emax<solveEmax(diftarget,dtarget,log(ed50),1,e0)
sdy<7.967897
pop<c(log(ed50),emax,e0)
meanlev<emaxfun(doselev,pop)
###FixedMean is specialized constructor function for emaxsim
gen<FixedMean(n,doselev,meanlev,sdy)
prior<emaxPrior.control(epmu=0,epsca=30,difTargetmu=0,
difTargetsca=30,dTarget=100,p50=50,sigmalow=0.1,
sigmaup=30,parmDF=5)
mcmc<mcmc.control(chains=1,warmup=500,iter=5000,seed=53453,
propInit=0.15,adapt_delta = 0.95)
### custom code to compute the distribution of the dose yielding
### a target diff with pbo
customCode<function(parms,residSD,pVal,dose,y,customParms){
target<customParms
ed50<exp(parms[,1])
emax<parms[,2]
td<ifelse(emaxtarget>0,ed50*(target/(emaxtarget)),Inf)
tdest<median(td)
lb<quantile(td,0.1)
ub<quantile(td,0.9)
return(c(td=tdest,lb=lb,ub=ub))
}
D1 < emaxsimB(nsim,gen, prior, modType=4,seed=12357,mcmc=mcmc,check=FALSE,
customCode=customCode,customParms=1.0)
D1
## End(Not run)