Skip to content

Commit

Permalink
Merge pull request #64 from rpact-com/dev/4.1.1
Browse files Browse the repository at this point in the history
Dev/4.1.1
  • Loading branch information
fpahlke authored Nov 7, 2024
2 parents 1bcaa28 + ed992d6 commit d0eecb9
Show file tree
Hide file tree
Showing 96 changed files with 992 additions and 64,773 deletions.
40 changes: 38 additions & 2 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ jobs:
config: ${{ github.event.inputs.config }}
id: rhub-setup

# Set the GitHub username and email for commits
- name: Set GitHub user
run: |
git config --global user.name "RPACT GitHub Action RHub"
git config --global user.email "[email protected]"
linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
Expand All @@ -51,7 +57,17 @@ jobs:
image: ${{ matrix.config.container }}

steps:
- uses: r-hub/actions/checkout@v1
- name: Checkout this package repository
uses: r-hub/actions/checkout@v1
- name: Checkout the private tests repository
uses: actions/checkout@v4
with:
repository: 'rpact-com/rpact.tests'
ref: main
token: ${{ secrets.RPACT_TESTS_ACCESS_TOKEN }}
path: 'private-tests'
sparse-checkout: |
tests
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
Expand All @@ -60,6 +76,11 @@ jobs:
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- name: Add private tests
run: |
find ./private-tests/tests -maxdepth 1 -name \*.R -exec cp {} ./tests \;
find ./private-tests/tests/testthat -maxdepth 1 -name \*.R -exec cp {} ./tests/testthat \;
shell: bash
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
Expand All @@ -76,7 +97,17 @@ jobs:
config: ${{ fromJson(needs.setup.outputs.platforms) }}

steps:
- uses: r-hub/actions/checkout@v1
- name: Checkout this package repository
uses: r-hub/actions/checkout@v1
- name: Checkout the private tests repository
uses: actions/checkout@v4
with:
repository: 'rpact-com/rpact.tests'
ref: main
token: ${{ secrets.RPACT_TESTS_ACCESS_TOKEN }}
path: 'private-tests'
sparse-checkout: |
tests
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
Expand All @@ -89,6 +120,11 @@ jobs:
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- name: Add private tests
run: |
find ./private-tests/tests -maxdepth 1 -name \*.R -exec cp {} ./tests \;
find ./private-tests/tests/testthat -maxdepth 1 -name \*.R -exec cp {} ./tests/testthat \;
shell: bash
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
Expand Down
35 changes: 31 additions & 4 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help

on:
push:
branches: [main, master]
branches:
- main
pull_request:
branches: [main, master]
branches:
- main
- 'dev/*'
workflow_dispatch:

name: test-coverage
Expand All @@ -16,17 +20,40 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4
# Set the GitHub username and email for commits
- name: Set GitHub user
run: |
git config --global user.name "RPACT GitHub Action CovR"
git config --global user.email "[email protected]"
- name: Checkout this package repository
uses: actions/checkout@v4

- name: Checkout the private tests repository
uses: actions/checkout@v4
with:
repository: 'rpact-com/rpact.tests'
ref: main
token: ${{ secrets.RPACT_TESTS_ACCESS_TOKEN }}
path: 'private-tests'
sparse-checkout: |
tests
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
extra-packages: any::covr, any::xml2
needs: coverage

- name: Add private tests
run: |
find ./private-tests/tests -maxdepth 1 -name \*.R -exec cp {} ./tests \;
find ./private-tests/tests/testthat -maxdepth 1 -name \*.R -exec cp {} ./tests/testthat \;
shell: bash

