Learn R Programming

DoseFinding (version 0.6-3)

calcOptDesign: Function to calculate an optimal design

Description

Given a set of models (with full parameter values and model probabilities) this function calculates the MED optimal design (see Dette, Bretz, Pepelyshev and Pinheiro (2008) for details) or the D-optimal design, or a mixture of these two criteria.

Usage

calcOptDesign(fullModels, weights, doses, clinRel = NULL,
             nold = rep(0, length(doses)), n2 = NULL,
             control = list(),  scal=1.2*max(doses),
             off=0.1*max(doses),
             type = c("MED", "Dopt", "MED&Dopt", "userCrit"),
             method = c("Nelder-Mead", "nlminb", "solnp", "exact"),
             lowbnd = rep(0, length(doses)),
             uppbnd = rep(1, length(doses)),
             standDopt = FALSE, userCrit = NULL, ...)

Arguments

fullModels
List containing all model parameters for the models (can for example be a fullMod object, see the fullMod function for details). When an MED optimal design should be calculated the MED needs to
weights
Vector of model probabilities for the models specified in fullModels.
doses
Doses available
clinRel
Clinical relevance needed for calculating "MED" and "MED&Dopt" type designs.
nold
Vector of sample sizes already allocated to the different doses.
n2
Sample size for next cohort (mandatory for method = "exact" and when any entry of nold is larger than 0).
control
List containing control parameters passed down to numerical optimization algorithms (optim, nlminb or solnp function). For type = "exact" this should be a list with possible entries maxvls1 and maxvls2, d
scal
Scal parameter for beta model
off
Offset parameter for linlog model
type
Determines which type of design to calculate. "MED&Dopt" uses both optimality criteria with equal weight.
method
Algorithm used for calculating the optimal design. Options "Nelder-Mead" and "nlminb" use the optim and nlminb function and use trigonometric functions to
lowbnd, uppbnd
Vectors of the same length as dose vector specifying upper and lower limits for the allocation weights. This option is only available when using the "solnp" optimizer.
standDopt
Logical determining, whether the D-optimality criterion (specifically the log-determinant) should be standardized by the number of parameters in the model or not (only of interest if type = "Dopt" or type = "MED&Dopt"). This is of interest, when
userCrit
User defined design criterion, should be a function that given a vector of allocation weights and the doses returns the criterion function. The first argument of userCrit should be the vector of design weights, while the second argum
...
Additional arguments for userCrit.

Details

The difference to the methodology proposed in Dette et al. (2008) is the fact that the doses are treated as fixed (and specified via doses): The design is only optimized with respect to the design weights (ie the allocation weights for the different doses).

References

Atkinson, A.C., Donev, A.N. and Tobias, R.D. (2007). Optimum Experimental Designs, with SAS, Oxford University Press Dette, H., Bretz, F., Pepelyshev, A. and Pinheiro, J. C. (2008). Optimal Designs for Dose Finding Studies, Journal of the American Statisical Association, 103, 1225--1237

See Also

calcCrit

Examples

Run this code
## first example calculate MED optimal design for one Emax model
## fullModel should be a list containing all model parameters
fMod <- list(emax = c(0, 2/3, 25)) 
doses <- c(0, 18.75, 150)
weights <- 1 # just one model
## by default calculates MED optimal design
des1 <- calcOptDesign(fMod, weights, doses, clinRel=0.2) 
des2 <- calcOptDesign(fMod, weights, doses, type = "Dopt")
des3 <- calcOptDesign(fMod, weights, doses, clinRel=0.2, type = "MED&Dopt")

## illustrating the different optimizers
des1 <- calcOptDesign(fMod, weights, doses, clinRel=0.2, method="Nelder-Mead")
des2 <- calcOptDesign(fMod, weights, doses, clinRel=0.2, method="nlminb")
des3 <- calcOptDesign(fMod, weights, doses, clinRel=0.2, method="solnp")
## assume additional constraints (only available for method = solnp)
des4 <- calcOptDesign(fMod, weights, doses, clinRel=0.2, lowbnd = rep(0.2,3),
        uppbnd = rep(0.45, 3), method="solnp")
## assume only 20 patients are to be allocated (exact calculation possible)
des5 <- calcOptDesign(fMod, weights, doses, n2 = 20, clinRel=0.2,
                      method="exact")
## assume the minimum block-size is 5
des6 <- calcOptDesign(fMod, weights, doses, n2 = 20, clinRel=0.2,
                      method="exact", control = list(blockSize = 5))


## larger candidate model set
doses <- c(0, 10, 25, 50, 100, 150)
mods <- list(linear = NULL, emax = 25, exponential = 85,
               linlog = NULL, logistic = c(50, 10.8811))
## now use fullMod function to produce the fullModel list
## from the 'usual' models list
fMod <- fullMod(mods, doses, base=0, maxEff=0.4, off=1)
weights <- rep(1/5, 5)
desMED <- calcOptDesign(fMod, weights, doses, clinRel=0.2, scal=200,
                        off=1, method = "nlminb")
desDopt <- calcOptDesign(fMod, weights, doses, scal=200, off=1, 
                         type = "Dopt")
desMix <- calcOptDesign(fMod, weights, doses, clinRel=0.2, scal=200,
                        off=1, type = "MED&Dopt")
## allocated 100 persons according to desMix design
rndDesign(desMix, 100)

################################################################################
#### using already allocated patients
mods <- list(betaMod = c(0.33, 2.31))
doses <- c(0, 0.49, 25.2, 108.07, 150)
fMod <- fullMod(mods, doses, base=0, maxEff=0.4, scal=200)
weights <- 1
## no previously allocated patients
des <- calcOptDesign(fMod, weights, doses, clinRel=0.1, scal=200,
                     control=list(maxit=1000))

## now use previously allocated patients
nold <- c(45, 50, 0, 0, 0)
des2 <- calcOptDesign(fMod, weights, doses, clinRel=0.1, n2=30, scal=200,
                      control=list(maxit=1000), nold=nold)
## the calculated overall design is the same as the 1-step design
(30*des2$design+nold)/(30+sum(nold))
des$design

## same with exact optimizer
des <- calcOptDesign(fMod, weights, doses, clinRel=0.1, scal=200,
                     control=list(blockSize = 10), n2=120, method = "exact")
nold <- c(10, 10, 0, 0, 0)
des2 <- calcOptDesign(fMod, weights, doses, clinRel=0.1, n2=100, scal=200,
                      control=list(blockSize = 10), nold=nold, method = "exact")
(des2$design*100+nold)/(100+sum(nold))


########################################################################
#### user defined criterion function (D-optimality for cubic polynomial)
CubeCrit <- function(w, doses){
  X <- cbind(1, doses, doses^2, doses^3)
  CVinv <- crossprod(X*w)
  -log(det(CVinv))
}
calcOptDesign(doses = c(0,0.05,0.2,0.6,1),
              type = "userCrit", userCrit = CubeCrit,
              method = "nlminb")

Run the code above in your browser using DataLab