diff -Nru adaptr-1.3.1/debian/changelog adaptr-1.3.2/debian/changelog --- adaptr-1.3.1/debian/changelog 2023-06-02 03:06:05.000000000 +0000 +++ adaptr-1.3.2/debian/changelog 2023-08-30 03:12:34.000000000 +0000 @@ -1,15 +1,22 @@ -adaptr (1.3.1-1cran1.2004.0) focal; urgency=medium +adaptr (1.3.2-1cran1.2004.0) focal; urgency=medium * Compilation for Ubuntu 20.04.6 LTS * Build for c2d4u for R 4.0.0 plus * Focal only build amd64 packages for Launchpad - -- Michael Rutter Fri, 02 Jun 2023 03:06:05 +0000 + -- Michael Rutter Wed, 30 Aug 2023 03:12:34 +0000 + +adaptr (1.3.2-1cran1) testing; urgency=low + + * cran2deb svn: 362M with DB version 1. + + -- cran2deb4ubuntu Sun, 27 Aug 2023 03:22:06 -0400 + adaptr (1.3.1-1cran1) testing; urgency=low * cran2deb svn: 362M with DB version 1. - -- cran2deb4ubuntu Mon, 29 May 2023 10:52:10 -0400 + -- cran2deb4ubuntu Mon, 29 May 2023 10:52:21 -0400 diff -Nru adaptr-1.3.1/DESCRIPTION adaptr-1.3.2/DESCRIPTION --- adaptr-1.3.1/DESCRIPTION 2023-05-02 13:30:03.000000000 +0000 +++ adaptr-1.3.2/DESCRIPTION 2023-08-21 12:10:04.000000000 +0000 @@ -1,7 +1,7 @@ Package: adaptr Title: Adaptive Trial Simulator -Version: 1.3.1 -Date: 2023-05-02 +Version: 1.3.2 +Date: 2023-08-21 Authors@R: c(person("Anders", "Granholm", email = "andersgran@gmail.com", @@ -36,7 +36,7 @@ Suggests: ggplot2, covr, rmarkdown, knitr, testthat, vdiffr VignetteBuilder: knitr Config/testthat/edition: 3 -Packaged: 2023-05-02 12:54:23 UTC; agra0037 +Packaged: 2023-08-21 11:52:50 UTC; agra0037 Author: Anders Granholm [aut, cre] (), Benjamin Skov Kaas-Hansen [aut] (), @@ -44,4 +44,4 @@ Theis Lange [ctb] () Maintainer: Anders Granholm Repository: CRAN -Date/Publication: 2023-05-02 13:30:02 UTC +Date/Publication: 2023-08-21 12:10:04 UTC diff -Nru adaptr-1.3.1/inst/doc/Advanced-example.html adaptr-1.3.2/inst/doc/Advanced-example.html --- adaptr-1.3.1/inst/doc/Advanced-example.html 2023-05-02 12:54:14.000000000 +0000 +++ adaptr-1.3.2/inst/doc/Advanced-example.html 2023-08-21 11:52:41.000000000 +0000 @@ -390,7 +390,7 @@

Although the user-written custom functions below do not depend on the adaptr package, as the first thing we load the package:

library(adaptr)
-#> Loading 'adaptr' package v1.3.1.
+#> Loading 'adaptr' package v1.3.2.
 #> For instructions, type 'help("adaptr")'
 #> or see https://inceptdk.github.io/adaptr/.

–and then set the global seed to ensure reproducible results in the diff -Nru adaptr-1.3.1/inst/doc/Overview.html adaptr-1.3.2/inst/doc/Overview.html --- adaptr-1.3.1/inst/doc/Overview.html 2023-05-02 12:54:21.000000000 +0000 +++ adaptr-1.3.2/inst/doc/Overview.html 2023-08-21 11:52:47.000000000 +0000 @@ -594,7 +594,7 @@ #> * Ideal design percentage: 100.0% #> #> Simulation details: -#> * Simulation time: 1.09 secs +#> * Simulation time: 1.05 secs #> * Base random seed: 67890 #> * Credible interval width: 95% #> * Number of posterior draws: 5000 @@ -634,7 +634,7 @@ #> * Ideal design percentage: 100.0% #> #> Simulation details: -#> * Simulation time: 1.09 secs +#> * Simulation time: 1.05 secs #> * Base random seed: 67890 #> * Credible interval width: 95% #> * Number of posterior draws: 5000 Binary files /tmp/tmpzojs84cm/AJfSdumkUM/adaptr-1.3.1/inst/testdata/binom__results__3_arms__common_control__equivalence__futility__softened.RData and /tmp/tmpzojs84cm/7PcCjdAqOf/adaptr-1.3.2/inst/testdata/binom__results__3_arms__common_control__equivalence__futility__softened.RData differ Binary files /tmp/tmpzojs84cm/AJfSdumkUM/adaptr-1.3.1/inst/testdata/binom__results__3_arms__no_control__equivalence__softened.RData and /tmp/tmpzojs84cm/7PcCjdAqOf/adaptr-1.3.2/inst/testdata/binom__results__3_arms__no_control__equivalence__softened.RData differ Binary files /tmp/tmpzojs84cm/AJfSdumkUM/adaptr-1.3.1/inst/testdata/binom__results__3_arms__no_control__equivalence__softened__sparse.RData and /tmp/tmpzojs84cm/7PcCjdAqOf/adaptr-1.3.2/inst/testdata/binom__results__3_arms__no_control__equivalence__softened__sparse.RData differ Binary files /tmp/tmpzojs84cm/AJfSdumkUM/adaptr-1.3.1/inst/testdata/binom__setup__3_arms__common_control__equivalence__futility__softened.RData and /tmp/tmpzojs84cm/7PcCjdAqOf/adaptr-1.3.2/inst/testdata/binom__setup__3_arms__common_control__equivalence__futility__softened.RData differ Binary files /tmp/tmpzojs84cm/AJfSdumkUM/adaptr-1.3.1/inst/testdata/binom__setup__3_arms__no_control__equivalence__softened.RData and /tmp/tmpzojs84cm/7PcCjdAqOf/adaptr-1.3.2/inst/testdata/binom__setup__3_arms__no_control__equivalence__softened.RData differ Binary files /tmp/tmpzojs84cm/AJfSdumkUM/adaptr-1.3.1/inst/testdata/norm__results__3_arms__common_control__fixed__all_arms_fixed.RData and /tmp/tmpzojs84cm/7PcCjdAqOf/adaptr-1.3.2/inst/testdata/norm__results__3_arms__common_control__fixed__all_arms_fixed.RData differ Binary files /tmp/tmpzojs84cm/AJfSdumkUM/adaptr-1.3.1/inst/testdata/norm__setup__3_arms__common_control__fixed__all_arms_fixed.RData and /tmp/tmpzojs84cm/7PcCjdAqOf/adaptr-1.3.2/inst/testdata/norm__setup__3_arms__common_control__fixed__all_arms_fixed.RData differ Binary files /tmp/tmpzojs84cm/AJfSdumkUM/adaptr-1.3.1/inst/testdata/norm__setup__3_arms__common_control__matched__varying_probs.RData and /tmp/tmpzojs84cm/7PcCjdAqOf/adaptr-1.3.2/inst/testdata/norm__setup__3_arms__common_control__matched__varying_probs.RData differ diff -Nru adaptr-1.3.1/man/plot_convergence.Rd adaptr-1.3.2/man/plot_convergence.Rd --- adaptr-1.3.1/man/plot_convergence.Rd 2023-05-02 12:06:18.000000000 +0000 +++ adaptr-1.3.2/man/plot_convergence.Rd 2023-08-21 11:28:06.000000000 +0000 @@ -33,9 +33,10 @@ \code{ratio_ys_mean}, \code{ratio_ys_sd}, \code{ratio_ys_median}, \code{ratio_ys_p25}, \code{ratio_ys_p75}, \code{ratio_ys_p0}, \code{ratio_ys_p100}, \code{prob_conclusive}, \code{prob_superior}, \code{prob_equivalence}, \code{prob_futility}, \code{prob_max}, -\verb{prob_select_*} (with \code{*} being an \code{arm} name), \code{rmse}, \code{rmse_te}, and -\code{idp}. All may be specified as above, case sensitive, but with either -spaces or underlines. Defaults to \code{"size mean"}.} +\verb{prob_select_*} (with \code{*} being either "\verb{arm_} for all \code{arm} names or +\code{none}), \code{rmse}, \code{rmse_te}, and \code{idp}. All may be specified as above, +case sensitive, but with either spaces or underlines. Defaults to +\code{"size mean"}.} \item{resolution}{single positive integer, the number of points calculated and plotted, defaults to \code{100} and must be \verb{>= 10}. Higher numbers lead to diff -Nru adaptr-1.3.1/man/replace_nonfinite.Rd adaptr-1.3.2/man/replace_nonfinite.Rd --- adaptr-1.3.1/man/replace_nonfinite.Rd 2022-12-13 12:28:37.000000000 +0000 +++ adaptr-1.3.2/man/replace_nonfinite.Rd 2023-08-21 11:28:06.000000000 +0000 @@ -5,7 +5,7 @@ \alias{\%f|\%} \title{Replace non-finite values with other value (finite-OR-operator)} \usage{ -x \%f|\% y +a \%f|\% b } \arguments{ \item{a}{atomic vector of any type.} diff -Nru adaptr-1.3.1/man/summary.Rd adaptr-1.3.2/man/summary.Rd --- adaptr-1.3.1/man/summary.Rd 2023-05-02 12:06:18.000000000 +0000 +++ adaptr-1.3.2/man/summary.Rd 2023-08-21 11:28:06.000000000 +0000 @@ -136,11 +136,12 @@ \code{ratio_ys_sd}, \code{ratio_ys_median}, \code{ratio_ys_p25}, \code{ratio_ys_p75}, \code{ratio_ys_p0}, \code{ratio_ys_p100}, \code{prob_conclusive}, \code{prob_superior}, \code{prob_equivalence}, \code{prob_futility}, \code{prob_max}, \verb{prob_select_*} (with -\code{*} being all \code{arm} names), \code{rmse}, \code{rmse_te}, and \code{idp}: performance -metrics as described in \code{\link[=check_performance]{check_performance()}}. Note that all \code{sum_ys_} -and \code{ratio_ys_} measures uses outcome data from all randomised patients, -regardless of whether they had outcome data available at the last analysis -or not, as described in \code{\link[=extract_results]{extract_results()}}. +\code{*} being either "\verb{arm_} for all \code{arm} names or \code{none}), \code{rmse}, +\code{rmse_te}, and \code{idp}: performance metrics as described in +\code{\link[=check_performance]{check_performance()}}. Note that all \code{sum_ys_} and \code{ratio_ys_} measures +use outcome data from all randomised patients, regardless of whether they +had outcome data available at the last analysis or not, as described in +\code{\link[=extract_results]{extract_results()}}. \item \code{select_strategy}, \code{select_last_arm}, \code{select_preferences}, \code{te_comp}, \code{raw_ests}, \code{final_ests}, \code{restrict}: as specified above. \item \code{control}: the control arm specified by \code{\link[=setup_trial]{setup_trial()}}, diff -Nru adaptr-1.3.1/MD5 adaptr-1.3.2/MD5 --- adaptr-1.3.1/MD5 2023-05-02 13:30:03.000000000 +0000 +++ adaptr-1.3.2/MD5 2023-08-21 12:10:04.000000000 +0000 @@ -1,15 +1,15 @@ -c7a93ed055e18170114ca1a81ee06a95 *DESCRIPTION +2236b9b29e42a3414d90f3b50e179d15 *DESCRIPTION 74226de6bd8ab77820d93a920ff31324 *NAMESPACE -9230be62d3b1ba7a784a173baef517ea *NEWS.md +f092e78643905c662e788a464426319c *NEWS.md 42104854f2f0e0f70261b0f31982ac81 *R/adaptr-package.R e1ecc2dd3e446dd8c700c48fe1eb3d91 *R/calibrate_trial.R -ee82ea662fea3ac503a5ef8d169faf4f *R/check_performance.R +4b7029a18d78f5464af93ae3b7257c14 *R/check_performance.R ccbf5898d036514e713aa4e8dfe6f50c *R/check_remaining_arms.R cffed22bca06b978492359e9be67793a *R/extract_results.R cbf3612f6c7a3fc3b3711254b175d56e *R/find_beta_params.R 3cdc069e100dfc84c0bc876b1858966f *R/get_ys_and_draws.R ecec744bc55283b671ab7bb1bc78c824 *R/gp_opt.R -e6094347b4320ab45ca2b3f43616d96a *R/plot_convergence.R +00748ce70eb98b4a28168faa7e5ab77b *R/plot_convergence.R 3551bddee4520b1db0940f785399bf39 *R/plot_history.R ccfa4d5a18bb144697ca5db985ddf9ed *R/plot_metrics_ecdf.R ea985e12e323e8b2057f4afb4f4bdcce *R/plot_status.R @@ -19,37 +19,37 @@ a4630714909c544f9f13155b50a9a1ed *R/run_trials.R ac06408f3854736bedd757c45e3c210b *R/setup_cluster.R 8061e639bdf9fbf998fdf9821c3850b2 *R/setup_trial.R -4734ecb9ebbe356be06e9ea2f7828be2 *R/summary.R +7da29678a1e1a9f16215ea4ffe57e9ca *R/summary.R 81d72f868aa50974687d8dff66ed56f0 *R/test_helpers.R 609cadb6d88246d3d37ed1eaf64c76cf *R/update_saved_trials.R -3c6bd70a79dac893f20947edc0e57dca *R/utils.R +721c4b406b6c7c953e131fb641ab992a *R/utils.R ddaac895ff838504ad2a06877b7060d8 *R/utils_plots.R d839d23d676a213b8076fc377e9d29aa *R/zzz.R -8085576fb24c23d1b403a85b1c295978 *README.md +5a1734341580b97fed9e534a487501d3 *README.md cdbdb705c017565f8d24cdc91a0e6ec8 *build/partial.rdb 783b25ab0a1363686dd4314cbb5a7e5e *build/vignette.rds 79db9faa08dc395def19fd8f2d0da27a *inst/CITATION 02da9d8f11e6690288a8089ddcf1c3de *inst/doc/Advanced-example.R fda98ac542c034a7ec2a2ac7cd37130e *inst/doc/Advanced-example.Rmd -c0a79f94954ce289e7c707bad8f3e461 *inst/doc/Advanced-example.html +470801b7693e2e1fa1f7c2761da87b2d *inst/doc/Advanced-example.html 737730b8eba64d7adde24058e556200d *inst/doc/Basic-examples.R 16bfdb37145d7ad3d5d1d123bd607182 *inst/doc/Basic-examples.Rmd 0b72f6ee4dcfa814fb12292ed62302f3 *inst/doc/Basic-examples.html 50d76eff77830cb1b0c3ca8e5084e818 *inst/doc/Overview.R 9fd7fd86c16449ceb9b71022718371b5 *inst/doc/Overview.Rmd -fe594e6a486a7b49a43d44ce387e9c75 *inst/doc/Overview.html +ef81f1c2e0ac6be59c83beb531d4afa3 *inst/doc/Overview.html 25fbb525e348833a1eb22ee4385ad283 *inst/testdata/binom__result__3_arms__common_control__equivalence__futility__softened.RData e3d07277ea322d811ca9f46d83786cae *inst/testdata/binom__result__3_arms__no_control__equivalence__softened.RData 0a5a495da4c2f01297612150c8c04023 *inst/testdata/binom__result__3_arms__no_control__equivalence__softened__sparse.RData -e5ff6cbfcdf384e4b65ef25cb40859b1 *inst/testdata/binom__results__3_arms__common_control__equivalence__futility__softened.RData -8a9e4ef556bf307a1da6eef8a8db573e *inst/testdata/binom__results__3_arms__no_control__equivalence__softened.RData -b7c7e3f78a34704673613ea236bf83b4 *inst/testdata/binom__results__3_arms__no_control__equivalence__softened__sparse.RData -fc8fb53fd55c72a9b09a48641070a3df *inst/testdata/binom__setup__3_arms__common_control__equivalence__futility__softened.RData -0d9145dd944fa2e7a9c4582b9c8e32e3 *inst/testdata/binom__setup__3_arms__no_control__equivalence__softened.RData +3c85b3ad6b3e07c52e12436eee9a1bab *inst/testdata/binom__results__3_arms__common_control__equivalence__futility__softened.RData +723dff392253a628fac7168ec0024695 *inst/testdata/binom__results__3_arms__no_control__equivalence__softened.RData +efaef3ef353d08a37ecc50a869bae3ac *inst/testdata/binom__results__3_arms__no_control__equivalence__softened__sparse.RData +5b09e2e493ab8d5c336a391a39087251 *inst/testdata/binom__setup__3_arms__common_control__equivalence__futility__softened.RData +9cb93d98af5a85745cc0140ab779ed01 *inst/testdata/binom__setup__3_arms__no_control__equivalence__softened.RData 2943187cc29f72fae44987a790c6c427 *inst/testdata/norm__result__3_arms__common_control__fixed__all_arms_fixed.RData -e26a32b17a942303bee809b5bc634722 *inst/testdata/norm__results__3_arms__common_control__fixed__all_arms_fixed.RData -94f369c37dc3f5b713783afec77b9185 *inst/testdata/norm__setup__3_arms__common_control__fixed__all_arms_fixed.RData -76932afe1402eff3a0f00f44f518f07d *inst/testdata/norm__setup__3_arms__common_control__matched__varying_probs.RData +724308881739bf5bd99bffa02299239d *inst/testdata/norm__results__3_arms__common_control__fixed__all_arms_fixed.RData +2ad818da00d72b56a1d2d9ac3ef11343 *inst/testdata/norm__setup__3_arms__common_control__fixed__all_arms_fixed.RData +34043ccfb1ffcc5e13caa4b4e2e9ae6b *inst/testdata/norm__setup__3_arms__common_control__matched__varying_probs.RData 76184570c3005c9fb79d096cb1cfe950 *man/adaptr-package.Rd 101d2ec45916a2255f62d6db723ab49f *man/assert_pkgs.Rd 7583b26b6aa5186c82f5d5f6bffde847 *man/calculate_idp.Rd @@ -78,7 +78,7 @@ b21148a3c98455230d75d3bacdf130c1 *man/gp_opt.Rd 05761736a06ac1042f73ba951914692a *man/make_x_scale.Rd ae6ac9dcf33fcf01861caa44c21fb9be *man/make_y_scale.Rd -7ce611ced25728f7047853cd07ad340c *man/plot_convergence.Rd +d043af11dd819f368232110465ac4456 *man/plot_convergence.Rd 1ad186cea19f987bdad5f327ed9a7ae4 *man/plot_history.Rd dabd2132982c0ecdafc5b9fee0b7e17a *man/plot_metrics_ecdf.Rd f10225067912d8de1cdc57840bff055b *man/plot_status.Rd @@ -89,7 +89,7 @@ 9273d529d0cf5963432f3c7792661fca *man/prob_better.Rd 018185340f79e1682d942c2b64452c57 *man/prog_breaks.Rd 3aca24e8f31c9b599ccaa685062bbb9f *man/reallocate_probs.Rd -e0b4657af423307867fee1b8f88fb3e8 *man/replace_nonfinite.Rd +45f9d122a004cd728ffed8d6df20f1a3 *man/replace_nonfinite.Rd 3ad13a0abce599c737d6b1037bf16a8a *man/replace_null.Rd a5a80180fbc529227f2176e6fd14d1fb *man/rescale.Rd f7a0eb7d0e163bc5c6f15b855b869ff3 *man/run_trial.Rd @@ -101,7 +101,7 @@ 3d52aaf6bf7b31018c31c471dd90a150 *man/stop0_warning0.Rd 10d854462a95e37425dd18d2d531c887 *man/summarise_dist.Rd 02e10f551f484f87a0061e4fe3e44c0f *man/summarise_num.Rd -3a4b17b5a296f1777516901d19c98a54 *man/summary.Rd +854a7fc4cf653e45bd0a1293ef713821 *man/summary.Rd bbdfa50347fc00930c37f003a0f23bbc *man/update_saved_trials.Rd 8f46bbdf35e06ddb4a846c3af9d0ffff *man/validate_trial.Rd 3af716c3be82f5402d32dca66689e773 *man/vapply_helpers.Rd @@ -110,7 +110,7 @@ c6abc82c553e18ad095f2250b297642d *tests/testthat.R 9c28a8bca0cf0c314ff3d67089436c41 *tests/testthat/_snaps/calibrate_trial.md 3ac6a22f01a8a241b23daa1d78ae92af *tests/testthat/_snaps/calibrate_trial/gaussian-process-based-calibration-plot.svg -963163f498b7b3a5ae715ac9c7b3da44 *tests/testthat/_snaps/check_performance.md +aa5b2d06711935f733d00678d841de14 *tests/testthat/_snaps/check_performance.md 169321b23b92d42e458db629686367da *tests/testthat/_snaps/check_remaining_arms.md 8684cdf06f56787776ec5aa07bc6c29c *tests/testthat/_snaps/extract.md defbc74cc51621b22970d054f28809ad *tests/testthat/_snaps/plot_convergence/convergence-plot-binomial-2-splits.svg @@ -140,9 +140,9 @@ d2337fdb895737353e55da76254df195 *tests/testthat/_snaps/plot_status/status-plot-across-arms-binomial.svg a4831d2812239ca55ed2201f71892d1e *tests/testthat/_snaps/plot_status/status-plot-for-all-arms-binomial.svg e86508a7caa3ab6d6240675e5dd724c6 *tests/testthat/_snaps/plot_status/status-plot-for-arm-c-binom.svg -7158c431b9279b522b03815169732f7a *tests/testthat/_snaps/run_trials.md +62ef8c83332a2e234bbeb34f7cd60cc2 *tests/testthat/_snaps/run_trials.md 0fc438b7f45e3dc8b399cb9a68fdd1ce *tests/testthat/_snaps/setup_trial.md -382c1a1342fed445c89ca107c2369b96 *tests/testthat/_snaps/summary-print.md +dce2a244ede7f7ca0d5f823f2e738d50 *tests/testthat/_snaps/summary-print.md c8f8e53b89b6620de05c77a9100a7bed *tests/testthat/_snaps/utils.md 145a7a25fed33a3489c153455681d0f3 *tests/testthat/setup_testdata_files.R ae18aaa2c0221710a996fae7da1966e8 *tests/testthat/test-calibrate_trial.R diff -Nru adaptr-1.3.1/NEWS.md adaptr-1.3.2/NEWS.md --- adaptr-1.3.1/NEWS.md 2023-05-02 12:41:51.000000000 +0000 +++ adaptr-1.3.2/NEWS.md 2023-08-21 11:29:29.000000000 +0000 @@ -1,322 +1,344 @@ -# adaptr 1.3.1 - -This is a patch release triggered by a CRAN request to fix a failing test that -also includes minor documentation updates. - -* Fixed a single test that failed on CRAN due to an update in the `testthat` - dependency `waldo`. - -* Fixed erroneous duplicated text in README and thus also on GitHub and the - package website. - -* Minor edits/clarifications in the documentation including function - documentation, README, and vignettes. - -# adaptr 1.3.0 - -This release implements new functionality (most importantly trial calibration), -improved parallelism, a single important bug fix, and multiple minor fixes, -changes, and improvements. - -### New features and major changes: - -* Added the `calibrate_trial()` function, which can be used to calibrate a - trial specification to obtain (approximately) a desired value for a certain - performance characteristic. Typically, this will be used to calibrate trial - specifications to control the overall Bayesian type-1 error rates in a - scenario with no between-arm differences, but the function is extensible and - may be used to calibrate trial specifications to other performance metrics. - The function uses a quite efficient Gaussian process-based Bayesian - optimisation algorithm, based in part on code by Robert Gramacy (Surrogates - chapter 5, see: https://bookdown.org/rbg/surrogates/chap5.html), with - permission. - -* More and better parallelism. The functions `extract_results()`, - `check_performance()`, `plot_convergence()`, `plot_history()`, and the - `summary()` and `print()` methods for `trial_results` objects may now be run - in parallel via the `cores` argument or as described below. Please note, some - other functions have not been parallelised, as they were already fast and - the time it took to copy data to the clusters meant that the parallel - versions of those functions were actually slower than the original ones, - even when run on results from 10-100K simulations. - -* The `setup_cluster()` function has been added and can now be used to setup - and use the same parallel cluster throughout a session, avoiding the - overhead of setting up and stopping new clusters each time. The default - value for the `cores` argument in all functions is now `NULL`; if an actual - value is supplied, it will always be used to initiate a new, temporary - cluster of that size, but if left at `NULL` the defaults defined by - `setup_cluster()` will be used (if any), otherwise the `"mc.cores"` global - option will be used (for new, temporary clusters of that size) if specified - by `options(mc.cores = )`, and otherwise `1`. - Finally, `adaptr` now always uses parallel (not forked) clusters as is the - default in `parallel` and which works on all operating systems. - -* Better (safer, more correct) random number generation. Previously, random - number generation was managed in an *ad-hoc* fashion to produce similar - results sequentially and in parallel; while the influence of this was - minimal, the package now uses the `"L'Ecuyer-CMRG"` random number generator - (see `base::RNGkind()`) and appropriately manages random number streams - across parallel workers, also when run sequentially, ensuring identical - results regardless of the use of parallelism or not. - **Important:** Due to this change, simulation results from `run_trials()` - and bootstrapped uncertainty measures from `check_performance()` will not be - identical to those generated with previous versions of the package. In - addition, individual `trial_result` objects in a `trial_results` object - returned from `run_trials()` no longer contain any individual seed values, - but instead `NULL`. - -* Added the `plot_metrics_ecdf()` function, which plots empirical cumulative - distribution functions of numerical performance metrics across multiple - trial simulations. - -* Added the `check_remaining_arms()` function, which summarises all - combinations of remaining arms across multiple simulations. - -### Bug fixes: - -* Fixed a bug in `extract_results()` (and thus also in functionality relying on - it: `check_performance()`, `plot_convergence()`, and the `summary()` - method for multiple simulated trials) that caused incorrect total event - counts and event rates being calculated for trial specification with - follow-up/outcome-data lag (the total event count from the last adaptive - analysis was incorrectly used, and for ratios this was divided by the total - number of patients randomised). This has been fixed and the documentation of - the relevant functions has been updated to clarify the behaviour further. - This bug did not affect results for simulations without follow-up/outcome- - data lag. - -* Values for `inferiority` must now be less than `1 / number of arms` if no - common control group is used, and the `setup_trial()` family of functions - now throws an error if this is not the case. Larger values are invalid and - could lead to simultaneous dropping of all arms, which caused `run_trial()` - to crash. - -* The `print()` method for results from `check_performance()` did not respect - the `digits` argument; this has been fixed. - -### Minor changes: - -* Now includes min/max values when summarising numerical performance metrics - in `check_performance()` and `summary()`, and these may be plotted using - `plot_convergence()` as well. - -* The `setup_trial()` functions now accepts `equivalence_prob` and - `futility_prob` thresholds of `1`. As `run_trial()` only stops or drops arms - for equivalence/futility if the probabilities exceed the current threshold, - values of `1` makes stopping impossible. These values, however, may be used - in a sequence of thresholds to effectively prevent early stopping for - equivalence/futility but allowing it later. - -* When `overwrite` is `TRUE` in `run_trials()`, the previous object will be - overwritten, even if the previous object used a different trial - specification. - -* Various minor updates, corrections, clarifications, and structural changes - to package documentation (including package description and website). - -* Changed `size` to `linewidth` in the examples in `plot_status()` and - `plot_history()` when describing further arguments that may be passed on to - `ggplot2` due to deprecation/change of aesthetic names in `ggplot2` 3.4.0. - -* Documentation for `plot_convergence()`, `plot_status()`, and - `plot_history()` now prints all plots when rendering documentation if - `ggplot2` is installed (to include all example plots on the website). - -* The `setup_trial()` functions no longer prints a message informing that - there is no single best arm. - -* Various minor changes to `print()` methods (including changed number of - digits for stopping rule probability thresholds). - -* The `setup_trial()` family of functions now restores the global random seed - after being run as the outcome generator/draws generator functions are - called during validation, involving random number generation. While this was - always documented, it seems preferable that to restore the global random - seed during trial setup when functions are only validated. - -* Always explicitly uses `inherits = FALSE` in calls to `base::get()`, - `base::exists()`, and `base::assign()` to ensure that `.Random.seed` is only - checked/used/assigned in the global environment. It is very unlikely that - this would ever cause errors if not done, but this serves as an extra - safety. - -# adaptr 1.2.0 - -This is a minor release implementing new functionality, updating -documentation, and fixing multiple minor issues, mostly in validation of -supplied arguments. - -### New features: - -* Simulate follow-up (and data collection) lag: added option to have - different numbers of simulated patients with outcome data available - compared to the total number of simulated patients randomised at - each adaptive analysis (`randomised_at_looks` argument in - `setup_trial()` family of functions). Defaults to same behaviour as - previously (i.e., assuming that outcome data are immediately - available following randomisation). As a consequence, `run_trial()` - now always conducts a final analysis after the last adaptive - analysis (including both final posterior and 'raw' estimates), - including the outcome data of all patients randomised to all arms, - regardless of how many had outcome data available at the last - conducted adaptive analysis. Both sets of results are saved and - printed for individual simulations; `extract_results()`, the - `summary()` and the `print()` methods for multiple simulations have - gained the additional argument `final_ests` that controls whether - the results from this final analysis or from the last relevant - adaptive analysis including each arm are used when calculating some - performance metrics (defaults are set to ensure backwards - compatibility and otherwise use the final estimates in situations where - not all patients are included in the final adaptive analysis). An - example has been added to the `Basic examples` vignette illustrating - the use of this argument. - -* Updated `plot_history()` and `plot_status()` to add the possibility - to plot different metrics according to the number of patients - randomised as specified by the the new `randomised_at_looks` - argument to the `setup_trial()` functions as described above. - -* Added the `update_saved_trials()` function, which 'updates' multiple - trial simulation objects saved by `run_trials()` using previous - versions of `adaptr`. This reformats the objects to work with the - updated functions. Not all values can be added to previously saved - simulation results without re-running; these values will be replaced - with `NA`s, and - if used - may lead to printing or plotting of - missing values. However, the function allows re-use of the same data - from previous simulations without having to re-run them (mostly - relevant for time-consuming simulations). **Important:** please - notice that other objects (i.e., objects returned from the - `setup_trial()` family of functions and single simulations returned - by `run_trial()`) may create problems or errors with some functions - if created by previous versions of the package and manually - reloaded; these objects will have to be updated by re-running the - code using the newest version of the package. Similarly, manually - reloaded results from `run_trials()` that are not updated using this - function may cause errors/problems when used. - -* Added the `check_performance()` function (and a corresponding - `print()` method) which calculates performance metrics and can be - used to calculate uncertainty measures using non-parametric - bootstrapping. This function is now used internally by the - `summary()` method for multiple trial objects. - -* Added the `plot_convergence()` function which plots performance - metrics according to the number of simulations conducted for - multiple simulated trials (possibly after splitting the simulations - into batches), used to assess stability of performance metrics. - -* Added the possibility to define different probability thresholds for - different adaptive analyses to the `setup_trials()` family of - functions (for inferiority, superiority, equivalence, and futility - probability thresholds), with according updates in `run_trial()` and - the `print()` method for trial specifications. - -* Updated `plot_status()`; multiple arms may now simultaneously be - plotted by specifying more than one valid arm or `NA` (which lead to - statuses for all arms being plotted) in the `arm` argument. In - addition, `arm` name(s) are now always included on the plots. - -### Documentation, bug fixes, and other changes: - -* Added reference to open access article describing key methodological - considerations in adaptive clinical trials using adaptive stopping, - arm dropping, and randomisation to the package documentation - (). - -* The proportion of conclusive trials when restricting the trials - summarised (in `extract_results()`) may now be calculated by the - `summary()` method for multiple trial simulations and by the new - `check_performance()` function, even if this measure may be - difficult to interpret when the trials summarised is restricted. - -* Minor fixes, updates, and added clarification to the documentation - in multiple places, including in vignettes, which have also been - updated to illustrate some of the new functions added. - -* Minor fix to `print()` method for individual trial results, which did - not correctly print additional information about trials. - -* Fixed a bug where the same number of patients included could be used - for subsequent `data_looks` in the `setup_trial()` family of - functions; this now produces an error. - -* Added internal `vapply_lgl()` helper function; the internal `vapply()` - helper functions are now used consistently to simplify the code. - -* Added multiple internal (non-exported) helper functions to simplify - code throughout the package: `stop0()`, `warning0()`, `%f|%`, and - `summarise_num()`. - -* Added `names = FALSE` argument to `quantile()` calls in the - `summary()` method for `trial_results` objects to avoid unnecessary - naming of some components if they are subsequently extracted from - the returned object. - -* Ideal design percentages may be calculated as `NaN`, `Inf` or `-Inf` - in scenarios with no differences; these are now all converted to - `NA` before being returned by the various functions. - -* Minor edits/clarifications to several errors/warnings/messages. - -* Minor fix to internal `verify_int()` function; when supplied with, - e.g., a character vector, execution was stopped with an error - instead of returning `FALSE`, as needed to print the proper error - messages after checks. - -* Minor fix to `plot_status()`, where the upper area (representing - trials/arms still recruiting) was sometimes erroneously not plotted - due to a floating point issue where the summed proportions could - sometimes slightly exceed 1. - -* Added additional tests to test increase coverage of existing and - new functions. - -* Minor fix in internal `reallocate_probs()` function, when `"match"`-ing - control arm allocation to the highest probability in a non-control arm and - if all probabilities were initially 0, the returned vector lacked names, - which have now been added. - -* Minor fixes to internal `validate_trial()` function in order to: not - give an error when multiple values were supplied to the - `control_prob_fixed` argument; and to give the correct error when - multiple values were provided to `equivalence_diff` or `futility_diff`; - and to give an error when `NA` was supplied to `futility_only_first`; - and to add some tolerance to the checks of `data_looks` and - `randomised_at_looks` to avoid errors due to floating point imprecision - when specified using multiplication or similar; and correct errors if - decimal numbers for patient count arguments were supplied; and additional - minor updates to errors/messages. - -# adaptr 1.1.1 - -This is a patch release triggered by a CRAN request for updates. - -* Minor formatting changes to the `adaptr-package` help page to comply - with CRAN request to only use HTML5 (as used by R \>=4.2.0). - -* Minor bug fixes in `print()` methods for trial specifications and - summaries of multiple trial results. - -* Minor updates in messages in `setup_trial()`. - -# adaptr 1.1.0 - -Minor release: - -* Updates to the `run_trials()` function to allow exporting objects to - clusters when running simulations on multiple cores. - -* Updates to internal function `verify_int()` due to updates in R \>= - 4.2.0, to avoid incorrect error messages in future versions due to - changed behaviour with the `&&` function when used with arguments - with length \> 1 - (). - -* Minor documentation edits and updated citation info (reference to - software paper published in Journal of Open Source Software, - ). - -# adaptr 1.0.0 - -* First release. +# adaptr 1.3.2 + +This is a patch release with bug fixes and documentation updates. + +* Fixed a bug in `check_performance()` that caused the proportion of + conclusive trial simulations (`prob_conclusive`) to be calculated + incorrectly when restricted to simulations ending in superiority or with a + selected arm according to the selection strategy used in `restrict`. This + bug also affected the `summary()` method for multiple simulations (as this + relies on `check_performance()`). + +* Fixed a bug in `plot_convergence()` that caused arm selection probabilities + to be incorrectly calculated and plotted (this bug did not affect any of the + other functions for calculating and summarising simulation results). + +* Corrections to `plot_convergence()` and `summary()` method documentation for + arm selection probability extraction. + +* Fixed inconsistency between argument names and documentation in the internal + `%f|%` function (renamed arguments for consistency with the internal `%||%` + function). + +# adaptr 1.3.1 + +This is a patch release triggered by a CRAN request to fix a failing test that +also includes minor documentation updates. + +* Fixed a single test that failed on CRAN due to an update in the `testthat` + dependency `waldo`. + +* Fixed erroneous duplicated text in README and thus also on GitHub and the + package website. + +* Minor edits/clarifications in the documentation including function + documentation, README, and vignettes. + +# adaptr 1.3.0 + +This release implements new functionality (most importantly trial calibration), +improved parallelism, a single important bug fix, and multiple minor fixes, +changes, and improvements. + +### New features and major changes: + +* Added the `calibrate_trial()` function, which can be used to calibrate a + trial specification to obtain (approximately) a desired value for a certain + performance characteristic. Typically, this will be used to calibrate trial + specifications to control the overall Bayesian type-1 error rates in a + scenario with no between-arm differences, but the function is extensible and + may be used to calibrate trial specifications to other performance metrics. + The function uses a quite efficient Gaussian process-based Bayesian + optimisation algorithm, based in part on code by Robert Gramacy (Surrogates + chapter 5, see: https://bookdown.org/rbg/surrogates/chap5.html), with + permission. + +* More and better parallelism. The functions `extract_results()`, + `check_performance()`, `plot_convergence()`, `plot_history()`, and the + `summary()` and `print()` methods for `trial_results` objects may now be run + in parallel via the `cores` argument or as described below. Please note, some + other functions have not been parallelised, as they were already fast and + the time it took to copy data to the clusters meant that the parallel + versions of those functions were actually slower than the original ones, + even when run on results from 10-100K simulations. + +* The `setup_cluster()` function has been added and can now be used to setup + and use the same parallel cluster throughout a session, avoiding the + overhead of setting up and stopping new clusters each time. The default + value for the `cores` argument in all functions is now `NULL`; if an actual + value is supplied, it will always be used to initiate a new, temporary + cluster of that size, but if left at `NULL` the defaults defined by + `setup_cluster()` will be used (if any), otherwise the `"mc.cores"` global + option will be used (for new, temporary clusters of that size) if specified + by `options(mc.cores = )`, and otherwise `1`. + Finally, `adaptr` now always uses parallel (not forked) clusters as is the + default in `parallel` and which works on all operating systems. + +* Better (safer, more correct) random number generation. Previously, random + number generation was managed in an *ad-hoc* fashion to produce similar + results sequentially and in parallel; while the influence of this was + minimal, the package now uses the `"L'Ecuyer-CMRG"` random number generator + (see `base::RNGkind()`) and appropriately manages random number streams + across parallel workers, also when run sequentially, ensuring identical + results regardless of the use of parallelism or not. + **Important:** Due to this change, simulation results from `run_trials()` + and bootstrapped uncertainty measures from `check_performance()` will not be + identical to those generated with previous versions of the package. In + addition, individual `trial_result` objects in a `trial_results` object + returned from `run_trials()` no longer contain any individual seed values, + but instead `NULL`. + +* Added the `plot_metrics_ecdf()` function, which plots empirical cumulative + distribution functions of numerical performance metrics across multiple + trial simulations. + +* Added the `check_remaining_arms()` function, which summarises all + combinations of remaining arms across multiple simulations. + +### Bug fixes: + +* Fixed a bug in `extract_results()` (and thus also in functionality relying on + it: `check_performance()`, `plot_convergence()`, and the `summary()` + method for multiple simulated trials) that caused incorrect total event + counts and event rates being calculated for trial specification with + follow-up/outcome-data lag (the total event count from the last adaptive + analysis was incorrectly used, and for ratios this was divided by the total + number of patients randomised). This has been fixed and the documentation of + the relevant functions has been updated to clarify the behaviour further. + This bug did not affect results for simulations without follow-up/outcome- + data lag. + +* Values for `inferiority` must now be less than `1 / number of arms` if no + common control group is used, and the `setup_trial()` family of functions + now throws an error if this is not the case. Larger values are invalid and + could lead to simultaneous dropping of all arms, which caused `run_trial()` + to crash. + +* The `print()` method for results from `check_performance()` did not respect + the `digits` argument; this has been fixed. + +### Minor changes: + +* Now includes min/max values when summarising numerical performance metrics + in `check_performance()` and `summary()`, and these may be plotted using + `plot_convergence()` as well. + +* The `setup_trial()` functions now accepts `equivalence_prob` and + `futility_prob` thresholds of `1`. As `run_trial()` only stops or drops arms + for equivalence/futility if the probabilities exceed the current threshold, + values of `1` makes stopping impossible. These values, however, may be used + in a sequence of thresholds to effectively prevent early stopping for + equivalence/futility but allowing it later. + +* When `overwrite` is `TRUE` in `run_trials()`, the previous object will be + overwritten, even if the previous object used a different trial + specification. + +* Various minor updates, corrections, clarifications, and structural changes + to package documentation (including package description and website). + +* Changed `size` to `linewidth` in the examples in `plot_status()` and + `plot_history()` when describing further arguments that may be passed on to + `ggplot2` due to deprecation/change of aesthetic names in `ggplot2` 3.4.0. + +* Documentation for `plot_convergence()`, `plot_status()`, and + `plot_history()` now prints all plots when rendering documentation if + `ggplot2` is installed (to include all example plots on the website). + +* The `setup_trial()` functions no longer prints a message informing that + there is no single best arm. + +* Various minor changes to `print()` methods (including changed number of + digits for stopping rule probability thresholds). + +* The `setup_trial()` family of functions now restores the global random seed + after being run as the outcome generator/draws generator functions are + called during validation, involving random number generation. While this was + always documented, it seems preferable that to restore the global random + seed during trial setup when functions are only validated. + +* Always explicitly uses `inherits = FALSE` in calls to `base::get()`, + `base::exists()`, and `base::assign()` to ensure that `.Random.seed` is only + checked/used/assigned in the global environment. It is very unlikely that + this would ever cause errors if not done, but this serves as an extra + safety. + +# adaptr 1.2.0 + +This is a minor release implementing new functionality, updating +documentation, and fixing multiple minor issues, mostly in validation of +supplied arguments. + +### New features: + +* Simulate follow-up (and data collection) lag: added option to have + different numbers of simulated patients with outcome data available + compared to the total number of simulated patients randomised at + each adaptive analysis (`randomised_at_looks` argument in + `setup_trial()` family of functions). Defaults to same behaviour as + previously (i.e., assuming that outcome data are immediately + available following randomisation). As a consequence, `run_trial()` + now always conducts a final analysis after the last adaptive + analysis (including both final posterior and 'raw' estimates), + including the outcome data of all patients randomised to all arms, + regardless of how many had outcome data available at the last + conducted adaptive analysis. Both sets of results are saved and + printed for individual simulations; `extract_results()`, the + `summary()` and the `print()` methods for multiple simulations have + gained the additional argument `final_ests` that controls whether + the results from this final analysis or from the last relevant + adaptive analysis including each arm are used when calculating some + performance metrics (defaults are set to ensure backwards + compatibility and otherwise use the final estimates in situations where + not all patients are included in the final adaptive analysis). An + example has been added to the `Basic examples` vignette illustrating + the use of this argument. + +* Updated `plot_history()` and `plot_status()` to add the possibility + to plot different metrics according to the number of patients + randomised as specified by the the new `randomised_at_looks` + argument to the `setup_trial()` functions as described above. + +* Added the `update_saved_trials()` function, which 'updates' multiple + trial simulation objects saved by `run_trials()` using previous + versions of `adaptr`. This reformats the objects to work with the + updated functions. Not all values can be added to previously saved + simulation results without re-running; these values will be replaced + with `NA`s, and - if used - may lead to printing or plotting of + missing values. However, the function allows re-use of the same data + from previous simulations without having to re-run them (mostly + relevant for time-consuming simulations). **Important:** please + notice that other objects (i.e., objects returned from the + `setup_trial()` family of functions and single simulations returned + by `run_trial()`) may create problems or errors with some functions + if created by previous versions of the package and manually + reloaded; these objects will have to be updated by re-running the + code using the newest version of the package. Similarly, manually + reloaded results from `run_trials()` that are not updated using this + function may cause errors/problems when used. + +* Added the `check_performance()` function (and a corresponding + `print()` method) which calculates performance metrics and can be + used to calculate uncertainty measures using non-parametric + bootstrapping. This function is now used internally by the + `summary()` method for multiple trial objects. + +* Added the `plot_convergence()` function which plots performance + metrics according to the number of simulations conducted for + multiple simulated trials (possibly after splitting the simulations + into batches), used to assess stability of performance metrics. + +* Added the possibility to define different probability thresholds for + different adaptive analyses to the `setup_trials()` family of + functions (for inferiority, superiority, equivalence, and futility + probability thresholds), with according updates in `run_trial()` and + the `print()` method for trial specifications. + +* Updated `plot_status()`; multiple arms may now simultaneously be + plotted by specifying more than one valid arm or `NA` (which lead to + statuses for all arms being plotted) in the `arm` argument. In + addition, `arm` name(s) are now always included on the plots. + +### Documentation, bug fixes, and other changes: + +* Added reference to open access article describing key methodological + considerations in adaptive clinical trials using adaptive stopping, + arm dropping, and randomisation to the package documentation + (). + +* The proportion of conclusive trials when restricting the trials + summarised (in `extract_results()`) may now be calculated by the + `summary()` method for multiple trial simulations and by the new + `check_performance()` function, even if this measure may be + difficult to interpret when the trials summarised is restricted. + +* Minor fixes, updates, and added clarification to the documentation + in multiple places, including in vignettes, which have also been + updated to illustrate some of the new functions added. + +* Minor fix to `print()` method for individual trial results, which did + not correctly print additional information about trials. + +* Fixed a bug where the same number of patients included could be used + for subsequent `data_looks` in the `setup_trial()` family of + functions; this now produces an error. + +* Added internal `vapply_lgl()` helper function; the internal `vapply()` + helper functions are now used consistently to simplify the code. + +* Added multiple internal (non-exported) helper functions to simplify + code throughout the package: `stop0()`, `warning0()`, `%f|%`, and + `summarise_num()`. + +* Added `names = FALSE` argument to `quantile()` calls in the + `summary()` method for `trial_results` objects to avoid unnecessary + naming of some components if they are subsequently extracted from + the returned object. + +* Ideal design percentages may be calculated as `NaN`, `Inf` or `-Inf` + in scenarios with no differences; these are now all converted to + `NA` before being returned by the various functions. + +* Minor edits/clarifications to several errors/warnings/messages. + +* Minor fix to internal `verify_int()` function; when supplied with, + e.g., a character vector, execution was stopped with an error + instead of returning `FALSE`, as needed to print the proper error + messages after checks. + +* Minor fix to `plot_status()`, where the upper area (representing + trials/arms still recruiting) was sometimes erroneously not plotted + due to a floating point issue where the summed proportions could + sometimes slightly exceed 1. + +* Added additional tests to test increase coverage of existing and + new functions. + +* Minor fix in internal `reallocate_probs()` function, when `"match"`-ing + control arm allocation to the highest probability in a non-control arm and + if all probabilities were initially 0, the returned vector lacked names, + which have now been added. + +* Minor fixes to internal `validate_trial()` function in order to: not + give an error when multiple values were supplied to the + `control_prob_fixed` argument; and to give the correct error when + multiple values were provided to `equivalence_diff` or `futility_diff`; + and to give an error when `NA` was supplied to `futility_only_first`; + and to add some tolerance to the checks of `data_looks` and + `randomised_at_looks` to avoid errors due to floating point imprecision + when specified using multiplication or similar; and correct errors if + decimal numbers for patient count arguments were supplied; and additional + minor updates to errors/messages. + +# adaptr 1.1.1 + +This is a patch release triggered by a CRAN request for updates. + +* Minor formatting changes to the `adaptr-package` help page to comply + with CRAN request to only use HTML5 (as used by R \>=4.2.0). + +* Minor bug fixes in `print()` methods for trial specifications and + summaries of multiple trial results. + +* Minor updates in messages in `setup_trial()`. + +# adaptr 1.1.0 + +Minor release: + +* Updates to the `run_trials()` function to allow exporting objects to + clusters when running simulations on multiple cores. + +* Updates to internal function `verify_int()` due to updates in R \>= + 4.2.0, to avoid incorrect error messages in future versions due to + changed behaviour with the `&&` function when used with arguments + with length \> 1 + (). + +* Minor documentation edits and updated citation info (reference to + software paper published in Journal of Open Source Software, + ). + +# adaptr 1.0.0 + +* First release. diff -Nru adaptr-1.3.1/R/check_performance.R adaptr-1.3.2/R/check_performance.R --- adaptr-1.3.1/R/check_performance.R 2023-05-02 12:06:18.000000000 +0000 +++ adaptr-1.3.2/R/check_performance.R 2023-08-21 11:28:06.000000000 +0000 @@ -246,7 +246,7 @@ summarise_num(extr_res$final_n[restrict_idx]), summarise_num(extr_res$sum_ys[restrict_idx]), summarise_num(extr_res$ratio_ys[restrict_idx]), - mean(extr_res$final_status != "max"), + mean(extr_res$final_status[restrict_idx] != "max"), mean(extr_res$final_status[restrict_idx] == "superiority"), mean(extr_res$final_status[restrict_idx] == "equivalence"), mean(extr_res$final_status[restrict_idx] == "futility"), @@ -300,7 +300,7 @@ summarise_num(extr_boot$final_n[restrict_idx]), summarise_num(extr_boot$sum_ys[restrict_idx]), summarise_num(extr_boot$ratio_ys[restrict_idx]), - mean(extr_boot$final_status != "max"), + mean(extr_boot$final_status[restrict_idx] != "max"), mean(extr_boot$final_status[restrict_idx] == "superiority"), mean(extr_boot$final_status[restrict_idx] == "equivalence"), mean(extr_boot$final_status[restrict_idx] == "futility"), diff -Nru adaptr-1.3.1/R/plot_convergence.R adaptr-1.3.2/R/plot_convergence.R --- adaptr-1.3.1/R/plot_convergence.R 2023-03-31 13:20:21.000000000 +0000 +++ adaptr-1.3.2/R/plot_convergence.R 2023-08-21 11:28:06.000000000 +0000 @@ -17,9 +17,10 @@ #' `ratio_ys_mean`, `ratio_ys_sd`, `ratio_ys_median`, `ratio_ys_p25`, #' `ratio_ys_p75`, `ratio_ys_p0`, `ratio_ys_p100`, `prob_conclusive`, #' `prob_superior`, `prob_equivalence`, `prob_futility`, `prob_max`, -#' `prob_select_*` (with `*` being an `arm` name), `rmse`, `rmse_te`, and -#' `idp`. All may be specified as above, case sensitive, but with either -#' spaces or underlines. Defaults to `"size mean"`. +#' `prob_select_*` (with `*` being either "`arm_` for all `arm` names or +#' `none`), `rmse`, `rmse_te`, and `idp`. All may be specified as above, +#' case sensitive, but with either spaces or underlines. Defaults to +#' `"size mean"`. #' @param resolution single positive integer, the number of points calculated #' and plotted, defaults to `100` and must be `>= 10`. Higher numbers lead to #' smoother plots, but increases computation time. If the value specified is @@ -154,7 +155,7 @@ # Get current function if (substr(cur_metric, 1, 16) == "prob_select_arm_") { cur_arm <- substr(cur_metric, 17, nchar(cur_metric)) - cur_fun <- function(i) sum(extr_res$selected_arm[start_id:i] == cur_arm, na.rm = TRUE) / n_restrict * 100 + cur_fun <- function(i) sum(extr_res$selected_arm[start_id:i] == cur_arm, na.rm = TRUE) / length(start_id:i) * 100 } else { cur_fun <- switch(cur_metric, size_mean = function(i) mean(extr_res$final_n[start_id:i]), diff -Nru adaptr-1.3.1/R/summary.R adaptr-1.3.2/R/summary.R --- adaptr-1.3.1/R/summary.R 2023-03-31 13:20:21.000000000 +0000 +++ adaptr-1.3.2/R/summary.R 2023-08-21 11:28:06.000000000 +0000 @@ -22,11 +22,12 @@ #' `ratio_ys_sd`, `ratio_ys_median`, `ratio_ys_p25`, `ratio_ys_p75`, #' `ratio_ys_p0`, `ratio_ys_p100`, `prob_conclusive`, `prob_superior`, #' `prob_equivalence`, `prob_futility`, `prob_max`, `prob_select_*` (with -#' `*` being all `arm` names), `rmse`, `rmse_te`, and `idp`: performance -#' metrics as described in [check_performance()]. Note that all `sum_ys_` -#' and `ratio_ys_` measures uses outcome data from all randomised patients, -#' regardless of whether they had outcome data available at the last analysis -#' or not, as described in [extract_results()]. +#' `*` being either "`arm_` for all `arm` names or `none`), `rmse`, +#' `rmse_te`, and `idp`: performance metrics as described in +#' [check_performance()]. Note that all `sum_ys_` and `ratio_ys_` measures +#' use outcome data from all randomised patients, regardless of whether they +#' had outcome data available at the last analysis or not, as described in +#' [extract_results()]. #' \item `select_strategy`, `select_last_arm`, `select_preferences`, #' `te_comp`, `raw_ests`, `final_ests`, `restrict`: as specified above. #' \item `control`: the control arm specified by [setup_trial()], diff -Nru adaptr-1.3.1/R/utils.R adaptr-1.3.2/R/utils.R --- adaptr-1.3.1/R/utils.R 2023-03-31 13:20:21.000000000 +0000 +++ adaptr-1.3.2/R/utils.R 2023-08-21 11:28:06.000000000 +0000 @@ -212,9 +212,9 @@ #' #' @name replace_nonfinite #' -`%f|%` <- function(x, y) { - x[!is.finite(x)] <- y - x +`%f|%` <- function(a, b) { + a[!is.finite(a)] <- b + a } diff -Nru adaptr-1.3.1/README.md adaptr-1.3.2/README.md --- adaptr-1.3.1/README.md 2023-05-02 12:06:18.000000000 +0000 +++ adaptr-1.3.2/README.md 2023-08-21 11:29:29.000000000 +0000 @@ -66,7 +66,7 @@ ``` r library(adaptr) -#> Loading 'adaptr' package v1.3.1. +#> Loading 'adaptr' package v1.3.2. #> For instructions, type 'help("adaptr")' #> or see https://inceptdk.github.io/adaptr/. @@ -210,7 +210,7 @@ #> * Ideal design percentage: 100.0% #> #> Simulation details: -#> * Simulation time: 0.622 secs +#> * Simulation time: 0.475 secs #> * Base random seed: 67890 #> * Credible interval width: 95% #> * Number of posterior draws: 5000 diff -Nru adaptr-1.3.1/tests/testthat/_snaps/check_performance.md adaptr-1.3.2/tests/testthat/_snaps/check_performance.md --- adaptr-1.3.1/tests/testthat/_snaps/check_performance.md 2023-05-02 11:57:41.000000000 +0000 +++ adaptr-1.3.2/tests/testthat/_snaps/check_performance.md 2023-08-21 11:47:27.000000000 +0000 @@ -195,7 +195,7 @@ 20 ratio_ys_p75 0.228 21 ratio_ys_p0 0.216 22 ratio_ys_p100 0.270 - 23 prob_conclusive 0.800 + 23 prob_conclusive 1.000 24 prob_superior 1.000 25 prob_equivalence 0.000 26 prob_futility 0.000 @@ -236,7 +236,7 @@ 20 ratio_ys_p75 0.228 21 ratio_ys_p0 0.216 22 ratio_ys_p100 0.270 - 23 prob_conclusive 0.800 + 23 prob_conclusive 1.000 24 prob_superior 1.000 25 prob_equivalence 0.000 26 prob_futility 0.000 @@ -280,7 +280,7 @@ 20 ratio_ys_p75 0.228 0.008 0.004 0.222 0.253 21 ratio_ys_p0 0.216 NA NA NA NA 22 ratio_ys_p100 0.270 NA NA NA NA - 23 prob_conclusive 0.800 0.086 0.074 0.650 0.950 + 23 prob_conclusive 1.000 0.000 0.000 1.000 1.000 24 prob_superior 1.000 0.000 0.000 1.000 1.000 25 prob_equivalence 0.000 0.000 0.000 0.000 0.000 26 prob_futility 0.000 0.000 0.000 0.000 0.000 @@ -324,7 +324,7 @@ 20 ratio_ys_p75 0.228 0.008 0.004 0.222 0.253 21 ratio_ys_p0 0.216 NA NA NA NA 22 ratio_ys_p100 0.270 NA NA NA NA - 23 prob_conclusive 0.800 0.086 0.074 0.650 0.950 + 23 prob_conclusive 1.000 0.000 0.000 1.000 1.000 24 prob_superior 1.000 0.000 0.000 1.000 1.000 25 prob_equivalence 0.000 0.000 0.000 0.000 0.000 26 prob_futility 0.000 0.000 0.000 0.000 0.000 diff -Nru adaptr-1.3.1/tests/testthat/_snaps/run_trials.md adaptr-1.3.2/tests/testthat/_snaps/run_trials.md --- adaptr-1.3.1/tests/testthat/_snaps/run_trials.md 2023-05-02 12:34:28.000000000 +0000 +++ adaptr-1.3.2/tests/testthat/_snaps/run_trials.md 2023-08-21 11:47:45.000000000 +0000 @@ -1,572 +1,572 @@ -# single trial simulation works - - Code - run_trial(setup_equi_futil_only_first, seed = 12345) - Output - Single simulation result: generic binomially distributed outcome trial - * Undesirable outcome - * Initial/final common control arms: B/B - - Final status: conclusive, stopped for equivalence - Final/maximum allowed sample sizes: 500/2000 (25.0%) - Available outcome data at last adaptive analysis: 500/500 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.20 equivalence 500 1 0.333 - B 0.21 control 500 NA 0.333 - C 0.70 inferior 500 0 0.333 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 39 195 0.200 0.202 0.0286 0.151 - B 25 152 0.164 0.168 0.0294 0.115 - C 114 153 0.745 0.743 0.0358 0.668 - hi_cri_all - 0.262 - 0.230 - 0.807 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 39 195 0.200 0.202 0.0282 0.149 0.261 - B 25 152 0.164 0.167 0.0295 0.113 0.231 - C 114 153 0.745 0.744 0.0346 0.669 0.807 - - Simulation details: - * Random seed: 12345 - * Credible interval width: 95% - * Number of posterior draws: 5000 - * Posterior estimation method: medians with MAD-SDs - ---- - - Code - run_trial(setup_equi_futil_only_first, seed = 12345) - Output - Single simulation result: generic binomially distributed outcome trial - * Undesirable outcome - * Initial/final common control arms: B/B - - Final status: conclusive, stopped for equivalence - Final/maximum allowed sample sizes: 500/2000 (25.0%) - Available outcome data at last adaptive analysis: 500/500 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.20 equivalence 500 1 0.333 - B 0.21 control 500 NA 0.333 - C 0.70 inferior 500 0 0.333 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 39 195 0.200 0.202 0.0286 0.151 - B 25 152 0.164 0.168 0.0294 0.115 - C 114 153 0.745 0.743 0.0358 0.668 - hi_cri_all - 0.262 - 0.230 - 0.807 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 39 195 0.200 0.202 0.0282 0.149 0.261 - B 25 152 0.164 0.167 0.0295 0.113 0.231 - C 114 153 0.745 0.744 0.0346 0.669 0.807 - - Simulation details: - * Random seed: 12345 - * Credible interval width: 95% - * Number of posterior draws: 5000 - * Posterior estimation method: medians with MAD-SDs - -# dispatch_trial_runs works - - Code - dispatch_trial_runs(1:5, setup, seeds = seeds, sparse = FALSE, cores = 1) - Output - [[1]] - Single simulation result: generic binomially distributed outcome trial - * Desirable outcome - * Initial/final common control arms: B/C - - Final status: conclusive, stopped for futility - Final/maximum allowed sample sizes: 500/2000 (25.0%) - Available outcome data at last adaptive analysis: 500/500 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.25 futile 500 0.953 0.466 - B 0.20 inferior 500 0.006 0.150 - C 0.30 control 500 NA 0.384 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 44 182 0.242 0.243 0.0309 0.1855 - B 18 123 0.146 0.151 0.0321 0.0962 - C 52 195 0.267 0.269 0.0312 0.2087 - hi_cri_all - 0.307 - 0.221 - 0.333 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 44 182 0.242 0.244 0.0308 0.1834 0.308 - B 18 123 0.146 0.150 0.0314 0.0957 0.218 - C 52 195 0.267 0.268 0.0318 0.2103 0.333 - - Simulation details: - * Random seed: none specified - * Credible interval width: 95% - * Number of posterior draws: 5000 - * Posterior estimation method: medians with MAD-SDs - - [[2]] - Single simulation result: generic binomially distributed outcome trial - * Desirable outcome - * Initial/final common control arms: B/C - - Final status: conclusive, stopped for superiority - Final/maximum allowed sample sizes: 500/2000 (25.0%) - Available outcome data at last adaptive analysis: 500/500 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.25 futile 300 0.9534 0.333 - B 0.20 inferior 500 0.0092 0.150 - C 0.30 superior 500 0.9908 0.850 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 20 116 0.172 0.176 0.0351 0.115 - B 26 119 0.218 0.221 0.0384 0.151 - C 90 265 0.340 0.341 0.0289 0.285 - hi_cri_all - 0.251 - 0.302 - 0.400 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 20 116 0.172 0.175 0.0340 0.115 0.249 - B 26 119 0.218 0.222 0.0387 0.155 0.303 - C 90 265 0.340 0.340 0.0284 0.286 0.400 - - Simulation details: - * Random seed: none specified - * Credible interval width: 95% - * Number of posterior draws: 5000 - * Posterior estimation method: medians with MAD-SDs - - [[3]] - Single simulation result: generic binomially distributed outcome trial - * Desirable outcome - * Initial/final common control arms: B/C - - Final status: conclusive, stopped for futility - Final/maximum allowed sample sizes: 700/2000 (35.0%) - Available outcome data at last adaptive analysis: 700/700 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.25 futile 700 0.9944 0.313 - B 0.20 inferior 700 0.0094 0.150 - C 0.30 control 700 NA 0.537 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 59 253 0.233 0.234 0.0266 0.185 - B 27 152 0.178 0.180 0.0312 0.124 - C 82 295 0.278 0.279 0.0265 0.229 - hi_cri_all - 0.290 - 0.249 - 0.333 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 59 253 0.233 0.235 0.0266 0.186 0.289 - B 27 152 0.178 0.181 0.0308 0.125 0.245 - C 82 295 0.278 0.279 0.0262 0.229 0.330 - - Simulation details: - * Random seed: none specified - * Credible interval width: 95% - * Number of posterior draws: 5000 - * Posterior estimation method: medians with MAD-SDs - - [[4]] - Single simulation result: generic binomially distributed outcome trial - * Desirable outcome - * Initial/final common control arms: B/C - - Final status: conclusive, stopped for futility - Final/maximum allowed sample sizes: 900/2000 (45.0%) - Available outcome data at last adaptive analysis: 900/900 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.25 futile 900 0.991 0.328 - B 0.20 inferior 900 0.008 0.150 - C 0.30 control 900 NA 0.522 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 83 318 0.261 0.262 0.0246 0.216 - B 38 191 0.199 0.201 0.0288 0.150 - C 114 391 0.292 0.291 0.0229 0.250 - hi_cri_all - 0.312 - 0.261 - 0.339 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 83 318 0.261 0.262 0.0245 0.217 0.312 - B 38 191 0.199 0.201 0.0296 0.146 0.259 - C 114 391 0.292 0.293 0.0225 0.250 0.336 - - Simulation details: - * Random seed: none specified - * Credible interval width: 95% - * Number of posterior draws: 5000 - * Posterior estimation method: medians with MAD-SDs - - [[5]] - Single simulation result: generic binomially distributed outcome trial - * Desirable outcome - * Initial/final common control arms: B/C - - Final status: conclusive, stopped for superiority - Final/maximum allowed sample sizes: 1200/2000 (60.0%) - Available outcome data at last adaptive analysis: 1200/1200 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.25 futile 300 0.9692 0.333 - B 0.20 inferior 1200 0.0096 0.150 - C 0.30 superior 1200 0.9904 0.850 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 16 88 0.182 0.186 0.0398 0.114 - B 70 292 0.240 0.241 0.0251 0.194 - C 255 820 0.311 0.311 0.0161 0.280 - hi_cri_all - 0.273 - 0.293 - 0.344 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 16 88 0.182 0.187 0.0410 0.118 0.273 - B 70 292 0.240 0.241 0.0243 0.193 0.292 - C 255 820 0.311 0.311 0.0166 0.280 0.343 - - Simulation details: - * Random seed: none specified - * Credible interval width: 95% - * Number of posterior draws: 5000 - * Posterior estimation method: medians with MAD-SDs - - ---- - - Code - dispatch_trial_runs(1:5, setup, seeds = seeds, sparse = TRUE, cores = 2, cl = cl) - Output - [[1]] - Single simulation result [saved/printed with sparse details] - - Final status: conclusive, stopped for futility - Final sample size: 500 - Available outcome data at last adaptive analysis: 500/500 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.25 futile 500 0.953 0.466 - B 0.20 inferior 500 0.006 0.150 - C 0.30 control 500 NA 0.384 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 44 182 0.242 0.243 0.0309 0.1855 - B 18 123 0.146 0.151 0.0321 0.0962 - C 52 195 0.267 0.269 0.0312 0.2087 - hi_cri_all - 0.307 - 0.221 - 0.333 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 44 182 0.242 0.244 0.0308 0.1834 0.308 - B 18 123 0.146 0.150 0.0314 0.0957 0.218 - C 52 195 0.267 0.268 0.0318 0.2103 0.333 - - Simulation details: - * Random seed: none specified - - [[2]] - Single simulation result [saved/printed with sparse details] - - Final status: conclusive, stopped for superiority - Final sample size: 500 - Available outcome data at last adaptive analysis: 500/500 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.25 futile 300 0.9534 0.333 - B 0.20 inferior 500 0.0092 0.150 - C 0.30 superior 500 0.9908 0.850 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 20 116 0.172 0.176 0.0351 0.115 - B 26 119 0.218 0.221 0.0384 0.151 - C 90 265 0.340 0.341 0.0289 0.285 - hi_cri_all - 0.251 - 0.302 - 0.400 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 20 116 0.172 0.175 0.0340 0.115 0.249 - B 26 119 0.218 0.222 0.0387 0.155 0.303 - C 90 265 0.340 0.340 0.0284 0.286 0.400 - - Simulation details: - * Random seed: none specified - - [[3]] - Single simulation result [saved/printed with sparse details] - - Final status: conclusive, stopped for futility - Final sample size: 700 - Available outcome data at last adaptive analysis: 700/700 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.25 futile 700 0.9944 0.313 - B 0.20 inferior 700 0.0094 0.150 - C 0.30 control 700 NA 0.537 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 59 253 0.233 0.234 0.0266 0.185 - B 27 152 0.178 0.180 0.0312 0.124 - C 82 295 0.278 0.279 0.0265 0.229 - hi_cri_all - 0.290 - 0.249 - 0.333 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 59 253 0.233 0.235 0.0266 0.186 0.289 - B 27 152 0.178 0.181 0.0308 0.125 0.245 - C 82 295 0.278 0.279 0.0262 0.229 0.330 - - Simulation details: - * Random seed: none specified - - [[4]] - Single simulation result [saved/printed with sparse details] - - Final status: conclusive, stopped for futility - Final sample size: 900 - Available outcome data at last adaptive analysis: 900/900 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.25 futile 900 0.991 0.328 - B 0.20 inferior 900 0.008 0.150 - C 0.30 control 900 NA 0.522 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 83 318 0.261 0.262 0.0246 0.216 - B 38 191 0.199 0.201 0.0288 0.150 - C 114 391 0.292 0.291 0.0229 0.250 - hi_cri_all - 0.312 - 0.261 - 0.339 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 83 318 0.261 0.262 0.0245 0.217 0.312 - B 38 191 0.199 0.201 0.0296 0.146 0.259 - C 114 391 0.292 0.293 0.0225 0.250 0.336 - - Simulation details: - * Random seed: none specified - - [[5]] - Single simulation result [saved/printed with sparse details] - - Final status: conclusive, stopped for superiority - Final sample size: 1200 - Available outcome data at last adaptive analysis: 1200/1200 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.25 futile 300 0.9692 0.333 - B 0.20 inferior 1200 0.0096 0.150 - C 0.30 superior 1200 0.9904 0.850 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 16 88 0.182 0.186 0.0398 0.114 - B 70 292 0.240 0.241 0.0251 0.194 - C 255 820 0.311 0.311 0.0161 0.280 - hi_cri_all - 0.273 - 0.293 - 0.344 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 16 88 0.182 0.187 0.0410 0.118 0.273 - B 70 292 0.240 0.241 0.0243 0.193 0.292 - C 255 820 0.311 0.311 0.0166 0.280 0.343 - - Simulation details: - * Random seed: none specified - - -# prog_breaks - - Code - prog_breaks(0.1, prev_n_rep = 10, n_rep_new = 20, cores = 1) - Output - $breaks - [1] 2 4 7 8 10 13 15 16 18 20 - - $start_mess - [1] "run_trials: 0/20 (0%) [starting]" - - $prog_mess - [1] "run_trials: 2/20 (10%)" "run_trials: 4/20 (20%)" - [3] "run_trials: 7/20 (30%)" "run_trials: 8/20 (40%)" - [5] "run_trials: 10/20 (50%)" "run_trials: 13/20 (60%)" - [7] "run_trials: 15/20 (70%)" "run_trials: 16/20 (80%)" - [9] "run_trials: 18/20 (90%)" "run_trials: 20/20 (100%)" - - $batches - $batches[[1]] - [1] 11 12 - - $batches[[2]] - [1] 13 14 - - $batches[[3]] - [1] 15 16 17 - - $batches[[4]] - [1] 18 - - $batches[[5]] - [1] 19 20 - - $batches[[6]] - [1] 21 22 23 - - $batches[[7]] - [1] 24 25 - - $batches[[8]] - [1] 26 - - $batches[[9]] - [1] 27 28 - - $batches[[10]] - [1] 29 30 - - - ---- - - Code - prog_breaks(0.1, prev_n_rep = 0, n_rep_new = 10, cores = 2) - Output - $breaks - [1] 2 4 6 8 10 - - $start_mess - [1] "run_trials: 0/10 (0%) [starting]" - - $prog_mess - [1] "run_trials: 2/10 (20%)" "run_trials: 4/10 (40%)" - [3] "run_trials: 6/10 (60%)" "run_trials: 8/10 (80%)" - [5] "run_trials: 10/10 (100%)" - - $batches - $batches[[1]] - [1] 1 2 - - $batches[[2]] - [1] 3 4 - - $batches[[3]] - [1] 5 6 - - $batches[[4]] - [1] 7 8 - - $batches[[5]] - [1] 9 10 - - - -# Multiple trials simulation works on multiple cores - - Code - extract_results(res) - Output - sim final_n sum_ys ratio_ys final_status superior_arm selected_arm - 1 1 500 110 0.2200000 superiority B B - 2 2 1200 273 0.2275000 superiority B B - 3 3 1200 266 0.2216667 superiority B B - 4 4 700 156 0.2228571 superiority B B - 5 5 1300 295 0.2269231 superiority B B - 6 6 600 131 0.2183333 superiority B B - 7 7 1900 420 0.2210526 superiority B B - 8 8 2000 433 0.2165000 max - 9 9 1600 353 0.2206250 superiority B B - 10 10 1000 220 0.2200000 equivalence - 11 11 1200 264 0.2200000 superiority B B - 12 12 400 94 0.2350000 superiority B B - 13 13 2000 469 0.2345000 max - 14 14 900 197 0.2188889 equivalence - 15 15 1400 303 0.2164286 superiority B B - 16 16 2000 462 0.2310000 max - 17 17 1000 215 0.2150000 equivalence - 18 18 2000 472 0.2360000 max - 19 19 1600 372 0.2325000 superiority B B - 20 20 500 135 0.2700000 superiority B B - sq_err sq_err_te - 1 1.403445e-03 NA - 2 6.546625e-05 NA - 3 8.482272e-05 NA - 4 6.368035e-04 NA - 5 1.355680e-05 NA - 6 1.071614e-03 NA - 7 1.475723e-06 NA - 8 NA NA - 9 1.059480e-05 NA - 10 NA NA - 11 1.336775e-04 NA - 12 1.254923e-03 NA - 13 NA NA - 14 NA NA - 15 3.127227e-04 NA - 16 NA NA - 17 NA NA - 18 NA NA - 19 2.154692e-05 NA - 20 4.407718e-05 NA - +# single trial simulation works + + Code + run_trial(setup_equi_futil_only_first, seed = 12345) + Output + Single simulation result: generic binomially distributed outcome trial + * Undesirable outcome + * Initial/final common control arms: B/B + + Final status: conclusive, stopped for equivalence + Final/maximum allowed sample sizes: 500/2000 (25.0%) + Available outcome data at last adaptive analysis: 500/500 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.20 equivalence 500 1 0.333 + B 0.21 control 500 NA 0.333 + C 0.70 inferior 500 0 0.333 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 39 195 0.200 0.202 0.0286 0.151 + B 25 152 0.164 0.168 0.0294 0.115 + C 114 153 0.745 0.743 0.0358 0.668 + hi_cri_all + 0.262 + 0.230 + 0.807 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 39 195 0.200 0.202 0.0282 0.149 0.261 + B 25 152 0.164 0.167 0.0295 0.113 0.231 + C 114 153 0.745 0.744 0.0346 0.669 0.807 + + Simulation details: + * Random seed: 12345 + * Credible interval width: 95% + * Number of posterior draws: 5000 + * Posterior estimation method: medians with MAD-SDs + +--- + + Code + run_trial(setup_equi_futil_only_first, seed = 12345) + Output + Single simulation result: generic binomially distributed outcome trial + * Undesirable outcome + * Initial/final common control arms: B/B + + Final status: conclusive, stopped for equivalence + Final/maximum allowed sample sizes: 500/2000 (25.0%) + Available outcome data at last adaptive analysis: 500/500 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.20 equivalence 500 1 0.333 + B 0.21 control 500 NA 0.333 + C 0.70 inferior 500 0 0.333 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 39 195 0.200 0.202 0.0286 0.151 + B 25 152 0.164 0.168 0.0294 0.115 + C 114 153 0.745 0.743 0.0358 0.668 + hi_cri_all + 0.262 + 0.230 + 0.807 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 39 195 0.200 0.202 0.0282 0.149 0.261 + B 25 152 0.164 0.167 0.0295 0.113 0.231 + C 114 153 0.745 0.744 0.0346 0.669 0.807 + + Simulation details: + * Random seed: 12345 + * Credible interval width: 95% + * Number of posterior draws: 5000 + * Posterior estimation method: medians with MAD-SDs + +# dispatch_trial_runs works + + Code + dispatch_trial_runs(1:5, setup, seeds = seeds, sparse = FALSE, cores = 1) + Output + [[1]] + Single simulation result: generic binomially distributed outcome trial + * Desirable outcome + * Initial/final common control arms: B/C + + Final status: conclusive, stopped for futility + Final/maximum allowed sample sizes: 500/2000 (25.0%) + Available outcome data at last adaptive analysis: 500/500 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.25 futile 500 0.953 0.466 + B 0.20 inferior 500 0.006 0.150 + C 0.30 control 500 NA 0.384 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 44 182 0.242 0.243 0.0309 0.1855 + B 18 123 0.146 0.151 0.0321 0.0962 + C 52 195 0.267 0.269 0.0312 0.2087 + hi_cri_all + 0.307 + 0.221 + 0.333 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 44 182 0.242 0.244 0.0308 0.1834 0.308 + B 18 123 0.146 0.150 0.0314 0.0957 0.218 + C 52 195 0.267 0.268 0.0318 0.2103 0.333 + + Simulation details: + * Random seed: none specified + * Credible interval width: 95% + * Number of posterior draws: 5000 + * Posterior estimation method: medians with MAD-SDs + + [[2]] + Single simulation result: generic binomially distributed outcome trial + * Desirable outcome + * Initial/final common control arms: B/C + + Final status: conclusive, stopped for superiority + Final/maximum allowed sample sizes: 500/2000 (25.0%) + Available outcome data at last adaptive analysis: 500/500 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.25 futile 300 0.9534 0.333 + B 0.20 inferior 500 0.0092 0.150 + C 0.30 superior 500 0.9908 0.850 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 20 116 0.172 0.176 0.0351 0.115 + B 26 119 0.218 0.221 0.0384 0.151 + C 90 265 0.340 0.341 0.0289 0.285 + hi_cri_all + 0.251 + 0.302 + 0.400 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 20 116 0.172 0.175 0.0340 0.115 0.249 + B 26 119 0.218 0.222 0.0387 0.155 0.303 + C 90 265 0.340 0.340 0.0284 0.286 0.400 + + Simulation details: + * Random seed: none specified + * Credible interval width: 95% + * Number of posterior draws: 5000 + * Posterior estimation method: medians with MAD-SDs + + [[3]] + Single simulation result: generic binomially distributed outcome trial + * Desirable outcome + * Initial/final common control arms: B/C + + Final status: conclusive, stopped for futility + Final/maximum allowed sample sizes: 700/2000 (35.0%) + Available outcome data at last adaptive analysis: 700/700 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.25 futile 700 0.9944 0.313 + B 0.20 inferior 700 0.0094 0.150 + C 0.30 control 700 NA 0.537 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 59 253 0.233 0.234 0.0266 0.185 + B 27 152 0.178 0.180 0.0312 0.124 + C 82 295 0.278 0.279 0.0265 0.229 + hi_cri_all + 0.290 + 0.249 + 0.333 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 59 253 0.233 0.235 0.0266 0.186 0.289 + B 27 152 0.178 0.181 0.0308 0.125 0.245 + C 82 295 0.278 0.279 0.0262 0.229 0.330 + + Simulation details: + * Random seed: none specified + * Credible interval width: 95% + * Number of posterior draws: 5000 + * Posterior estimation method: medians with MAD-SDs + + [[4]] + Single simulation result: generic binomially distributed outcome trial + * Desirable outcome + * Initial/final common control arms: B/C + + Final status: conclusive, stopped for futility + Final/maximum allowed sample sizes: 900/2000 (45.0%) + Available outcome data at last adaptive analysis: 900/900 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.25 futile 900 0.991 0.328 + B 0.20 inferior 900 0.008 0.150 + C 0.30 control 900 NA 0.522 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 83 318 0.261 0.262 0.0246 0.216 + B 38 191 0.199 0.201 0.0288 0.150 + C 114 391 0.292 0.291 0.0229 0.250 + hi_cri_all + 0.312 + 0.261 + 0.339 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 83 318 0.261 0.262 0.0245 0.217 0.312 + B 38 191 0.199 0.201 0.0296 0.146 0.259 + C 114 391 0.292 0.293 0.0225 0.250 0.336 + + Simulation details: + * Random seed: none specified + * Credible interval width: 95% + * Number of posterior draws: 5000 + * Posterior estimation method: medians with MAD-SDs + + [[5]] + Single simulation result: generic binomially distributed outcome trial + * Desirable outcome + * Initial/final common control arms: B/C + + Final status: conclusive, stopped for superiority + Final/maximum allowed sample sizes: 1200/2000 (60.0%) + Available outcome data at last adaptive analysis: 1200/1200 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.25 futile 300 0.9692 0.333 + B 0.20 inferior 1200 0.0096 0.150 + C 0.30 superior 1200 0.9904 0.850 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 16 88 0.182 0.186 0.0398 0.114 + B 70 292 0.240 0.241 0.0251 0.194 + C 255 820 0.311 0.311 0.0161 0.280 + hi_cri_all + 0.273 + 0.293 + 0.344 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 16 88 0.182 0.187 0.0410 0.118 0.273 + B 70 292 0.240 0.241 0.0243 0.193 0.292 + C 255 820 0.311 0.311 0.0166 0.280 0.343 + + Simulation details: + * Random seed: none specified + * Credible interval width: 95% + * Number of posterior draws: 5000 + * Posterior estimation method: medians with MAD-SDs + + +--- + + Code + dispatch_trial_runs(1:5, setup, seeds = seeds, sparse = TRUE, cores = 2, cl = cl) + Output + [[1]] + Single simulation result [saved/printed with sparse details] + + Final status: conclusive, stopped for futility + Final sample size: 500 + Available outcome data at last adaptive analysis: 500/500 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.25 futile 500 0.953 0.466 + B 0.20 inferior 500 0.006 0.150 + C 0.30 control 500 NA 0.384 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 44 182 0.242 0.243 0.0309 0.1855 + B 18 123 0.146 0.151 0.0321 0.0962 + C 52 195 0.267 0.269 0.0312 0.2087 + hi_cri_all + 0.307 + 0.221 + 0.333 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 44 182 0.242 0.244 0.0308 0.1834 0.308 + B 18 123 0.146 0.150 0.0314 0.0957 0.218 + C 52 195 0.267 0.268 0.0318 0.2103 0.333 + + Simulation details: + * Random seed: none specified + + [[2]] + Single simulation result [saved/printed with sparse details] + + Final status: conclusive, stopped for superiority + Final sample size: 500 + Available outcome data at last adaptive analysis: 500/500 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.25 futile 300 0.9534 0.333 + B 0.20 inferior 500 0.0092 0.150 + C 0.30 superior 500 0.9908 0.850 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 20 116 0.172 0.176 0.0351 0.115 + B 26 119 0.218 0.221 0.0384 0.151 + C 90 265 0.340 0.341 0.0289 0.285 + hi_cri_all + 0.251 + 0.302 + 0.400 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 20 116 0.172 0.175 0.0340 0.115 0.249 + B 26 119 0.218 0.222 0.0387 0.155 0.303 + C 90 265 0.340 0.340 0.0284 0.286 0.400 + + Simulation details: + * Random seed: none specified + + [[3]] + Single simulation result [saved/printed with sparse details] + + Final status: conclusive, stopped for futility + Final sample size: 700 + Available outcome data at last adaptive analysis: 700/700 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.25 futile 700 0.9944 0.313 + B 0.20 inferior 700 0.0094 0.150 + C 0.30 control 700 NA 0.537 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 59 253 0.233 0.234 0.0266 0.185 + B 27 152 0.178 0.180 0.0312 0.124 + C 82 295 0.278 0.279 0.0265 0.229 + hi_cri_all + 0.290 + 0.249 + 0.333 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 59 253 0.233 0.235 0.0266 0.186 0.289 + B 27 152 0.178 0.181 0.0308 0.125 0.245 + C 82 295 0.278 0.279 0.0262 0.229 0.330 + + Simulation details: + * Random seed: none specified + + [[4]] + Single simulation result [saved/printed with sparse details] + + Final status: conclusive, stopped for futility + Final sample size: 900 + Available outcome data at last adaptive analysis: 900/900 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.25 futile 900 0.991 0.328 + B 0.20 inferior 900 0.008 0.150 + C 0.30 control 900 NA 0.522 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 83 318 0.261 0.262 0.0246 0.216 + B 38 191 0.199 0.201 0.0288 0.150 + C 114 391 0.292 0.291 0.0229 0.250 + hi_cri_all + 0.312 + 0.261 + 0.339 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 83 318 0.261 0.262 0.0245 0.217 0.312 + B 38 191 0.199 0.201 0.0296 0.146 0.259 + C 114 391 0.292 0.293 0.0225 0.250 0.336 + + Simulation details: + * Random seed: none specified + + [[5]] + Single simulation result [saved/printed with sparse details] + + Final status: conclusive, stopped for superiority + Final sample size: 1200 + Available outcome data at last adaptive analysis: 1200/1200 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.25 futile 300 0.9692 0.333 + B 0.20 inferior 1200 0.0096 0.150 + C 0.30 superior 1200 0.9904 0.850 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 16 88 0.182 0.186 0.0398 0.114 + B 70 292 0.240 0.241 0.0251 0.194 + C 255 820 0.311 0.311 0.0161 0.280 + hi_cri_all + 0.273 + 0.293 + 0.344 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 16 88 0.182 0.187 0.0410 0.118 0.273 + B 70 292 0.240 0.241 0.0243 0.193 0.292 + C 255 820 0.311 0.311 0.0166 0.280 0.343 + + Simulation details: + * Random seed: none specified + + +# prog_breaks + + Code + prog_breaks(0.1, prev_n_rep = 10, n_rep_new = 20, cores = 1) + Output + $breaks + [1] 2 4 7 8 10 13 15 16 18 20 + + $start_mess + [1] "run_trials: 0/20 (0%) [starting]" + + $prog_mess + [1] "run_trials: 2/20 (10%)" "run_trials: 4/20 (20%)" + [3] "run_trials: 7/20 (30%)" "run_trials: 8/20 (40%)" + [5] "run_trials: 10/20 (50%)" "run_trials: 13/20 (60%)" + [7] "run_trials: 15/20 (70%)" "run_trials: 16/20 (80%)" + [9] "run_trials: 18/20 (90%)" "run_trials: 20/20 (100%)" + + $batches + $batches[[1]] + [1] 11 12 + + $batches[[2]] + [1] 13 14 + + $batches[[3]] + [1] 15 16 17 + + $batches[[4]] + [1] 18 + + $batches[[5]] + [1] 19 20 + + $batches[[6]] + [1] 21 22 23 + + $batches[[7]] + [1] 24 25 + + $batches[[8]] + [1] 26 + + $batches[[9]] + [1] 27 28 + + $batches[[10]] + [1] 29 30 + + + +--- + + Code + prog_breaks(0.1, prev_n_rep = 0, n_rep_new = 10, cores = 2) + Output + $breaks + [1] 2 4 6 8 10 + + $start_mess + [1] "run_trials: 0/10 (0%) [starting]" + + $prog_mess + [1] "run_trials: 2/10 (20%)" "run_trials: 4/10 (40%)" + [3] "run_trials: 6/10 (60%)" "run_trials: 8/10 (80%)" + [5] "run_trials: 10/10 (100%)" + + $batches + $batches[[1]] + [1] 1 2 + + $batches[[2]] + [1] 3 4 + + $batches[[3]] + [1] 5 6 + + $batches[[4]] + [1] 7 8 + + $batches[[5]] + [1] 9 10 + + + +# Multiple trials simulation works on multiple cores + + Code + extract_results(res) + Output + sim final_n sum_ys ratio_ys final_status superior_arm selected_arm + 1 1 500 110 0.2200000 superiority B B + 2 2 1200 273 0.2275000 superiority B B + 3 3 1200 266 0.2216667 superiority B B + 4 4 700 156 0.2228571 superiority B B + 5 5 1300 295 0.2269231 superiority B B + 6 6 600 131 0.2183333 superiority B B + 7 7 1900 420 0.2210526 superiority B B + 8 8 2000 433 0.2165000 max + 9 9 1600 353 0.2206250 superiority B B + 10 10 1000 220 0.2200000 equivalence + 11 11 1200 264 0.2200000 superiority B B + 12 12 400 94 0.2350000 superiority B B + 13 13 2000 469 0.2345000 max + 14 14 900 197 0.2188889 equivalence + 15 15 1400 303 0.2164286 superiority B B + 16 16 2000 462 0.2310000 max + 17 17 1000 215 0.2150000 equivalence + 18 18 2000 472 0.2360000 max + 19 19 1600 372 0.2325000 superiority B B + 20 20 500 135 0.2700000 superiority B B + sq_err sq_err_te + 1 1.403445e-03 NA + 2 6.546625e-05 NA + 3 8.482272e-05 NA + 4 6.368035e-04 NA + 5 1.355680e-05 NA + 6 1.071614e-03 NA + 7 1.475723e-06 NA + 8 NA NA + 9 1.059480e-05 NA + 10 NA NA + 11 1.336775e-04 NA + 12 1.254923e-03 NA + 13 NA NA + 14 NA NA + 15 3.127227e-04 NA + 16 NA NA + 17 NA NA + 18 NA NA + 19 2.154692e-05 NA + 20 4.407718e-05 NA + diff -Nru adaptr-1.3.1/tests/testthat/_snaps/summary-print.md adaptr-1.3.2/tests/testthat/_snaps/summary-print.md --- adaptr-1.3.1/tests/testthat/_snaps/summary-print.md 2023-05-02 12:06:18.000000000 +0000 +++ adaptr-1.3.2/tests/testthat/_snaps/summary-print.md 2023-08-21 11:47:47.000000000 +0000 @@ -1,371 +1,371 @@ -# print and summary of single trial work - - Code - print(res) - Output - Single simulation result: generic binomially distributed outcome trial - * Desirable outcome - * Initial/final common control arms: B/C - - Final status: conclusive, stopped for futility - Final/maximum allowed sample sizes: 900/2000 (45.0%) - Available outcome data at last adaptive analysis: 900/900 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.25 futile 900 1.0000 0.15 - B 0.20 inferior 900 0.0012 0.15 - C 0.30 control 900 NA 0.70 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 48 244 0.197 0.198 0.0258 0.151 - B 41 223 0.184 0.186 0.0257 0.138 - C 126 433 0.291 0.292 0.0222 0.249 - hi_cri_all - 0.250 - 0.238 - 0.336 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 48 244 0.197 0.198 0.0253 0.153 0.252 - B 41 223 0.184 0.186 0.0259 0.138 0.239 - C 126 433 0.291 0.291 0.0221 0.251 0.335 - - Simulation details: - * Random seed: 12345 - * Credible interval width: 95% - * Number of posterior draws: 5000 - * Posterior estimation method: medians with MAD-SDs - ---- - - Code - print(res) - Output - Single simulation result [saved/printed with sparse details] - - Final status: inconclusive, stopped at final allowed adaptive analysis - Final sample size: 2000 - Available outcome data at last adaptive analysis: 2000/2000 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.25 active NA NA 0.194 - B 0.20 active NA NA 0.656 - C 0.30 inferior 2000 0.007 0.150 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 180 742 0.243 0.243 0.0161 0.213 - B 178 841 0.212 0.212 0.0141 0.185 - C 113 417 0.271 0.272 0.0221 0.230 - hi_cri_all - 0.274 - 0.240 - 0.316 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 180 742 0.243 0.243 0.0159 0.213 0.275 - B 178 841 0.212 0.212 0.0141 0.185 0.241 - C 113 417 0.271 0.271 0.0215 0.230 0.316 - - Simulation details: - * Random seed: 12345 - ---- - - Code - print(res) - Output - Single simulation result: generic normally distributed outcome trial - * Undesirable outcome - * Initial/final common control arms: B/B - - Final status: inconclusive, stopped at final allowed adaptive analysis - Final/maximum allowed sample sizes: 1000/1000 (100.0%) - Available outcome data at last adaptive analysis: 1000/1000 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.25 active NA NA 0.333 - B 0.25 control NA NA 0.333 - C 0.30 active NA NA 0.333 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 81.8 355 0.230 0.229 0.0550 0.120 - B 69.9 328 0.213 0.213 0.0560 0.105 - C 72.1 317 0.228 0.228 0.0565 0.119 - hi_cri_all - 0.337 - 0.325 - 0.338 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 81.8 355 0.230 0.231 0.0541 0.123 0.337 - B 69.9 328 0.213 0.213 0.0551 0.104 0.320 - C 72.1 317 0.228 0.228 0.0559 0.119 0.338 - - Simulation details: - * Random seed: 12345 - * Credible interval width: 95% - * Number of posterior draws: 5000 - * Posterior estimation method: means with SDs - - Additional info: Arm SDs - A: 1; B: 1; C: 1. - -# print and summary of multiple trials work - - Code - print(res) - Output - Multiple simulation results: generic binomially distributed outcome trial - * Desirable outcome - * Number of simulations: 20 - * Number of simulations summarised: 20 (all trials) - * Common control arm: B - * Selection strategy: first control if available (otherwise no selection) - * Treatment effect compared to: no comparison - - Performance metrics (using posterior estimates from last adaptive analysis): - * Sample sizes: mean 800.0 (SD: 432.9) | median 700.0 (IQR: 475.0 to 1100.0) [range: 300.0 to 1900.0] - * Total summarised outcomes: mean 206.8 (SD: 117.6) | median 183.5 (IQR: 117.0 to 271.8) [range: 69.0 to 523.0] - * Total summarised outcome rates: mean 0.257 (SD: 0.022) | median 0.253 (IQR: 0.238 to 0.277) [range: 0.228 to 0.295] - * Conclusive: 100.0% - * Superiority: 25.0% - * Equivalence: 0.0% - * Futility: 75.0% - * Inconclusive at max sample size: 0.0% - * Selection probabilities: A: 0.0% | B: 0.0% | C: 25.0% | None: 75.0% - * RMSE: 0.02621 - * RMSE treatment effect: 0.02309 - * Ideal design percentage: 100.0% - - Simulation details: - * Simulation time: 0.829 secs - * Base random seed: 12345 - * Credible interval width: 95% - * Number of posterior draws: 5000 - * Estimation method: posterior medians with MAD-SDs - ---- - - Code - summary(res) - Output - Multiple simulation results: generic binomially distributed outcome trial - * Desirable outcome - * Number of simulations: 20 - * Number of simulations summarised: 20 (all trials) - * Common control arm: B - * Selection strategy: first control if available (otherwise no selection) - * Treatment effect compared to: no comparison - - Performance metrics (using posterior estimates from last adaptive analysis): - * Sample sizes: mean 800.0 (SD: 432.9) | median 700.0 (IQR: 475.0 to 1100.0) [range: 300.0 to 1900.0] - * Total summarised outcomes: mean 206.8 (SD: 117.6) | median 183.5 (IQR: 117.0 to 271.8) [range: 69.0 to 523.0] - * Total summarised outcome rates: mean 0.257 (SD: 0.022) | median 0.253 (IQR: 0.238 to 0.277) [range: 0.228 to 0.295] - * Conclusive: 100.0% - * Superiority: 25.0% - * Equivalence: 0.0% - * Futility: 75.0% - * Inconclusive at max sample size: 0.0% - * Selection probabilities: A: 0.0% | B: 0.0% | C: 25.0% | None: 75.0% - * RMSE: 0.02621 - * RMSE treatment effect: 0.02309 - * Ideal design percentage: 100.0% - - Simulation details: - * Simulation time: 0.829 secs - * Base random seed: 12345 - * Credible interval width: 95% - * Number of posterior draws: 5000 - * Estimation method: posterior medians with MAD-SDs - ---- - - Code - print(res) - Output - Single simulation result [saved/printed with sparse details] - - Final status: inconclusive, stopped at final allowed adaptive analysis - Final sample size: 2000 - Available outcome data at last adaptive analysis: 2000/2000 (100.0%) - - Trial results overview: - arms true_ys final_status status_look status_probs final_alloc - A 0.25 active NA NA 0.194 - B 0.20 active NA NA 0.656 - C 0.30 inferior 2000 0.007 0.150 - - Esimates from final analysis (all patients): - arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all - A 180 742 0.243 0.243 0.0161 0.213 - B 178 841 0.212 0.212 0.0141 0.185 - C 113 417 0.271 0.272 0.0221 0.230 - hi_cri_all - 0.274 - 0.240 - 0.316 - - Estimates from last adaptive analysis including each arm: - arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri - A 180 742 0.243 0.243 0.0159 0.213 0.275 - B 178 841 0.212 0.212 0.0141 0.185 0.241 - C 113 417 0.271 0.271 0.0215 0.230 0.316 - - Simulation details: - * Random seed: 12345 - ---- - - Code - summary(res) - Output - Length Class Mode - final_status 1 -none- character - final_n 1 -none- numeric - followed_n 1 -none- numeric - trial_res 25 data.frame list - seed 1 -none- numeric - sparse 1 -none- logical - -# print of trial setup works - - Code - print(res) - Output - Trial specification: generic binomially distributed outcome trial - * Desirable outcome - * Common control arm: B - - * Best arm: C - - Arms, true outcomes, starting allocation probabilities - and allocation probability limits: - arms true_ys start_probs fixed_probs min_probs max_probs - A 0.25 0.333 NA 0.15 NA - B 0.20 0.333 NA 0.15 NA - C 0.30 0.333 NA 0.15 NA - - Maximum sample size: 2000 - Maximum number of data looks: 18 - Planned data looks after: 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000 patients have reached follow-up - Number of patients randomised at each look: 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000 - - Superiority threshold: 0.99 (all analyses) - Inferiority threshold: 0.01 (all analyses) - Equivalence threshold: 0.9 (all analyses) - (checked for first and eventual new controls) - Absolute equivalence difference: 0.05 - Futility threshold: 0.95 (all analyses) - (checked for first and eventual new controls) - Absolute futility difference (in beneficial direction): 0.05 - Soften power for all analyses: 0.5 - ---- - - Code - print(res) - Output - Trial specification: generic normally distributed outcome trial - * Undesirable outcome - * Common control arm: B - * Control arm probability matched to best non-control arm - * Best arms: A and B - - Arms, true outcomes, starting allocation probabilities - and allocation probability limits: - arms true_ys start_probs fixed_probs min_probs max_probs - A 0.25 0.333 NA NA NA - B 0.25 0.333 NA NA NA - C 0.30 0.333 NA NA NA - - Maximum sample size: 1000 - Maximum number of data looks: 5 - Planned data looks after: 200, 400, 600, 800, 1000 patients have reached follow-up - Number of patients randomised at each look: 200, 400, 600, 800, 1000 - - Superiority thresholds: 0.99, 0.98, 0.97, 0.96, 0.95 - Inferiority thresholds: 0.01, 0.02, 0.03, 0.04, 0.05 - Equivalence thresholds: 0.99, 0.98, 0.97, 0.96, 0.95 - (only checked for first control) - Absolute equivalence difference: 0.05 - Futility thresholds: 0.99, 0.98, 0.97, 0.96, 0.95 - (only checked for first control) - Absolute futility difference (in beneficial direction): 0.05 - Soften power for all analyses: 1 (no softening) - - Additional info: Arm SDs - A: 1; B: 1; C: 1. - ---- - - Code - print(res) - Output - Trial specification: generic normally distributed outcome trial - * Undesirable outcome - * Common control arm: B - * Control arm probability fixed at 0.333 - * Best arms: A and B - - Arms, true outcomes, starting allocation probabilities - and allocation probability limits: - arms true_ys start_probs fixed_probs min_probs max_probs - A 0.25 0.333 0.333 NA NA - B 0.25 0.333 0.333 NA NA - C 0.30 0.333 0.333 NA NA - - Maximum sample size: 1000 - Maximum number of data looks: 5 - Planned data looks after: 200, 400, 600, 800, 1000 patients have reached follow-up - Number of patients randomised at each look: 200, 400, 600, 800, 1000 - - Superiority threshold: 0.99 (all analyses) - Inferiority threshold: 0.01 (all analyses) - No equivalence threshold - No futility threshold - Soften power for all analyses: 1 (no softening - all arms fixed) - - Additional info: Arm SDs - A: 1; B: 1; C: 1. - ---- - - Code - print(res) - Output - Trial specification: generic normally distributed outcome trial - * Undesirable outcome - * Common control arm: B - * Control arm probability matched to best non-control arm - * Best arms: A and B - - Arms, true outcomes, starting allocation probabilities - and allocation probability limits: - arms true_ys start_probs fixed_probs min_probs max_probs - A 0.25 0.333 NA NA NA - B 0.25 0.333 NA NA NA - C 0.30 0.333 NA NA NA - - Maximum sample size: 1000 - Maximum number of data looks: 5 - Planned data looks after: 200, 400, 600, 800, 1000 patients have reached follow-up - Number of patients randomised at each look: 200, 400, 600, 800, 1000 - - Superiority thresholds: 0.99, 0.98, 0.97, 0.96, 0.95 - Inferiority thresholds: 0.01, 0.02, 0.03, 0.04, 0.05 - Equivalence thresholds: 0.99, 0.98, 0.97, 0.96, 0.95 - (only checked for first control) - Absolute equivalence difference: 0.05 - Futility thresholds: 0.99, 0.98, 0.97, 0.96, 0.95 - (only checked for first control) - Absolute futility difference (in beneficial direction): 0.05 - Soften power for all analyses: 1 (no softening) - - Additional info: Arm SDs - A: 1; B: 1; C: 1. - +# print and summary of single trial work + + Code + print(res) + Output + Single simulation result: generic binomially distributed outcome trial + * Desirable outcome + * Initial/final common control arms: B/C + + Final status: conclusive, stopped for futility + Final/maximum allowed sample sizes: 900/2000 (45.0%) + Available outcome data at last adaptive analysis: 900/900 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.25 futile 900 1.0000 0.15 + B 0.20 inferior 900 0.0012 0.15 + C 0.30 control 900 NA 0.70 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 48 244 0.197 0.198 0.0258 0.151 + B 41 223 0.184 0.186 0.0257 0.138 + C 126 433 0.291 0.292 0.0222 0.249 + hi_cri_all + 0.250 + 0.238 + 0.336 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 48 244 0.197 0.198 0.0253 0.153 0.252 + B 41 223 0.184 0.186 0.0259 0.138 0.239 + C 126 433 0.291 0.291 0.0221 0.251 0.335 + + Simulation details: + * Random seed: 12345 + * Credible interval width: 95% + * Number of posterior draws: 5000 + * Posterior estimation method: medians with MAD-SDs + +--- + + Code + print(res) + Output + Single simulation result [saved/printed with sparse details] + + Final status: inconclusive, stopped at final allowed adaptive analysis + Final sample size: 2000 + Available outcome data at last adaptive analysis: 2000/2000 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.25 active NA NA 0.194 + B 0.20 active NA NA 0.656 + C 0.30 inferior 2000 0.007 0.150 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 180 742 0.243 0.243 0.0161 0.213 + B 178 841 0.212 0.212 0.0141 0.185 + C 113 417 0.271 0.272 0.0221 0.230 + hi_cri_all + 0.274 + 0.240 + 0.316 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 180 742 0.243 0.243 0.0159 0.213 0.275 + B 178 841 0.212 0.212 0.0141 0.185 0.241 + C 113 417 0.271 0.271 0.0215 0.230 0.316 + + Simulation details: + * Random seed: 12345 + +--- + + Code + print(res) + Output + Single simulation result: generic normally distributed outcome trial + * Undesirable outcome + * Initial/final common control arms: B/B + + Final status: inconclusive, stopped at final allowed adaptive analysis + Final/maximum allowed sample sizes: 1000/1000 (100.0%) + Available outcome data at last adaptive analysis: 1000/1000 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.25 active NA NA 0.333 + B 0.25 control NA NA 0.333 + C 0.30 active NA NA 0.333 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 81.8 355 0.230 0.229 0.0550 0.120 + B 69.9 328 0.213 0.213 0.0560 0.105 + C 72.1 317 0.228 0.228 0.0565 0.119 + hi_cri_all + 0.337 + 0.325 + 0.338 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 81.8 355 0.230 0.231 0.0541 0.123 0.337 + B 69.9 328 0.213 0.213 0.0551 0.104 0.320 + C 72.1 317 0.228 0.228 0.0559 0.119 0.338 + + Simulation details: + * Random seed: 12345 + * Credible interval width: 95% + * Number of posterior draws: 5000 + * Posterior estimation method: means with SDs + + Additional info: Arm SDs - A: 1; B: 1; C: 1. + +# print and summary of multiple trials work + + Code + print(res) + Output + Multiple simulation results: generic binomially distributed outcome trial + * Desirable outcome + * Number of simulations: 20 + * Number of simulations summarised: 20 (all trials) + * Common control arm: B + * Selection strategy: first control if available (otherwise no selection) + * Treatment effect compared to: no comparison + + Performance metrics (using posterior estimates from last adaptive analysis): + * Sample sizes: mean 800.0 (SD: 432.9) | median 700.0 (IQR: 475.0 to 1100.0) [range: 300.0 to 1900.0] + * Total summarised outcomes: mean 206.8 (SD: 117.6) | median 183.5 (IQR: 117.0 to 271.8) [range: 69.0 to 523.0] + * Total summarised outcome rates: mean 0.257 (SD: 0.022) | median 0.253 (IQR: 0.238 to 0.277) [range: 0.228 to 0.295] + * Conclusive: 100.0% + * Superiority: 25.0% + * Equivalence: 0.0% + * Futility: 75.0% + * Inconclusive at max sample size: 0.0% + * Selection probabilities: A: 0.0% | B: 0.0% | C: 25.0% | None: 75.0% + * RMSE: 0.02621 + * RMSE treatment effect: 0.02309 + * Ideal design percentage: 100.0% + + Simulation details: + * Simulation time: 0.73 secs + * Base random seed: 12345 + * Credible interval width: 95% + * Number of posterior draws: 5000 + * Estimation method: posterior medians with MAD-SDs + +--- + + Code + summary(res) + Output + Multiple simulation results: generic binomially distributed outcome trial + * Desirable outcome + * Number of simulations: 20 + * Number of simulations summarised: 20 (all trials) + * Common control arm: B + * Selection strategy: first control if available (otherwise no selection) + * Treatment effect compared to: no comparison + + Performance metrics (using posterior estimates from last adaptive analysis): + * Sample sizes: mean 800.0 (SD: 432.9) | median 700.0 (IQR: 475.0 to 1100.0) [range: 300.0 to 1900.0] + * Total summarised outcomes: mean 206.8 (SD: 117.6) | median 183.5 (IQR: 117.0 to 271.8) [range: 69.0 to 523.0] + * Total summarised outcome rates: mean 0.257 (SD: 0.022) | median 0.253 (IQR: 0.238 to 0.277) [range: 0.228 to 0.295] + * Conclusive: 100.0% + * Superiority: 25.0% + * Equivalence: 0.0% + * Futility: 75.0% + * Inconclusive at max sample size: 0.0% + * Selection probabilities: A: 0.0% | B: 0.0% | C: 25.0% | None: 75.0% + * RMSE: 0.02621 + * RMSE treatment effect: 0.02309 + * Ideal design percentage: 100.0% + + Simulation details: + * Simulation time: 0.73 secs + * Base random seed: 12345 + * Credible interval width: 95% + * Number of posterior draws: 5000 + * Estimation method: posterior medians with MAD-SDs + +--- + + Code + print(res) + Output + Single simulation result [saved/printed with sparse details] + + Final status: inconclusive, stopped at final allowed adaptive analysis + Final sample size: 2000 + Available outcome data at last adaptive analysis: 2000/2000 (100.0%) + + Trial results overview: + arms true_ys final_status status_look status_probs final_alloc + A 0.25 active NA NA 0.194 + B 0.20 active NA NA 0.656 + C 0.30 inferior 2000 0.007 0.150 + + Esimates from final analysis (all patients): + arms sum_ys_all ns_all raw_ests_all post_ests_all post_errs_all lo_cri_all + A 180 742 0.243 0.243 0.0161 0.213 + B 178 841 0.212 0.212 0.0141 0.185 + C 113 417 0.271 0.272 0.0221 0.230 + hi_cri_all + 0.274 + 0.240 + 0.316 + + Estimates from last adaptive analysis including each arm: + arms sum_ys ns raw_ests post_ests post_errs lo_cri hi_cri + A 180 742 0.243 0.243 0.0159 0.213 0.275 + B 178 841 0.212 0.212 0.0141 0.185 0.241 + C 113 417 0.271 0.271 0.0215 0.230 0.316 + + Simulation details: + * Random seed: 12345 + +--- + + Code + summary(res) + Output + Length Class Mode + final_status 1 -none- character + final_n 1 -none- numeric + followed_n 1 -none- numeric + trial_res 25 data.frame list + seed 1 -none- numeric + sparse 1 -none- logical + +# print of trial setup works + + Code + print(res) + Output + Trial specification: generic binomially distributed outcome trial + * Desirable outcome + * Common control arm: B + + * Best arm: C + + Arms, true outcomes, starting allocation probabilities + and allocation probability limits: + arms true_ys start_probs fixed_probs min_probs max_probs + A 0.25 0.333 NA 0.15 NA + B 0.20 0.333 NA 0.15 NA + C 0.30 0.333 NA 0.15 NA + + Maximum sample size: 2000 + Maximum number of data looks: 18 + Planned data looks after: 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000 patients have reached follow-up + Number of patients randomised at each look: 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000 + + Superiority threshold: 0.99 (all analyses) + Inferiority threshold: 0.01 (all analyses) + Equivalence threshold: 0.9 (all analyses) + (checked for first and eventual new controls) + Absolute equivalence difference: 0.05 + Futility threshold: 0.95 (all analyses) + (checked for first and eventual new controls) + Absolute futility difference (in beneficial direction): 0.05 + Soften power for all analyses: 0.5 + +--- + + Code + print(res) + Output + Trial specification: generic normally distributed outcome trial + * Undesirable outcome + * Common control arm: B + * Control arm probability matched to best non-control arm + * Best arms: A and B + + Arms, true outcomes, starting allocation probabilities + and allocation probability limits: + arms true_ys start_probs fixed_probs min_probs max_probs + A 0.25 0.333 NA NA NA + B 0.25 0.333 NA NA NA + C 0.30 0.333 NA NA NA + + Maximum sample size: 1000 + Maximum number of data looks: 5 + Planned data looks after: 200, 400, 600, 800, 1000 patients have reached follow-up + Number of patients randomised at each look: 200, 400, 600, 800, 1000 + + Superiority thresholds: 0.99, 0.98, 0.97, 0.96, 0.95 + Inferiority thresholds: 0.01, 0.02, 0.03, 0.04, 0.05 + Equivalence thresholds: 0.99, 0.98, 0.97, 0.96, 0.95 + (only checked for first control) + Absolute equivalence difference: 0.05 + Futility thresholds: 0.99, 0.98, 0.97, 0.96, 0.95 + (only checked for first control) + Absolute futility difference (in beneficial direction): 0.05 + Soften power for all analyses: 1 (no softening) + + Additional info: Arm SDs - A: 1; B: 1; C: 1. + +--- + + Code + print(res) + Output + Trial specification: generic normally distributed outcome trial + * Undesirable outcome + * Common control arm: B + * Control arm probability fixed at 0.333 + * Best arms: A and B + + Arms, true outcomes, starting allocation probabilities + and allocation probability limits: + arms true_ys start_probs fixed_probs min_probs max_probs + A 0.25 0.333 0.333 NA NA + B 0.25 0.333 0.333 NA NA + C 0.30 0.333 0.333 NA NA + + Maximum sample size: 1000 + Maximum number of data looks: 5 + Planned data looks after: 200, 400, 600, 800, 1000 patients have reached follow-up + Number of patients randomised at each look: 200, 400, 600, 800, 1000 + + Superiority threshold: 0.99 (all analyses) + Inferiority threshold: 0.01 (all analyses) + No equivalence threshold + No futility threshold + Soften power for all analyses: 1 (no softening - all arms fixed) + + Additional info: Arm SDs - A: 1; B: 1; C: 1. + +--- + + Code + print(res) + Output + Trial specification: generic normally distributed outcome trial + * Undesirable outcome + * Common control arm: B + * Control arm probability matched to best non-control arm + * Best arms: A and B + + Arms, true outcomes, starting allocation probabilities + and allocation probability limits: + arms true_ys start_probs fixed_probs min_probs max_probs + A 0.25 0.333 NA NA NA + B 0.25 0.333 NA NA NA + C 0.30 0.333 NA NA NA + + Maximum sample size: 1000 + Maximum number of data looks: 5 + Planned data looks after: 200, 400, 600, 800, 1000 patients have reached follow-up + Number of patients randomised at each look: 200, 400, 600, 800, 1000 + + Superiority thresholds: 0.99, 0.98, 0.97, 0.96, 0.95 + Inferiority thresholds: 0.01, 0.02, 0.03, 0.04, 0.05 + Equivalence thresholds: 0.99, 0.98, 0.97, 0.96, 0.95 + (only checked for first control) + Absolute equivalence difference: 0.05 + Futility thresholds: 0.99, 0.98, 0.97, 0.96, 0.95 + (only checked for first control) + Absolute futility difference (in beneficial direction): 0.05 + Soften power for all analyses: 1 (no softening) + + Additional info: Arm SDs - A: 1; B: 1; C: 1. +