- name: Test coverage
run: |
Sys.setenv("RPACT_COMPLETE_UNIT_TEST_SET_ENABLED" = TRUE)
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ testthat-problems.rds
/rpact.Rproj
/figure/create_designPlan-1.png
/figure/create_designPlan-2.png
/hs_err_pid51656.log
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rpact
Title: Confirmatory Adaptive Clinical Trial Design and Analysis
Version: 4.1.0
Date: 2024-09-27
Version: 4.1.0.9268
Date: 2024-11-07
Authors@R: c(
person(
given = "Gernot",
Expand Down Expand Up @@ -93,7 +93,7 @@ Collate:
'class_design_plan.R'
'class_design_power_and_asn.R'
'class_event_probabilities.R'
'f_simulation_base_count_data.R'
'f_simulation_base_counts.R'
'f_simulation_utilities.R'
'f_simulation_base_survival.R'
'class_simulation_results.R'
Expand All @@ -115,7 +115,7 @@ Collate:
'f_core_output_formats.R'
'f_design_fisher_combination_test.R'
'f_design_group_sequential.R'
'f_design_plan_count_data.R'
'f_design_plan_counts.R'
'f_design_plan_means.R'
'f_design_plan_plot.R'
'f_design_plan_rates.R'
Expand Down
17 changes: 14 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
# rpact 4.1.1

## New features

* For the functions `getSimulationMultiArmMeans()`, `getSimulationMultiArmRates()`, and `getSimulationMultiArmSurvival()` it is now possible to specify a parameter `doseLevels` to define the dose levels for a `linear` or `sigmoidEmax` dose-response relationship (see feature request [#63](https://github.com/rpact-com/rpact/issues/63))

## Improvements, issues, and changes

* Issue [#61](https://github.com/rpact-com/rpact/issues/61)) fixed
* Minor improvements


# rpact 4.1.0

## New features

* The new function `getSimulationCounts()` can be used to perform power simulations for clinical trials with negative binomial distributed count data. The function returns the simulated power, stopping probabilities, conditional power, and expected sample size for testing mean rates for negative binomial distributed event numbers in the two treatment groups testing situation.
* The new function `getSimulationCounts()` can be used to perform power simulations for clinical trials with negative binomial distributed count data. The function returns the simulated power, stopping probabilities, conditional power, and expected sample size for testing mean rates for negative binomial distributed event numbers in the two treatment groups testing situation
* The functions `getDesignGroupSequential()`, `getDesignInverseNormal()`, and `getDesignFisher()` now support the argument `directionUpper` to specify the direction of the alternative for one-sided testing early at the design phase, see enhancement [#26](https://github.com/rpact-com/rpact/issues/26)
* `getSampleSizeCounts()` and `getPowerCounts()` output boundary values also on the treatment effect scale, see enhancement [#40](https://github.com/rpact-com/rpact/issues/40)
* The `fetch()` and `obtain()` functions can be used to extract multiple parameters from an rpact result object and support various output formats
Expand All @@ -24,9 +35,9 @@

## New features

* All reference classes in the package have been replaced by [R6](https://cran.r-project.org/package=R6) classes. This change brings significant advantages, including improved performance, more flexible and cleaner object-oriented programming, and enhanced encapsulation of methods and properties. The transition to R6 classes allows for more efficient memory management and faster execution, making the package more robust and scalable. Additionally, R6 classes provide a more intuitive and user-friendly interface for developers, facilitating the creation and maintenance of complex data structures and workflows.
* All reference classes in the package have been replaced by [R6](https://cran.r-project.org/package=R6) classes. This change brings significant advantages, including improved performance, more flexible and cleaner object-oriented programming, and enhanced encapsulation of methods and properties. The transition to R6 classes allows for more efficient memory management and faster execution, making the package more robust and scalable. Additionally, R6 classes provide a more intuitive and user-friendly interface for developers, facilitating the creation and maintenance of complex data structures and workflows
* Extension of the function `getPerformanceScore()` for sample size recalculation rules to the setting of binary endpoints according to [Bokelmann et al. (2024)](https://doi.org/10.1186/s12874-024-02150-4)
* The `getSimulationMultiArmMeans()`, `getSimulationMultiArmRates()`, and `getSimulationMultiArmSurvival()` functions now support an enhanced `selectArmsFunction` argument. Previously, only `effectVector` and `stage` were allowed as arguments. Now, users can optionally utilize additional arguments for more powerful custom function implementations, including `conditionalPower`, `conditionalCriticalValue`, `plannedSubjects/plannedEvents`, `allocationRatioPlanned`, `selectedArms`, `thetaH1` (for means and survival), `stDevH1` (for means), `overallEffects`, and for rates additionally: `piTreatmentsH1`, `piControlH1`, `overallRates`, and `overallRatesControl`.
* The `getSimulationMultiArmMeans()`, `getSimulationMultiArmRates()`, and `getSimulationMultiArmSurvival()` functions now support an enhanced `selectArmsFunction` argument. Previously, only `effectVector` and `stage` were allowed as arguments. Now, users can optionally utilize additional arguments for more powerful custom function implementations, including `conditionalPower`, `conditionalCriticalValue`, `plannedSubjects/plannedEvents`, `allocationRatioPlanned`, `selectedArms`, `thetaH1` (for means and survival), `stDevH1` (for means), `overallEffects`, and for rates additionally: `piTreatmentsH1`, `piControlH1`, `overallRates`, and `overallRatesControl`
* Same as above for `getSimulationEnrichmentMeans()`, `getSimulationEnrichmentRates()`, and `getSimulationEnrichmentSurvival()`. Specifically, support for population selection with `selectPopulationsFunction` argument based on predictive/posterior probabilities added (see [#32](https://github.com/rpact-com/rpact/issues/32))
* The `fetch()` and `obtain()` functions can be used to extract a single parameter from an rpact result object, which is useful for writing pipe-operator linked commands

Expand Down
63 changes: 49 additions & 14 deletions R/class_analysis_results.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
## |
## | Contact us for information about our services: [email protected]
## |
## | File version: $Revision: 8180 $
## | Last changed: $Date: 2024-09-06 10:13:14 +0200 (Fr, 06 Sep 2024) $
## | File version: $Revision: 8360 $
## | Last changed: $Date: 2024-11-04 15:40:23 +0100 (Mo, 04 Nov 2024) $
## | Last changed by: $Author: pahlke $
## |

Expand Down Expand Up @@ -1942,9 +1942,22 @@ plot.AnalysisResults <- function(x, y, ...,
return(.createPlotResultObject(plotList, grid))
}

.plotAnalysisResultsRCI <- function(...,
x, y, nPlanned, allocationRatioPlanned, main, xlab, ylab,
legendTitle, palette, legendPosition, showSource, analysisResultsName, plotSettings = NULL) {
.plotAnalysisResultsRCI <- function(
...,
x,
y,
nPlanned,
allocationRatioPlanned,
main,
xlab,
ylab,
legendTitle,
palette,
legendPosition,
showSource,
analysisResultsName,
plotSettings = NULL) {

.assertIsAnalysisResults(x)
.warnInCaseOfUnknownArguments(functionName = "plot", ignore = c("treatmentArms", "populations"), ...)

Expand Down Expand Up @@ -2103,10 +2116,24 @@ plot.AnalysisResults <- function(x, y, ...,
return(result)
}

.plotAnalysisResults <- function(...,
x, y, type, nPlanned, allocationRatioPlanned, main, xlab, ylab,
legendTitle, palette, legendPosition, showSource, functionCall,
analysisResultsName, plotSettings = NULL) {
.plotAnalysisResults <- function(
...,
x,
y,
type,
nPlanned,
allocationRatioPlanned,
main,
xlab,
ylab,
legendTitle,
palette,
legendPosition,
showSource,
functionCall,
analysisResultsName,
plotSettings = NULL) {

.assertIsSingleInteger(type, "type", naAllowed = FALSE, validateType = FALSE)
if (!(type %in% c(1, 2))) {
stop(C_EXCEPTION_TYPE_ILLEGAL_ARGUMENT, "'type' (", type, ") is not allowed; must be 1 or 2")
Expand All @@ -2117,12 +2144,20 @@ plot.AnalysisResults <- function(x, y, ...,

if (type == 2) {
return(.plotAnalysisResultsRCI(
x = x, y = y, nPlanned = nPlanned, allocationRatioPlanned = allocationRatioPlanned,
main = main, xlab = xlab, ylab = ylab,
legendTitle = legendTitle, palette = palette,
legendPosition = legendPosition, showSource = showSource,
x = x,
y = y,
nPlanned = nPlanned,
allocationRatioPlanned = allocationRatioPlanned,
main = main,
xlab = xlab,
ylab = ylab,
legendTitle = legendTitle,
palette = palette,
legendPosition = legendPosition,
showSource = showSource,
analysisResultsName = analysisResultsName,
plotSettings = plotSettings, ...
plotSettings = plotSettings,
...
))
}

Expand Down
29 changes: 19 additions & 10 deletions R/class_core_parameter_set.R
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,8 @@ ParameterSet <- R6::R6Class("ParameterSet",
"adaptations",
"adjustedStageWisePValues",
"overallAdjustedTestStatistics",
"plannedCalendarTime"
"plannedCalendarTime",
"doseLevels"
))]

if (!is.null(parameterSet[[".piecewiseSurvivalTime"]]) &&
Expand Down Expand Up @@ -997,9 +998,12 @@ ParameterSet <- R6::R6Class("ParameterSet",

if (length(parameterValues) == numberOfStages &&
parameterName %in% c(
"plannedEvents", "plannedSubjects",
"minNumberOfEventsPerStage", "maxNumberOfEventsPerStage",
"minNumberOfSubjectsPerStage", "maxNumberOfSubjectsPerStage",
"plannedEvents",
"plannedSubjects",
"minNumberOfEventsPerStage",
"maxNumberOfEventsPerStage",
"minNumberOfSubjectsPerStage",
"maxNumberOfSubjectsPerStage",
"allocationRatioPlanned"
)) {
values <- c()
Expand All @@ -1010,11 +1014,16 @@ ParameterSet <- R6::R6Class("ParameterSet",
}

if (parameterName %in% c(
"accrualTime", "accrualIntensity",
"plannedEvents", "plannedSubjects",
"minNumberOfEventsPerStage", "maxNumberOfEventsPerStage",
"minNumberOfSubjectsPerStage", "maxNumberOfSubjectsPerStage",
"piecewiseSurvivalTime", "lambda2"
"accrualTime",
"accrualIntensity",
"plannedEvents",
"plannedSubjects",
"minNumberOfEventsPerStage",
"maxNumberOfEventsPerStage",
"minNumberOfSubjectsPerStage",
"maxNumberOfSubjectsPerStage",
"piecewiseSurvivalTime",
"lambda2"
)) {
return(NULL)
}
Expand Down Expand Up @@ -1146,7 +1155,7 @@ ParameterSet <- R6::R6Class("ParameterSet",
for (parameterName in parameterNames) {
tryCatch(
{
if (!(parameterName %in% c("stages", "adaptations", "effectList", "plannedCalendarTime")) &&
if (!(parameterName %in% c("stages", "adaptations", "effectList", "doseLevels", "plannedCalendarTime")) &&
!grepl("Function$", parameterName) &&
(is.null(variedParameter) || parameterName != variedParameter)) {
columnValues <- .getDataFrameColumnValues(
Expand Down
Loading

0 comments on commit d0eecb9

Please sign in to comment.