Skip to content

Commit

Permalink
Merge branch 'main' into 855-add-support-for-smallestlargest-next-bes…
Browse files Browse the repository at this point in the history
…t-dose
  • Loading branch information
Puzzled-Face authored Oct 7, 2024
2 parents aefb175 + 117334a commit a3eba90
Show file tree
Hide file tree
Showing 16 changed files with 137 additions and 109 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ TODO
^Meta$
Rplots.pdf
^pkgdown$
⁠pkgdown/⁠
^data-raw$
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: crmPack
Title: Object-Oriented Implementation of CRM Designs
Version: 2.0.0.9158
Version: 2.0.0.9000
Authors@R: c(
person("Daniel", "Sabanes Bove", , "[email protected]", role = c("aut", "cre")),
person("Wai", "Yin Yeung", , "[email protected]", role = "aut"),
Expand Down Expand Up @@ -33,7 +33,8 @@ Description: Implements a wide range of model-based dose escalation
new models, escalation or stopping rules. Further details are
presented in Sabanes Bove et al. (2019) <doi:10.18637/jss.v089.i10>.
License: GPL (>= 2)
URL: https://github.com/openpharma/crmPack
URL: https://github.com/openpharma/crmPack,
https://openpharma.github.io/crmPack/
BugReports: https://github.com/openpharma/crmPack/issues
Depends:
ggplot2 (>= 2.0.0),
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Version 2.0.0.9158
# Version 2.0.0.9000
* **Note: This release (1.0 -> 2.0) signifies a major breaking revamp of the package.** Users are advised to carefully review the release notes and documentation for detailed information on the changes and any necessary updates to their existing code.
* Added `NextBestList`, `NextBestMin` and `NextBestMax` classes
* Implemented `knit_print` methods for almost all `crmPack` classes to improve rendering in Markdown and Quarto documents. See the vignette for more details.
Expand Down
4 changes: 2 additions & 2 deletions R/Data-validity.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ v_data_da <- function(object) {
}
v$check(
test_numeric(object@u, upper = object@Tmax, len = object@nObs, any.missing = FALSE) &&
all(object@u > 0),
"u must be of type double, nObs length, non-negative and not greater than Tmax"
all(object@u >= 0),
"u must be of type double, nObs length, non-negative, not missing and not greater than Tmax"
)
v$check(
test_numeric(object@t0, lower = 0, len = object@nObs, any.missing = FALSE, sorted = TRUE),
Expand Down
5 changes: 5 additions & 0 deletions _pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ navbar:
href: unit-test-report/
github:
icon: fa-github
aria-label: View on GitHub
href: https://github.com/openpharma/crmPack
cran:
icon: fab fa-r-project
href: https://cloud.r-project.org/package=crmPack
aria-label: View on CRAN

articles:
- title: Articles
Expand Down
2 changes: 1 addition & 1 deletion man/crmPackExample.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/crmPackHelp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 16 additions & 16 deletions tests/testthat/_snaps/Design-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@
result
Output
An object of class "PseudoDualSimulations"
Slot "fitEff":
Slot "fit_eff":
[[1]]
[[1]]$theta1
[1] -4.20662
Expand All @@ -619,13 +619,13 @@
Slot "FinalGstarEstimates":
Slot "final_gstar_estimates":
[1] 146.2479
Slot "FinalGstarAtDoseGrid":
Slot "final_gstar_at_dose_grid":
[1] 125
Slot "FinalGstarCIs":
Slot "final_gstar_cis":
[[1]]
[[1]]$lower
[1] 75.03531
Expand All @@ -635,16 +635,16 @@
Slot "FinalGstarRatios":
Slot "final_gstar_ratios":
[1] 3.798815
Slot "FinalOptimalDose":
Slot "final_optimal_dose":
[1] 137.5996
Slot "FinalOptimalDoseAtDoseGrid":
Slot "final_optimal_dose_at_dose_grid":
[1] 125
Slot "sigma2est":
Slot "sigma2_est":
[1] 0.1616952
Slot "fit":
Expand Down Expand Up @@ -765,7 +765,7 @@
result
Output
An object of class "PseudoDualSimulations"
Slot "fitEff":
Slot "fit_eff":
[[1]]
middle lower upper
1 -0.3079474 -0.8521410 0.08196096
Expand All @@ -782,13 +782,13 @@
12 1.6915134 1.2623492 2.22318756
Slot "FinalGstarEstimates":
Slot "final_gstar_estimates":
[1] 300
Slot "FinalGstarAtDoseGrid":
Slot "final_gstar_at_dose_grid":
[1] 225
Slot "FinalGstarCIs":
Slot "final_gstar_cis":
[[1]]
[[1]]$lower
[1] 300
Expand All @@ -798,16 +798,16 @@
Slot "FinalGstarRatios":
Slot "final_gstar_ratios":
[1] 1
Slot "FinalOptimalDose":
Slot "final_optimal_dose":
[1] 62.78087
Slot "FinalOptimalDoseAtDoseGrid":
Slot "final_optimal_dose_at_dose_grid":
[1] 50
Slot "sigma2est":
Slot "sigma2_est":
[1] 0.2648646
Slot "fit":
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-Data-validity.R
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ test_that("v_data_da: error for u of wrong length and values", {

expect_equal(
v_data_da(object),
"u must be of type double, nObs length, non-negative and not greater than Tmax" # nolintr
"u must be of type double, nObs length, non-negative, not missing and not greater than Tmax" # nolintr
)
})

Expand Down
19 changes: 11 additions & 8 deletions vignettes/crmPack-jss-paper.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ For describing the framework of the package we will adapt the general notation
for early phase trials from [@Thall2010]. Figure \@ref(fig:schematic) summarizes
the framework in a schematic.

```{r schematic, fig.align='center', out.height = "540px", out.width="700px", fig.cap='Schematic of the framework'}
```{r schematic, fig.align='center', out.height = "540px", out.width="700px", fig.cap='Schematic of the framework', fig.alt = "Schematic showing the general framework of an early phase dose escalation design.", echo = FALSE}
knitr::include_graphics("./schematic.png")
```

Expand Down Expand Up @@ -280,8 +280,11 @@ optionally in the `ID` argument. The data can then be visualized by simply apply
the `plot` function to the object, which also allows to produce a blinded plot (hiding patient
IDs and placebo/treatment assignment) with the option `blind`, see Figure \@ref(fig:plot-data):

```{r plot-data,fig.show='hold',fig.width=5,fig.height=5,out.width='.35\\linewidth',fig.align='center', fig.env='figure', fig.cap='Open and blinded data plots'}
```{r plot-data,fig.width=5,fig.height=5,out.width='.35\\linewidth',fig.align='center', fig.env='figure', fig.cap='Open and blinded data plots', fig.alt = "An unblinded graph with patient id on the x axis and dose administered on the y axis. Red triangles indicate patients who reported DLTs, black circles those who did not. Symbols are annotated with patient IDs. Vertical dashed green lines delineate cohorts."}
plot(data)
```

```{r plot-data-blind,fig.width=5,fig.height=5,out.width='.35\\linewidth',fig.align='center', fig.env='figure', fig.cap='Open and blinded data plots', fig.env='figure', fig.cap='Open and blinded data plots', fig.alt = "A blinded graph with patient id on the x axis and dose administered on the y axis. Red triangles indicate reports of DLTs, black circles indicate an absense of DLTs. However, within each cohort, patients with DLTs appear before those without. Symbols are not annotated with patient IDs. Vertical dashed green lines delineate cohorts."}
plot(data, blind = TRUE)
```

Expand All @@ -303,7 +306,7 @@ DLT rates can be obtained by supplying
the samples, model and data to the generic `plot` function. Similarly we can
also produce a similar plot without any data, which is then giving the prior, see Figure \@ref(fig:plot-model-fit):

```{r plot-model-fit,fig.show='hold',fig.width=5,fig.height=5,out.width='.35\\linewidth',fig.align='center', fig.env='figure', fig.cap='Posterior and prior regression model fits'}
```{r plot-model-fit,fig.show='hold',fig.width=5,fig.height=5,out.width='.35\\linewidth',fig.align='center', fig.env='figure', fig.cap='Posterior and prior regression model fits', fig.alt = "Prior and posterior dose-toxicity curves."}
plot(samples, model, data) + ggtitle("Posterior")
emptydata <- Data(doseGrid = data@doseGrid, placebo = TRUE)
Expand Down Expand Up @@ -346,7 +349,7 @@ nextDoseRes <- nextBest(myNextBest, nextMaxDose, samples, model, data)

The returned list also contains an accompanying plot (`nextDoseRes$plot`), see Figure \@ref(fig:nextBest-ncrm).

```{r nextBest-ncrm,echo=FALSE,fig.width=4,fig.height=4,out.width='.5\\linewidth',fig.align='center',fig.env='figure', fig.cap='Dose recommendation plot from NCRM design'}
```{r nextBest-ncrm,echo=FALSE,fig.width=4,fig.height=4,out.width='.5\\linewidth',fig.align='center',fig.env='figure', fig.cap='Dose recommendation plot from NCRM design', fig.alt = "A graphical description of the logic between the recommendation of the nextBestRes object."}
nextDoseRes$plot
```

Expand Down Expand Up @@ -417,7 +420,7 @@ mySims@data[[3]]@nObs
mySims@doses[3]
```
Furthermore, we can plot the `Simulations` object by calling the `plot` method on it, see Figure \@ref(fig:sim-plot). You can select the plots by changing the `type` argument of `plot`, which by default is `type = c("trajectory", "dosesTried")`.
```{r sim-plot, echo=FALSE, fig.width=4,fig.height=4,out.width='.5\\linewidth',fig.align='center',fig.env='figure', fig.cap='Simulation plot'}
```{r sim-plot, echo=FALSE, fig.width=4,fig.height=4,out.width='.5\\linewidth',fig.align='center',fig.env='figure', fig.cap='Simulation plot', fig.alt = "A graphical representation of the simulation results."}
plot(mySims)
```

Expand All @@ -428,7 +431,7 @@ simSum <- summary(mySims, truth = myTruth)
simSum
```
A plot of the summary results can also be produced, see Figure \@ref(fig:sim-summary-plot).
```{r sim-summary-plot, echo=FALSE, fig.width=6,fig.height=6,out.width='.6\\linewidth',fig.align='center', warning=FALSE, fig.env='figure', fig.cap='Simulation summary plot'}
```{r sim-summary-plot, echo=FALSE, fig.width=6,fig.height=6,out.width='.6\\linewidth',fig.align='center', warning=FALSE, fig.env='figure', fig.cap='Simulation summary plot', fig.alt = "A graphical representation of the information in the simulation summary."}
plot(simSum)
```

Expand Down Expand Up @@ -515,7 +518,7 @@ doseRecGain <- nextBest(GainNextBest,
```
The plot for the next dose allocation is contained in `doseRecGain$plot` and shown in Figure \@ref(fig:doseRecommendation).
\begin{figure}
```{r doseRecommendation, echo=FALSE, fig.width=7,fig.height=5,out.width='.6\\linewidth',fig.align='center'}
```{r doseRecommendation, echo=FALSE, fig.width=7,fig.height=5,out.width='.6\\linewidth',fig.align='center', fig.alt = "A graphical representation of the logic behind the recommendation of the doseResgen object."}
print(doseRecGain$plot)
```

Expand Down Expand Up @@ -682,7 +685,7 @@ Now we can already use the model, for example in the following we specify the
skeleton probabilities via the dose grid and use a standard exponential prior
for $\theta$. The resulting posterior fit can be plotted as usual,
see Figure \@ref(fig:OneParExp-model-example).
```{r OneParExp-model-example, fig.width=5,fig.height=4,out.width='.5\\linewidth',fig.align='center', fig.env='figure', fig.cap='Model fit of the one parameter power model'}
```{r OneParExp-model-example, fig.width=5,fig.height=4,out.width='.5\\linewidth',fig.align='center', fig.env='figure', fig.cap='Model fit of the one parameter power model', fig.alt = "The posterior dose-toxicity curve from the one parameter power model."}
(skeleton_probs <- round(data@doseGrid / max(data@doseGrid) / 2, 2))
newModel <- OneParExp(
skeleton_probs = skeleton_probs,
Expand Down
Loading

0 comments on commit a3eba90

Please sign in to comment.