Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release candidate RC2 #56

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 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.0.1.9261
Date: 2024-09-20
Version: 4.0.1.9262
Date: 2024-09-23
Authors@R: c(
person(
given = "Gernot",
Expand Down
103 changes: 40 additions & 63 deletions R/class_summary.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: 8246 $
## | Last changed: $Date: 2024-09-20 12:10:36 +0200 (Fr, 20 Sep 2024) $
## | File version: $Revision: 8252 $
## | Last changed: $Date: 2024-09-23 13:03:24 +0200 (Mo, 23 Sep 2024) $
## | Last changed by: $Author: pahlke $
## |

Expand Down Expand Up @@ -1035,7 +1035,7 @@ SummaryFactory <- R6::R6Class("SummaryFactory",
}
} else if (!is.null(parameterName) && length(parameterName) == 1 && !is.na(parameterName)) {
if (parameterName == "futilityBounds") {
values[!is.na(values) & values <= -6] <- -Inf
values[!is.na(values) & values <= C_FUTILITY_BOUNDS_DEFAULT] <- -Inf
} else if (parameterName %in% c(
"criticalValues",
"decisionCriticalValue", "overallAdjustedTestStatistics"
Expand Down Expand Up @@ -1899,7 +1899,7 @@ SummaryFactory <- R6::R6Class("SummaryFactory",
}
if (!.isDelayedInformationEnabled(design = design) &&
((.isTrialDesignInverseNormalOrGroupSequential(design) &&
any(design$futilityBounds > -6, na.rm = TRUE)) ||
any(design$futilityBounds > C_FUTILITY_BOUNDS_DEFAULT, na.rm = TRUE)) ||
(.isTrialDesignFisher(design) && any(design$alpha0Vec < 1)))) {
header <- .concatenateSummaryText(
header,
Expand Down Expand Up @@ -3194,7 +3194,7 @@ SummaryFactory <- R6::R6Class("SummaryFactory",
)
}
} else {
if (any(design$futilityBounds > -6)) {
if (any(design$futilityBounds > C_FUTILITY_BOUNDS_DEFAULT)) {
summaryFactory$addParameter(design,
parameterName = "futilityBounds",
parameterCaption = .getSummaryParameterCaptionFutilityBounds(design),
Expand Down Expand Up @@ -3462,18 +3462,6 @@ SummaryFactory <- R6::R6Class("SummaryFactory",
)
}

if (simulationEnabled && (multiArmEnabled || enrichmentEnabled || countDataEnabled)) {
if (!planningEnabled && !baseEnabled && any(designPlan$futilityPerStage != 0)) {
summaryFactory$addParameter(designPlan,
parameterName = "futilityPerStage",
parameterCaption = "Exit probability for futility", # (under H1)
roundDigits = digitSettings$digitsProbabilities,
smoothedZeroFormat = TRUE,
transpose = TRUE
)
}
}

if (baseEnabled) {
parameterName <- "rejectPerStage"
if (design$kMax == 1) {
Expand Down Expand Up @@ -3556,15 +3544,6 @@ SummaryFactory <- R6::R6Class("SummaryFactory",
}

if (simulationEnabled && (multiArmEnabled || enrichmentEnabled || countDataEnabled)) {
if (!planningEnabled && !baseEnabled && any(designPlan$futilityPerStage != 0)) {
summaryFactory$addParameter(designPlan,
parameterName = "futilityPerStage",
parameterCaption = "Exit probability for futility", # (under H1)
roundDigits = digitSettings$digitsProbabilities,
smoothedZeroFormat = TRUE,
transpose = TRUE
)
}

if (survivalEnabled) {
summaryFactory$addParameter(designPlan,
Expand Down Expand Up @@ -3820,17 +3799,6 @@ SummaryFactory <- R6::R6Class("SummaryFactory",
)
}

if (baseEnabled && !planningEnabled && !is.null(designPlan[["futilityPerStage"]]) &&
!any(is.na(designPlan[["futilityPerStage"]])) &&
any(designPlan$futilityPerStage != 0) && any(designPlan$futilityPerStage > 1e-08)) {
summaryFactory$addParameter(designPlan,
parameterName = "futilityPerStage",
parameterCaption = "Exit probability for futility", # (under H1)
roundDigits = digitSettings$digitsProbabilities,
smoothedZeroFormat = TRUE
)
}

probsH0 <- NULL
probsH1 <- NULL
if (design$kMax > 1) {
Expand Down Expand Up @@ -3862,24 +3830,6 @@ SummaryFactory <- R6::R6Class("SummaryFactory",
}
}

if (baseEnabled && simulationEnabled && design$kMax > 1) {
values <- NULL
if (!is.null(probsH1)) {
if (is.matrix(probsH1$rejectPerStage)) {
values <- matrix(probsH1$rejectPerStage[1:(design$kMax - 1), ], ncol = ncol(probsH1$rejectPerStage))
} else {
values <- probsH1$rejectPerStage[1:(design$kMax - 1)]
}
}
summaryFactory$addParameter(designPlan,
parameterName = "rejectPerStage",
values = values,
parameterCaption = "Exit probability for efficacy",
roundDigits = digitSettings$digitsProbabilities,
smoothedZeroFormat = TRUE
)
}

if (planningEnabled) {
if (!is.null(probsH1) && !is.null(probsH0) && design$kMax > 1) {
probsH0$earlyStop <- matrix(probsH0$earlyStop[1:(design$kMax - 1), 1], ncol = 1)
Expand All @@ -3897,7 +3847,7 @@ SummaryFactory <- R6::R6Class("SummaryFactory",
probsH1$rejectPerStage <- probsH1$rejectPerStage[1:(design$kMax - 1)]
}

if (any(design$futilityBounds > -6)) {
if (any(design$futilityBounds > C_FUTILITY_BOUNDS_DEFAULT)) {
if (is.matrix(probsH1$earlyStop)) {
probsH1$earlyStop <- matrix(probsH1$earlyStop[1:(design$kMax - 1), ],
ncol = ncol(probsH1$earlyStop)
Expand Down Expand Up @@ -3946,22 +3896,18 @@ SummaryFactory <- R6::R6Class("SummaryFactory",
)
}

if (any(design$futilityBounds > -6)) {
if (any(design$futilityBounds > C_FUTILITY_BOUNDS_DEFAULT, na.rm = TRUE)) {
summaryFactory$addParameter(probsH0,
parameterName = "futilityPerStage",
parameterCaption = "Exit probability for futility (under H0)",
roundDigits = digitSettings$digitsProbabilities,
smoothedZeroFormat = TRUE
)
x <- designPlan
if (is.null(x)) {
x <- design
}
futilityPerStage <- probsH1$futilityPerStage
if (.isTrialDesignPlan(x) && x$.isSampleSizeObject() && ncol(futilityPerStage) > 1) {
if (designPlan$.isSampleSizeObject() && ncol(futilityPerStage) > 1) {
futilityPerStage <- futilityPerStage[, 1]
}
summaryFactory$addParameter(x,
summaryFactory$addParameter(designPlan,
parameterName = "futilityPerStage",
values = futilityPerStage,
parameterCaption = "Exit probability for futility (under H1)",
Expand All @@ -3970,6 +3916,37 @@ SummaryFactory <- R6::R6Class("SummaryFactory",
)
}
}
} else {
rejectPerStageValues <- NULL
if (!is.null(probsH1)) {
if (is.matrix(probsH1$rejectPerStage)) {
rejectPerStageValues <- matrix(probsH1$rejectPerStage[1:(design$kMax - 1), ], ncol = ncol(probsH1$rejectPerStage))
} else {
rejectPerStageValues <- probsH1$rejectPerStage[1:(design$kMax - 1)]
}
}
if (!is.null(rejectPerStageValues)) {
summaryFactory$addParameter(designPlan,
parameterName = "rejectPerStage",
values = rejectPerStageValues,
parameterCaption = "Exit probability for efficacy",
roundDigits = digitSettings$digitsProbabilities,
smoothedZeroFormat = TRUE
)
}

if (any(design$futilityBounds > C_FUTILITY_BOUNDS_DEFAULT, na.rm = TRUE) &&
!is.null(designPlan[["futilityPerStage"]]) &&
!any(is.na(designPlan[["futilityPerStage"]])) &&
any(designPlan$futilityPerStage != 0) && any(designPlan$futilityPerStage > 1e-08)) {
summaryFactory$addParameter(designPlan,
parameterName = "futilityPerStage",
parameterCaption = "Exit probability for futility", # under H1
roundDigits = digitSettings$digitsProbabilities,
smoothedZeroFormat = TRUE,
transpose = grepl("MultiArm|Enrichment", .getClassName(designPlan))
)
}
}

if (!is.null(performanceScore)) {
Expand Down
Loading
Loading