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
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ S3method(plot, Mods)
S3method(AIC, DRMod)
S3method(gAIC, DRMod)
S3method(logLik, DRMod)
S3method(gAIC, DRMod)

S3method(predict, bFitMod)
S3method(plot, bFitMod)
Expand Down
5 changes: 2 additions & 3 deletions R/DoseFinding-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ NULL
#' @docType data
#' @usage data(glycobrom)
#' @format A data frame with 5 summary estimates (one per dose). Variables:
#' A data frame with 5 summary estimates (one per dose). Variables:
#' \describe{
#' \item{`dose`}{a numeric vector containing the dose values}
#' \item{`fev1`}{a numeric vector containing the least square
Expand Down Expand Up @@ -337,7 +336,7 @@ NULL
#' @docType data
#' @usage data(IBScovars)
#' @format
#' A data frame with 369 observations on the following 2 variables.
#' A data frame with 369 observations on the following 3 variables.
#' \describe{
#' \item{`gender`}{a factor specifying the gender}
#' \item{`dose`}{a numeric vector}
Expand All @@ -360,7 +359,7 @@ NULL
#' @docType data
#' @usage data(migraine)
#' @format
#' A data frame with 517 columns corresponding to the patients that
#' A data frame with 8 rows (one per dose group) summarizing 517 patients that
#' completed the trial
#' \describe{
#' \item{`dose`}{a numeric vector containing the dose values}
Expand Down
6 changes: 3 additions & 3 deletions R/Mods_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ checkEntries <- function(modL, doses, fullMod){
stop("For model ", nam, ", model entry needs to be equal to NULL")
if((nam %in% c("emax", "sigEmax", "betaMod", "logistic", "exponential")) & any(pars <= 0))
stop("For model ", nam, " model entries needs to be positive")
if((nam %in% c("emax", "exponential", "quadratic")) & is.matrix(nam))
stop("For model ", nam, " parameters need to specified in a vector")
if((nam %in% c("emax", "exponential", "quadratic")) & is.matrix(pars))
stop("For model ", nam, " parameters need to be specified in a vector")
if((nam %in% c("sigEmax", "betaMod", "logistic"))){
if(is.matrix(pars)){
if(ncol(pars) != 2)
Expand Down Expand Up @@ -776,4 +776,4 @@ getModNams <- function(parList){
mod_nams[i] <- sprintf("linInt (%s)", paste0(parList[[i]], collapse=","))
}
mod_nams
}
}
2 changes: 1 addition & 1 deletion R/bFitMod.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ bFitMod <- function(dose, resp, model, S, placAdj = FALSE,
MCMCcontrol = list(), control = NULL, bnds,
addArgs = NULL){
if(placAdj & model %in% c("linlog", "logistic"))
stop("logistic and linlog models can only be fitted with placAdj")
stop("logistic and linlog models cannot be fitted to placebo adjusted data")
nD <- length(dose)
if (length(resp) != nD)
stop("dose and resp need to be of the same size")
Expand Down
2 changes: 1 addition & 1 deletion R/fitMod_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fit.control <- function(control){
if(ind){
stop("gridSize list needs to have names dim1 and dim2")
} else {
if(!is.numeric(control$gridSize$dim1) | !is.numeric(control$gridSize$dim1))
if(!is.numeric(control$gridSize$dim1) | !is.numeric(control$gridSize$dim2))
stop("gridSize$dim1 and gridSize$dim2 need to be numeric")
}
}
Expand Down
4 changes: 4 additions & 0 deletions R/guesst.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ guesst <- function(d, p, model = c("emax", "exponential", "logistic", "quadratic
(logistic(Maxd,0,1,par[1],par[2])-e0)-p)^2)
}
res <- try(optim(par=res, fn=foolog, d=d, p=p, Maxd=Maxd))
if(inherits(res, "try-error"))
stop("cannot find guesstimates for specified values")
if(res$convergence > 0)
stop("cannot find guesstimates for specified values")
else res <- res$par
Expand Down Expand Up @@ -196,6 +198,8 @@ guesst <- function(d, p, model = c("emax", "exponential", "logistic", "quadratic
sigEmax(Maxd,0,1,par[1],par[2])-p)^2)
}
res <- try(optim(par=res, fn=fooSE, d=d, p=p, Maxd=Maxd))
if(inherits(res, "try-error"))
stop("cannot find guesstimates for specified values")
if(res$convergence > 0)
stop("cannot find guesstimates for specified values")
else res <- res$par
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-bFitMod.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test_that("bFitMod handles placebo adjustment appropriately", {
prior <- list(norm = c(0, 10), norm = c(0, 100))
expect_error(bFitMod(dose = doses, resp = drFit, model = "linlog", S = S,
placAdj = TRUE, type = "Bayes", nSim = 100, prior = prior),
"logistic and linlog models can only be fitted with placAdj")
"logistic and linlog models cannot be fitted to placebo adjusted data")
})

test_that("bFitMod correctly handles 'linInt' model", {
Expand Down Expand Up @@ -106,4 +106,4 @@ test_that("appropriate methods for bFitMod are defined", {
expect_true("predict.bFitMod" %in% methods("predict"))
expect_true("plot.bFitMod" %in% methods("plot"))
expect_true("coef.bFitMod" %in% methods("coef"))
})
})
4 changes: 0 additions & 4 deletions vignettes/faq.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ vignette: >
---


<!-- TODO:
- [ ] Links to other vignettes and help pages (Ludger)
-->

```{css, echo=FALSE}
h2 {
font-size: 20px;
Expand Down
5 changes: 2 additions & 3 deletions vignettes/mult_regimen.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ plot_estimates <- function(est) {
ggplot(df, aes(daily_dose, mu_hat)) + geom_point() +
geom_errorbar(aes(ymin = lb, ymax = ub)) +
facet_wrap(vars(regimen), labeller = label_both) +
xlab("daily dose") + ylab("percent body weight cange") +
labs(title = "ANOVA estimates with 95% confindence intervals")
xlab("daily dose") + ylab("percent body weight change") +
labs(title = "ANOVA estimates with 95% confidence intervals")
}

est <- example_estimates()
Expand Down Expand Up @@ -169,7 +169,6 @@ We also need to calculate the test statistics by hand.
mct_test <- function(cont_mat, est) {
cont_cov <- t(cont_mat) %*% est$S_hat %*% cont_mat
t_stat <- drop(est$mu_hat %*% cont_mat) / sqrt(diag(cont_cov))
# FIXME: calling non-exported function
p <- MCTpval(contMat = cont_mat, corMat = cov2cor(cont_cov),
df=Inf, tStat=t_stat, alternative = "one.sided")
ord <- rev(order(t_stat))
Expand Down
Loading