Skip to content

Commit fefc21c

Browse files
authored
fix several minor issues (#48)
1 parent 9f06fa6 commit fefc21c

9 files changed

Lines changed: 15 additions & 18 deletions

File tree

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ S3method(plot, Mods)
4444
S3method(AIC, DRMod)
4545
S3method(gAIC, DRMod)
4646
S3method(logLik, DRMod)
47-
S3method(gAIC, DRMod)
4847

4948
S3method(predict, bFitMod)
5049
S3method(plot, bFitMod)

R/DoseFinding-package.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ NULL
284284
#' @docType data
285285
#' @usage data(glycobrom)
286286
#' @format A data frame with 5 summary estimates (one per dose). Variables:
287-
#' A data frame with 5 summary estimates (one per dose). Variables:
288287
#' \describe{
289288
#' \item{`dose`}{a numeric vector containing the dose values}
290289
#' \item{`fev1`}{a numeric vector containing the least square
@@ -337,7 +336,7 @@ NULL
337336
#' @docType data
338337
#' @usage data(IBScovars)
339338
#' @format
340-
#' A data frame with 369 observations on the following 2 variables.
339+
#' A data frame with 369 observations on the following 3 variables.
341340
#' \describe{
342341
#' \item{`gender`}{a factor specifying the gender}
343342
#' \item{`dose`}{a numeric vector}
@@ -360,7 +359,7 @@ NULL
360359
#' @docType data
361360
#' @usage data(migraine)
362361
#' @format
363-
#' A data frame with 517 columns corresponding to the patients that
362+
#' A data frame with 8 rows (one per dose group) summarizing 517 patients that
364363
#' completed the trial
365364
#' \describe{
366365
#' \item{`dose`}{a numeric vector containing the dose values}

R/Mods_helpers.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ checkEntries <- function(modL, doses, fullMod){
6666
stop("For model ", nam, ", model entry needs to be equal to NULL")
6767
if((nam %in% c("emax", "sigEmax", "betaMod", "logistic", "exponential")) & any(pars <= 0))
6868
stop("For model ", nam, " model entries needs to be positive")
69-
if((nam %in% c("emax", "exponential", "quadratic")) & is.matrix(nam))
70-
stop("For model ", nam, " parameters need to specified in a vector")
69+
if((nam %in% c("emax", "exponential", "quadratic")) & is.matrix(pars))
70+
stop("For model ", nam, " parameters need to be specified in a vector")
7171
if((nam %in% c("sigEmax", "betaMod", "logistic"))){
7272
if(is.matrix(pars)){
7373
if(ncol(pars) != 2)
@@ -776,4 +776,4 @@ getModNams <- function(parList){
776776
mod_nams[i] <- sprintf("linInt (%s)", paste0(parList[[i]], collapse=","))
777777
}
778778
mod_nams
779-
}
779+
}

R/bFitMod.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ bFitMod <- function(dose, resp, model, S, placAdj = FALSE,
122122
MCMCcontrol = list(), control = NULL, bnds,
123123
addArgs = NULL){
124124
if(placAdj & model %in% c("linlog", "logistic"))
125-
stop("logistic and linlog models can only be fitted with placAdj")
125+
stop("logistic and linlog models cannot be fitted to placebo adjusted data")
126126
nD <- length(dose)
127127
if (length(resp) != nD)
128128
stop("dose and resp need to be of the same size")

R/fitMod_helpers.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fit.control <- function(control){
2020
if(ind){
2121
stop("gridSize list needs to have names dim1 and dim2")
2222
} else {
23-
if(!is.numeric(control$gridSize$dim1) | !is.numeric(control$gridSize$dim1))
23+
if(!is.numeric(control$gridSize$dim1) | !is.numeric(control$gridSize$dim2))
2424
stop("gridSize$dim1 and gridSize$dim2 need to be numeric")
2525
}
2626
}

R/guesst.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ guesst <- function(d, p, model = c("emax", "exponential", "logistic", "quadratic
148148
(logistic(Maxd,0,1,par[1],par[2])-e0)-p)^2)
149149
}
150150
res <- try(optim(par=res, fn=foolog, d=d, p=p, Maxd=Maxd))
151+
if(inherits(res, "try-error"))
152+
stop("cannot find guesstimates for specified values")
151153
if(res$convergence > 0)
152154
stop("cannot find guesstimates for specified values")
153155
else res <- res$par
@@ -196,6 +198,8 @@ guesst <- function(d, p, model = c("emax", "exponential", "logistic", "quadratic
196198
sigEmax(Maxd,0,1,par[1],par[2])-p)^2)
197199
}
198200
res <- try(optim(par=res, fn=fooSE, d=d, p=p, Maxd=Maxd))
201+
if(inherits(res, "try-error"))
202+
stop("cannot find guesstimates for specified values")
199203
if(res$convergence > 0)
200204
stop("cannot find guesstimates for specified values")
201205
else res <- res$par

tests/testthat/test-bFitMod.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test_that("bFitMod handles placebo adjustment appropriately", {
4545
prior <- list(norm = c(0, 10), norm = c(0, 100))
4646
expect_error(bFitMod(dose = doses, resp = drFit, model = "linlog", S = S,
4747
placAdj = TRUE, type = "Bayes", nSim = 100, prior = prior),
48-
"logistic and linlog models can only be fitted with placAdj")
48+
"logistic and linlog models cannot be fitted to placebo adjusted data")
4949
})
5050

5151
test_that("bFitMod correctly handles 'linInt' model", {
@@ -106,4 +106,4 @@ test_that("appropriate methods for bFitMod are defined", {
106106
expect_true("predict.bFitMod" %in% methods("predict"))
107107
expect_true("plot.bFitMod" %in% methods("plot"))
108108
expect_true("coef.bFitMod" %in% methods("coef"))
109-
})
109+
})

vignettes/faq.Rmd

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ vignette: >
1414
---
1515

1616

17-
<!-- TODO:
18-
- [ ] Links to other vignettes and help pages (Ludger)
19-
-->
20-
2117
```{css, echo=FALSE}
2218
h2 {
2319
font-size: 20px;

vignettes/mult_regimen.Rmd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ plot_estimates <- function(est) {
100100
ggplot(df, aes(daily_dose, mu_hat)) + geom_point() +
101101
geom_errorbar(aes(ymin = lb, ymax = ub)) +
102102
facet_wrap(vars(regimen), labeller = label_both) +
103-
xlab("daily dose") + ylab("percent body weight cange") +
104-
labs(title = "ANOVA estimates with 95% confindence intervals")
103+
xlab("daily dose") + ylab("percent body weight change") +
104+
labs(title = "ANOVA estimates with 95% confidence intervals")
105105
}
106106
107107
est <- example_estimates()
@@ -169,7 +169,6 @@ We also need to calculate the test statistics by hand.
169169
mct_test <- function(cont_mat, est) {
170170
cont_cov <- t(cont_mat) %*% est$S_hat %*% cont_mat
171171
t_stat <- drop(est$mu_hat %*% cont_mat) / sqrt(diag(cont_cov))
172-
# FIXME: calling non-exported function
173172
p <- MCTpval(contMat = cont_mat, corMat = cov2cor(cont_cov),
174173
df=Inf, tStat=t_stat, alternative = "one.sided")
175174
ord <- rev(order(t_stat))

0 commit comments

Comments
 (0)