Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Authors@R: c(
person("Daniel", "Sabanes Bove", role = "aut", email = "[email protected]",
comment = c(ORCID = "0000-0002-0176-9239")),
person(given = "Novartis Pharma AG", role = c("cph", "fnd")))
Imports: ggplot2, lattice, mvtnorm
Imports: ggplot2, lattice, mvtnorm, Rdpack
Suggests:
emmeans,
numDeriv,
Expand Down Expand Up @@ -48,3 +48,4 @@ URL: https://github.com/openpharma/DoseFinding, https://openpharma.github.io/Dos
BugReports: https://github.com/openpharma/DoseFinding/issues
Roxygen: list(markdown = TRUE)
Config/testthat/edition: 3
RdMacros: Rdpack
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ importFrom("stats", "AIC", "IQR", "acf", "approx", "as.formula",
"pnorm", "predict", "qnorm", "qt", "quantile", "quasi",
"sd", "terms", "uniroot", "var", "vcov")
importFrom("utils", "setTxtProgressBar", "txtProgressBar", "browseURL")

importFrom(Rdpack,reprompt)
export(fitMod, defBnds, bFitMod, maFitMod, MCTtest, bMCTtest, MCPMod,
betaMod, quadratic, emax, exponential,linear, linlog, logistic, sigEmax, linInt,
betaModGrad, quadraticGrad, emaxGrad, exponentialGrad,
Expand Down
4 changes: 2 additions & 2 deletions R/DesignMCPModApp.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#'
#'
#' This function starts the externally hosted DesignMCPMod Shiny App in a
#' browser window. The app was developed by Sophie Sun [aut, cre], Danyi Xiong
#' [aut], Bjoern Bornkamp [ctb], Frank Bretz [ctb], Ardalan Mirshani [ctb].
#' browser window. The app was developed by Sophie Sun \[aut, cre\], Danyi Xiong
#' \[aut\], Bjoern Bornkamp \[ctb\], Frank Bretz \[ctb\], Ardalan Mirshani \[ctb\].
#' This app performs power and sample size calculations for a multiple contrast
#' test for normal, binary and negative binomial outcomes. The app uses the
#' DoseFinding package as calculation backend and the R code underlying the
Expand Down
56 changes: 18 additions & 38 deletions R/DoseFinding-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,23 @@
#' **MCPMod**: Performs MCPMod methodology\cr
#' **sampSize**: General function for sample size calculation\cr
#'
#' @references Bornkamp, B., Bretz, F., Dette, H. and Pinheiro, J. C. (2011).
#' Response-Adaptive Dose-Finding under model uncertainty, *Annals of
#' Applied Statistics*, **5**, 1611--1631
#' @references
#' \insertRef{bornkamp2011}{DoseFinding}
#'
#' Bornkamp B., Pinheiro J. C., and Bretz, F. (2009). MCPMod: An R Package for
#' the Design and Analysis of Dose-Finding Studies, *Journal of
#' Statistical Software*, **29**(7), 1--23
#' \insertRef{bornkamp2009}{DoseFinding}
#'
#' Bretz, F., Pinheiro, J. C., and Branson, M. (2005), Combining multiple
#' comparisons and modeling techniques in dose-response studies,
#' *Biometrics*, **61**, 738--748
#' \insertRef{bretz2005}{DoseFinding}
#'
#' 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
#' \insertRef{dette2008}{DoseFinding}
#'
#' O'Quigley, J., Iasonos, A. and Bornkamp, B. (2017) Handbook of methods for
#' designing, monitoring, and analyzing dose-finding trials, CRC press, Part 3:
#' Dose-Finding Studies in Phase II
#' \insertRef{oquigley2017}{DoseFinding}
#'
#' Pinheiro, J. C., Bornkamp, B., and Bretz, F. (2006). Design and analysis of
#' dose finding studies combining multiple comparisons and modeling procedures,
#' *Journal of Biopharmaceutical Statistics*, **16**, 639--656
#' \insertRef{pinheiro2006}{DoseFinding}
#'
#' Pinheiro, J. C., Bornkamp, B., Glimm, E. and Bretz, F. (2014) Model-based
#' dose finding under model uncertainty using general parametric models,
#' *Statistics in Medicine*, **33**, 1646--1661
#' \insertRef{pinheiro2014}{DoseFinding}
#'
#' \insertRef{seber2003}{DoseFinding}
#'
#' Seber, G.A.F. and Wild, C.J. (2003). Nonlinear Regression, Wiley
#' @keywords internal
#' @examples
#'
#' data(IBScovars)
Expand Down Expand Up @@ -211,13 +198,11 @@
#' @return Response value for model functions or matrix containing the gradient
#' evaluations.
#' @seealso [fitMod()]
#' @references MacDougall, J. (2006). Analysis of dose-response studies - Emax
#' model,*in* N. Ting (ed.), *Dose Finding in Drug Development*,
#' Springer, New York, pp. 127--145
#' @references
#' \insertRef{macdougall2006}{DoseFinding}
#'
#' \insertRef{pinheiro2006}{DoseFinding}
#'
#' Pinheiro, J. C., Bretz, F. and Branson, M. (2006). Analysis of dose-response
#' studies - modeling approaches, *in* N. Ting (ed.). *Dose Finding
#' in Drug Development*, Springer, New York, pp. 146--171
#' @examples
#'
#' ## some quadratic example shapes
Expand Down Expand Up @@ -268,7 +253,7 @@ NULL
#' Biometrics Dose Response data
#'
#' An example data set for dose response studies. This data set was used in
#' Bretz et al. (2005) to illustrate the MCPMod methodology.
#' \insertCite{bretz2005;textual}{DoseFinding} to illustrate the MCPMod methodology.
#'
#' @name biom
#' @docType data
Expand All @@ -278,9 +263,7 @@ NULL
#' \item{`resp`}{a numeric vector containing the response values}
#' \item{`dose`}{a numeric vector containing the dose values}
#' }
#' @source Bretz, F., Pinheiro, J. C., and Branson, M. (2005), Combining
#' multiple comparisons and modeling techniques in dose-response studies,
#' *Biometrics*, **61**, 738--748
#' @source \insertRef{bretz2005}{DoseFinding}
#' @keywords datasets
NULL

Expand Down Expand Up @@ -360,8 +343,7 @@ NULL
#' \item{`dose`}{a numeric vector}
#' \item{`resp`}{a numeric vector}
#' }
#' @source Biesheuvel, E. and Hothorn, L. A. (2002). Many-to-one comparisons in
#' stratified designs, *Biometrical Journal*, **44**, 101--116
#' @source \insertRef{biesheuvel2002}{DoseFinding}
#' @keywords datasets
NULL

Expand Down Expand Up @@ -426,9 +408,7 @@ NULL
#' \item{`id`}{Patient ID}
#' \item{`time`}{time of measurement}
#' }
#' @source Pinheiro, J. C., Bornkamp, B., Glimm, E. and Bretz, F. (2014)
#' Model-based dose finding under model uncertainty using general parametric
#' models, *Statistics in Medicine*, **33**, 1646--1661
#' @source \insertRef{pinheiro2014}{DoseFinding}
#' @keywords datasets
#' @examples
#'
Expand Down
46 changes: 20 additions & 26 deletions R/MCPMod.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#'
#' Tests for a dose-response effect using a model-based multiple contrast test (see [MCTtest()]), selects one
#' (or several) model(s) from the significant shapes, fits them using [fitMod()]. For details on the method
#' see Bretz et al. (2005).
#' see \insertCite{bretz2005;textual}{DoseFinding}.
#'
#'
#' @aliases MCPMod predict.MCPMod plot.MCPMod
Expand All @@ -17,7 +17,7 @@
#' \item `aveAIC`: Uses a weighted average of the models corresponding to
#' the significant contrasts. The model weights are chosen by the formula:
#' \eqn{w_i = \exp(-0.5AIC_i)/\sum_i(\exp(-0.5AIC_i))}{w_i =
#' exp(-0.5AIC_i)/sum(exp(-0.5AIC_i))} See Buckland et al. (1997) for details.
#' exp(-0.5AIC_i)/sum(exp(-0.5AIC_i))} See \insertCite{buckland1997;textual}{DoseFinding} for details.
#' } For \samp{type = "general"} the "gAIC" is used.
#' @param df Specify the degrees of freedom to use in case \samp{type = "general"}, for the call to
#' [MCTtest()] and [fitMod()]. Infinite degrees of (\samp{df=Inf}) correspond to the multivariate
Expand All @@ -44,30 +44,24 @@
#' objects and additional information (model selection criteria, dose estimates, selected models).
#' @author Bjoern Bornkamp
#' @seealso [MCTtest()], [fitMod()], [drmodels()]
#' @references Bretz, F., Pinheiro, J. C., and Branson, M. (2005), Combining multiple comparisons and modeling
#' techniques in dose-response studies, *Biometrics*, **61**, 738--748
#'
#' Pinheiro, J. C., Bornkamp, B., and Bretz, F. (2006). Design and analysis of dose finding studies combining multiple
#' comparisons and modeling procedures, *Journal of Biopharmaceutical Statistics*, **16**, 639--656
#'
#' Pinheiro, J. C., Bretz, F., and Branson, M. (2006). Analysis of dose-response studies - modeling approaches,
#' *in* N. Ting (ed.). *Dose Finding in Drug Development*, Springer, New York, pp. 146--171
#'
#' Pinheiro, J. C., Bornkamp, B., Glimm, E. and Bretz, F. (2014) Model-based dose finding under model uncertainty
#' using general parametric models, *Statistics in Medicine*, **33**, 1646--1661
#'
#' Schorning, K., Bornkamp, B., Bretz, F., & Dette, H. (2016). Model selection
#' versus model averaging in dose finding studies. *Statistics in
#' Medicine*, **35**, 4021--4040
#'
#' Xun, X. and Bretz, F. (2017) The MCP-Mod methodology: Practical Considerations and The DoseFinding R package, in
#' O'Quigley, J., Iasonos, A. and Bornkamp, B. (eds) Handbook of methods for designing, monitoring, and analyzing
#' dose-finding trials, CRC press
#'
#' Buckland, S. T., Burnham, K. P. and Augustin, N. H. (1997). Model selection an integral part of inference,
#' *Biometrics*, **53**, 603--618
#'
#' Seber, G.A.F. and Wild, C.J. (2003). Nonlinear Regression, Wiley.
#' @references
#'
#' \insertRef{buckland1997}{DoseFinding}
#'
#' \insertRef{bretz2005}{DoseFinding}
#'
#' \insertRef{pinheiro2006b}{DoseFinding}
#'
#' \insertRef{pinheiro2006}{DoseFinding}
#'
#' \insertRef{pinheiro2014}{DoseFinding}
#'
#' \insertRef{schorning2016}{DoseFinding}
#'
#' \insertRef{seber2003}{DoseFinding}
#'
#' \insertRef{xun2017}{DoseFinding}
#'
#' @examples
#'
#' data(biom)
Expand Down
16 changes: 7 additions & 9 deletions R/MCTtest.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#' @param S The covariance matrix of \samp{resp} when \samp{type = "general"}, see Description.
#' @param type Determines whether inference is based on an ANCOVA model under a homoscedastic normality assumption (when
#' \samp{type = "normal"}), or estimates at the doses and their covariance matrix and degrees of freedom are specified
#' directly in \samp{resp}, \samp{S} and \samp{df}. See also [fitMod()] and Pinheiro et al. (2014).
#' directly in \samp{resp}, \samp{S} and \samp{df}. See also [fitMod()] and \insertCite{pinheiro2014}{DoseFinding}.
#' @param addCovars Formula specifying additive linear covariates (for \samp{type = "normal"})
#' @param placAdj Logical, if true, it is assumed that placebo-adjusted
#' estimates are specified in \samp{resp} (only possible for \samp{type =
Expand All @@ -46,11 +46,11 @@
#' @return An object of class MCTtest, a list containing the output.
#' @author Bjoern Bornkamp
#' @seealso [powMCT()], [optContr()]
#' @references Hothorn, T., Bretz, F., and Westfall, P. (2008). Simultaneous Inference in General Parametric Models,
#' *Biometrical Journal*, **50**, 346--363
#'
#' Pinheiro, J. C., Bornkamp, B., Glimm, E. and Bretz, F. (2014) Model-based dose finding under model uncertainty
#' using general parametric models, *Statistics in Medicine*, **33**, 1646--1661
#' @references
#' \insertRef{hothorn2008}{DoseFinding}
#'
#' \insertRef{pinheiro2014}{DoseFinding}
#'
#' @examples
#'
#' ## example without covariates
Expand Down Expand Up @@ -278,9 +278,7 @@ critVal <- function(corMat, alpha = 0.025, df = NULL,
#' @return Numeric containing the calculated p-values.
#' @author Bjoern Bornkamp
#' @seealso [MCTtest()], [optContr()]
#' @references Pinheiro, J. C., Bornkamp, B., and Bretz, F. (2006). Design and analysis of dose finding studies
#' combining multiple comparisons and modeling procedures, *Journal of Biopharmaceutical Statistics*, **16**,
#' 639--656
#' @references \insertRef{pinheiro2006b}{DoseFinding}
#' @examples
#' data(biom)
#' ## define shapes for which to calculate optimal contrasts
Expand Down
4 changes: 1 addition & 3 deletions R/Mods.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@
#' derived linear parameters (based on \samp{"placEff"} and \samp{"maxEff"}) in a list.
#' @author Bjoern Bornkamp
#' @seealso [Mods()], [drmodels()], [optDesign()], [powMCT()]
#' @references Pinheiro, J. C., Bornkamp, B., and Bretz, F. (2006). Design and analysis of dose finding studies
#' combining multiple comparisons and modeling procedures, *Journal of Biopharmaceutical Statistics*, **16**,
#' 639--656
#' @references \insertRef{pinheiro2006b}{DoseFinding}
#' @examples
#'
#' ## Example on how to specify candidate models
Expand Down
5 changes: 3 additions & 2 deletions R/bFitMod.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#' assumed, and a large number of samples is drawn from this distribution. For each draw the fitMod function with
#' \samp{type = "general"} is used to fit the draws from the multivariate normal distribution.
#'
#' Componentwise univariate slice samplers are implemented (see Neal, 2003) to sample from the posterior distribution.
#' Componentwise univariate slice samplers are implemented \insertCite{@see @neal2003}{DoseFinding}
#' to sample from the posterior distribution.
#'
#' @aliases bFitMod coef.bFitMod predict.bFitMod plot.bFitMod
#' @param dose Numeric specifying the dose variable.
Expand Down Expand Up @@ -54,7 +55,7 @@
#' additional information on the fitted model.
#' @author Bjoern Bornkamp
#' @seealso [fitMod()]
#' @references Neal, R. M. (2003), Slice sampling, Annals of Statistics, 31, 705-767
#' @references \insertAllCited{}
#' @examples
#' data(biom)
# ## produce first stage fit (using dose as factor)
Expand Down
11 changes: 5 additions & 6 deletions R/bMCTtest.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#' Performs Bayesian multiple contrast test
#'
#' This function performs a Bayesian multiple contrast test using normal mixture priors for the response on each dose,
#' as proposed in Fleischer et al. (2022). For a general description of the multiple contrast test see
#' as proposed in \insertCite{fleischer2022;textual}{DoseFinding}. For a general description of the multiple contrast test see
#' [MCTtest()].
#'
#' If \samp{type = "normal"}, an ANCOVA model based on a homoscedastic normality assumption is fitted and posteriors for
#' dose-response and contrast vectors are obtained assuming a known variance.
#'
#' For \samp{type = "general"} it is assumed multivariate normally distributed estimates are specified in \samp{resp}
#' with covariance given by \samp{S}, which define the likelihood. Posteriors for dose-response and contrast vectors
#' with covariance given by \samp{S}, which define the likelihood. Posteriors for dose-response and contrast vectors
#' are then obtained assuming a known covariance matrix S
#'
#' The multiple contrast test decision is based on the maximum posterior probability of a contrast being greater than
Expand All @@ -17,7 +17,7 @@
#' contrast test if uninformative priors are used.
#'
#' For the default calculation of optimal contrasts the prior information is ignored (i.e. contrasts are calculated in
#' the same way as in [MCTtest()]). Fleischer et al. (2022) discuss using contrasts that take the prior
#' the same way as in [MCTtest()]). \insertCite{fleischer2022;textual}{DoseFinding} discuss using contrasts that take the prior
#' effective sample sizes into account, which can be slightly more favourable for the Bayesian MCT test. Such
#' alternative contrasts can be directly handed over via the \samp{contMat} argument.
#'
Expand Down Expand Up @@ -45,8 +45,7 @@
#' @author Marius Thomas
#' @export
#' @seealso [MCTtest()], [optContr()]
#' @references Fleischer, F., Bossert, S., Deng, Q., Loley, C. and Gierse, J. (2022). Bayesian MCP-Mod,
#' *Pharmaceutical Statistics*, **21**, 654--670
#' @references \insertAllCited{}
#' @examples
#'
#'
Expand Down Expand Up @@ -277,7 +276,7 @@ print.bMCTtest <- function(x, digits = 3, eps = 1e-3, ...){
#' @return Returns a posterior multivariate normal mixture as a list of length 3, containing mixture weights, mean
#' vectors and covariance matrices.
#' @author Marius Thomas
#' @references Bernardo, J. M., and Smith, A. F. (1994). Bayesian theory. John Wiley & Sons.
#' @references \insertRef{bernardo1994}{DoseFinding}
#' @export
mvpostmix <- function(priormix, mu_hat, S_hat)
{
Expand Down
16 changes: 7 additions & 9 deletions R/fitMod.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ defBnds <- function(mD, emax = c(0.001, 1.5)*mD,
#' estimates obtained in a first stage fit, then \samp{resp} contains the estimates and \samp{S} is the estimated
#' covariance matrix for the estimates in \samp{resp}. Statistical inference (e.g. confidence intervals) rely on
#' asymptotic normality of the first stage estimates, which makes this method of interest only for sufficiently large
#' sample size for the first stage fit. A modified model-selection criterion can be applied to these model fits (see
#' also Pinheiro et al. 2014 for details).
#' sample size for the first stage fit. A modified model-selection criterion can be applied to these model fits
#' \insertCite{@see also @pinheiro2014 for details}{DoseFinding}.
#'
#' For details on the implemented numerical optimizer see the Details section below.
#'
Expand All @@ -60,9 +60,8 @@ defBnds <- function(mD, emax = c(0.001, 1.5)*mD,
#' grid-search (with the grid size specified via \samp{control$gridSize}), or can directly be handed over via
#' \samp{start}.
#'
#' For details on the asymptotic approximation used for \samp{type = "normal"}, see Seber and Wild (2003, chapter 5).
#' For details on the asymptotic approximation used for \samp{type = "general"}, and the gAIC, see Pinheiro et al.
#' (2014).
#' For details on the asymptotic approximation used for \samp{type = "normal"}, see \insertCite{seber2003;textual}{DoseFinding}, Chapter 5.
#' For details on the asymptotic approximation used for \samp{type = "general"}, and the gAIC, see \insertCite{pinheiro2014;textual}{DoseFinding}.
#'
#' @aliases fitMod coef.DRMod vcov.DRMod predict.DRMod plot.DRMod logLik.DRMod AIC.DRMod gAIC gAIC.DRMod
#' @param dose,resp Either vectors of equal length specifying dose and response values, or names of variables in the
Expand All @@ -76,7 +75,7 @@ defBnds <- function(mD, emax = c(0.001, 1.5)*mD,
#' the first stage fit.
#' @param type Determines whether inference is based on an ANCOVA model under a homoscedastic normality assumption (when
#' \samp{type = "normal"}), or estimates at the doses and their covariance matrix and degrees of freedom are specified
#' directly in \samp{resp}, \samp{S} and \samp{df}. See also the Description above and Pinheiro et al. (2014).
#' directly in \samp{resp}, \samp{S} and \samp{df}. See also the Description above and \insertCite{pinheiro2014;textual}{DoseFinding}.
#' @param addCovars Formula specifying additional additive linear covariates (only for \samp{type = "normal"})
#' @param placAdj Logical, if true, it is assumed that placebo-adjusted
#' estimates are specified in \samp{resp} (only possible for \samp{type =
Expand Down Expand Up @@ -109,10 +108,9 @@ defBnds <- function(mD, emax = c(0.001, 1.5)*mD,
#' residual sum of squares (or generalized residual sum of squares),
#' @author Bjoern Bornkamp
#' @seealso [defBnds()], [drmodels()]
#' @references Pinheiro, J. C., Bornkamp, B., Glimm, E. and Bretz, F. (2014) Model-based dose finding under model
#' uncertainty using general parametric models, *Statistics in Medicine*, **33**, 1646--1661
#' @references
#' \insertAllCited{}
#'
#' Seber, G.A.F. and Wild, C.J. (2003). Nonlinear Regression, Wiley.
#' @examples
#'
#' ## Fit the emax model to the IBScovars data set
Expand Down
Loading