Skip to content

Commit

Permalink
Responding to CRAN review
Browse files Browse the repository at this point in the history
  • Loading branch information
PuzzledFace committed Oct 25, 2022
1 parent ac55a7f commit 406e43a
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 47 deletions.
4 changes: 2 additions & 2 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 0.1.0
Date: 2022-10-04 13:40:57 UTC
SHA: 4b7c4ca4b9938b7f463f0e5cdda0f615c02b2d18
Date: 2022-10-24 15:38:45 UTC
SHA: ac55a7f7e2e5f95cecbf60d64ecba12435523788
84 changes: 41 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# mtdesign
Expand All @@ -8,7 +9,6 @@
status](https://www.r-pkg.org/badges/version/mtdesign)](https://CRAN.R-project.org/package=mtdesign)
[![Test
Coverage](https://raw.githubusercontent.com/openpharma/mtdesign/_xml_coverage_reports/data/main/badge.svg)](https://github.com/openpharma/mtdesign/blob/_xml_coverage_reports/data/main/coverage.xml)

<!-- badges: end -->

## Introduction
Expand All @@ -34,7 +34,7 @@ You can install the development version of `mtdesign` from

## Set up vignette environment

```r
``` r
# By policy, on CRAN, use only two cores, no matter how many are available.
if (requireNamespace("parallel", quietly = TRUE)) {
maxCores <- parallel::detectCores()
Expand All @@ -51,7 +51,7 @@ interest but those with a response rate of at least 25% are worthy of
further development. A Simon’s 2-stage design to seek an efficacy signal
with a significance level of 5% and a power of 80% is required.

```r
``` r
library(mtdesign)
library(knitr)
library(dplyr)
Expand All @@ -72,7 +72,7 @@ simonDesign %>%
```

| nTotal | nStage1 | rTotal | rFutility | Type1 | Type2 | PETNull | AveSizeNull | Criterion |
| -----: | ------: | -----: | --------: | ----: | ----: | ------: | ----------: | :-------- |
|-------:|--------:|-------:|----------:|------:|------:|--------:|------------:|:----------|
| 17 | 9 | 2 | 0 | 0.047 | 0.188 | 0.63 | 12.0 | optimal |
| 16 | 12 | 2 | 0 | 0.043 | 0.199 | 0.54 | 13.8 | minimax |

Expand All @@ -83,7 +83,7 @@ the power level achieved is 100% - 18.8% = 81.2%.

The power curves for both designs are easily plotted.

```r
``` r
powerPlot(simonDesign)
```

Expand All @@ -92,7 +92,7 @@ powerPlot(simonDesign)
Obtaining the equivalent Mander & Thompson designs requires only a small
change to the calls.

```r
``` r
manderDesign <- obtainDesign(
p0 = 0.05,
p1 = 0.25,
Expand All @@ -107,14 +107,13 @@ manderDesign %>%
```

| nTotal | nStage1 | rTotal | rFutility | rSuccess | Type1 | Type2 | PETNull | PETAlt | AveSizeNull | AveSizeAlt | Criterion |
| -----: | ------: | -----: | --------: | -------: | ----: | ----: | ------: | -----: | ----------: | ---------: | :---------- |
|-------:|--------:|-------:|----------:|---------:|------:|------:|--------:|-------:|------------:|-----------:|:------------|
| 17 | 9 | 2 | 0 | 2 | 0.047 | 0.19 | 0.64 | 0.47 | 11.9 | NA | optimalNull |
| 16 | 12 | 2 | 0 | 2 | 0.043 | 0.20 | 0.56 | 0.64 | 13.8 | NA | minimaxNull |
| 17 | 9 | 2 | 0 | 2 | 0.047 | 0.19 | 0.64 | 0.47 | 11.9 | NA | optimalAlt |
| 16 | 12 | 2 | 0 | 2 | 0.043 | 0.20 | 0.56 | 0.64 | 13.8 | NA | minimaxAlt |

```r

``` r
powerPlot(manderDesign)
```

Expand All @@ -128,7 +127,7 @@ stage design is 0/9 2/17. That’s close to n<sub>1</sub> = 8, n = 16. Is
there a (slightly) sub-optimal design that has n<sub>1</sub> = 8, n =
16?

```r
``` r
x <- createGrid(p0 = 0.05, p1 = 0.25, alpha = 0.05, beta = 0.2, mander = FALSE)

y <- x %>% filter(nStage1 == 8, nTotal == 16)
Expand All @@ -147,7 +146,7 @@ if (nrow(z) == 0) {

No, there isn’t. How close can we get?

```r
``` r
z1 <- y %>% augmentGrid()

bestSize <- z1 %>%
Expand All @@ -162,13 +161,12 @@ bestSize %>%
```

| nTotal | nStage1 | rTotal | rFutility | Type1 | Type2 | PETNull | AveSizeNull |
| -----: | ------: | -----: | --------: | ----: | ----: | ------: | ----------: |
|-------:|--------:|-------:|----------:|------:|------:|--------:|------------:|
| 16 | 8 | 2 | 0 | 0.039 | 0.229 | 0.66 | 10.7 |

Best sub-optimal design with required significance level

```r

``` r
bestPower <- z1 %>%
filter(Type2 < Beta) %>%
slice_min(Type1)
Expand All @@ -182,7 +180,7 @@ bestPower %>%
```

| nTotal | nStage1 | rTotal | rFutility | Type1 | Type2 | PETNull | AveSizeNull |
| -----: | ------: | -----: | --------: | ----: | ----: | ------: | ----------: |
|-------:|--------:|-------:|----------:|------:|------:|--------:|------------:|
| 16 | 8 | 1 | 0 | 0.151 | 0.127 | 0.66 | 10.7 |

Best sub-optimal design with required power
Expand All @@ -198,7 +196,7 @@ level.
The power curve for each of these designs can be compared with that for
the globally optimal design.

```r
``` r
plotData1 <- simonDesign %>%
filter(Criterion == "optimal") %>%
bind_rows(list(bestSize, bestPower))
Expand All @@ -211,15 +209,15 @@ powerPlot(plotData1)

The `mtdesign` package consists of three main functions:

* `createGrid` creates the grid (of nStage1, rFutility, nTotal and
rTotal for Simon’s design or nStage1, rFutility, rSuccess, nTotal and
rTotal for a Mander & Thompson design) over which the brute force
search for the required design(s) is conducted
* `augmentGrid`takes a grid created by `createGrid` and adds columns for
probability of early termination, Type 1 error, Type 2 error and
expected sample size to it.
* `obtainDesign` takes an augmented grid and identifies the optimal and
minimax designs
- `createGrid` creates the grid (of nStage1, rFutility, nTotal and
rTotal for Simon’s design or nStage1, rFutility, rSuccess, nTotal
and rTotal for a Mander & Thompson design) over which the brute
force search for the required design(s) is conducted
- `augmentGrid`takes a grid created by `createGrid` and adds columns
for probability of early termination, Type 1 error, Type 2 error and
expected sample size to it.
- `obtainDesign` takes an augmented grid and identifies the optimal
and minimax designs

## Error and warning messages and logging

Expand All @@ -244,13 +242,13 @@ attempt to speed up the evaluation of candidate designs.
The `augmentGrid` function allows users some control over the
parallelisation process:

* The `parallel` parameter defaults to `TRUE` and defines whether or not
paralellisation is to be used.
* The `cores` parameter specifies how many cores are to be used. The
default value, `NA` tells `mtdesign` to use all available (as defined
by `parallel::detectCores()`), cores.
* The `minChunkSize` determines the smallest grid of candidate designs
that will trigger paralellisation. The default value is `100000`.
- The `parallel` parameter defaults to `TRUE` and defines whether or
not paralellisation is to be used.
- The `cores` parameter specifies how many cores are to be used. The
default value, `NA` tells `mtdesign` to use all available (as
defined by `parallel::detectCores()`), cores.
- The `minChunkSize` determines the smallest grid of candidate designs
that will trigger paralellisation. The default value is `100000`.

The `parallel` package is required for parallelisation. If
parallelisation is both needed (ie the grid size exceeds `minChunkSize`)
Expand All @@ -264,36 +262,36 @@ more rows, a warning is produced.
If, when installing or using the `mtdesign` package, you get an error
regarding a syntax error in an`.hpp` file, similar to the following

```r
``` r
.../BH/include/boost/math/tools/fraction.hpp:84:48: error:long doubleis not a class, struct, or union type using value_type = typename T::value_type;
```

the issue is most likely a mismatch between the g++ compiler being used
and the headers supplied by the `BH` package. There are only two
solutions that I know of:

* Upgrade g++
* Downgrade the version of the `BH` package you are using. The
appropriate package version depends on the version of the g++ compiler
you are using.
- Upgrade g++
- Downgrade the version of the `BH` package you are using. The
appropriate package version depends on the version of the g++
compiler you are using.

## References

<div id="refs" class="references csl-bib-body hanging-indent">

<div id="ref-LOGGER" class="csl-entry">

Daróczi, Gergely. 2021. _Logger: A Lightweight, Modern and Flexible
Logging Utility_. <https://daroczig.github.io/logger/>.
Daróczi, Gergely. 2021. *Logger: A Lightweight, Modern and Flexible
Logging Utility*. <https://daroczig.github.io/logger/>.

</div>

<div id="ref-MANDER" class="csl-entry">

Mander, AP, and Thompson, SG. 2010. “Two-Stage Designs Optimal Under the
Alternative Hypothesis for Phase II Cancer Clinical Trials.”
_Contemporary Clinical Trials_ 31 (6): 572–78.
<https://doi.org/><https://doi.org/10.1016/j.cct.2010.07.008>.
*Contemporary Clinical Trials* 31 (6): 572–78.
https://doi.org/<https://www.doi.org/10.1016/j.cct.2010.07.008>.

</div>

Expand All @@ -307,8 +305,8 @@ Functions.” Software. <https://CRAN.R-project.org/package=clinfun>.
<div id="ref-SIMON" class="csl-entry">

Simon, R. 1989. “Optimal Two-Stage Designs for Phase II Clinical
Trials.” _Controlled Clinical Trials_ 10 (1): 1–10.
<https://doi.org/><https://doi.org/10.1016/0197-2456(89)90015-9>.
Trials.” *Controlled Clinical Trials* 10 (1): 1–10.
https://doi.org/<https://www.doi.org/10.1016/0197-2456(89)90015-9>.

</div>

Expand Down
3 changes: 3 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## Fourth resubmission
In README.md, I have changed "https://doi.org/..." to "https://www.doi.org/...". I was confused by the request to change "http://" to "https://" since the URLs already use "https://". If the change is not what was expected, please clarify.

## Third resubmission
In DESCRIPTION, I have:
* Amended the date record to `Date: 2022-10-04`.
Expand Down
Binary file modified man/figures/README-unnamed-chunk-3-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-unnamed-chunk-4-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-unnamed-chunk-7-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions mtdesign.bib
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ @Article{SIMON
volume = {10},
number = {1},
pages = {1-10},
doi = {https://doi.org/10.1016/0197-2456(89)90015-9},
doi = {https://www.doi.org/10.1016/0197-2456(89)90015-9},
}

@Article{MANDER,
Expand All @@ -19,7 +19,7 @@ @Article{MANDER
volume = {31},
number = {6},
pages = {572-578},
doi = {https://doi.org/10.1016/j.cct.2010.07.008},
doi = {https://www.doi.org/10.1016/j.cct.2010.07.008},
}

@Misc{CLINFUN,
Expand Down

0 comments on commit 406e43a

Please sign in to comment.