-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from rpact-com/dev/4.0.1
- Loading branch information
Showing
9 changed files
with
68 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,8 @@ | |
## | | ||
## | Contact us for information about our services: [email protected] | ||
## | | ||
## | File version: $Revision: 8232 $ | ||
## | Last changed: $Date: 2024-09-19 08:22:37 +0200 (Do, 19 Sep 2024) $ | ||
## | File version: $Revision: 8277 $ | ||
## | Last changed: $Date: 2024-09-27 08:16:45 +0200 (Fr, 27 Sep 2024) $ | ||
## | Last changed by: $Author: pahlke $ | ||
## | | ||
|
||
|
@@ -567,6 +567,9 @@ SimulationResults <- R6::R6Class("SimulationResults", | |
"numberOfPopulations", | ||
"expectedNumberOfSubjects", | ||
"expectedNumberOfEvents", | ||
"numberOfSubjects", | ||
"numberOfSubjects1", | ||
"numberOfSubjects2", | ||
"sampleSizes", | ||
"singleEventsPerArmAndStage", | ||
"singleEventsPerSubsetAndStage", | ||
|
@@ -1708,10 +1711,10 @@ SimulationResultsCountData <- R6::R6Class("SimulationResultsCountData", | |
accrualIntensity = NULL, | ||
followUpTime = NULL, | ||
groups = NULL, | ||
expectedNumberOfSubjects = NULL, | ||
numberOfSubjects = NULL, | ||
numberOfSubjects1 = NULL, | ||
numberOfSubjects2 = NULL, | ||
expectedNumberOfSubjects = NULL, | ||
iterations = NULL, | ||
futilityStop = NULL, | ||
futilityPerStage = NULL, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,8 @@ | |
## | | ||
## | Contact us for information about our services: [email protected] | ||
## | | ||
## | File version: $Revision: 8276 $ | ||
## | Last changed: $Date: 2024-09-26 13:37:54 +0200 (Do, 26 Sep 2024) $ | ||
## | File version: $Revision: 8277 $ | ||
## | Last changed: $Date: 2024-09-27 08:16:45 +0200 (Fr, 27 Sep 2024) $ | ||
## | Last changed by: $Author: pahlke $ | ||
## | | ||
|
||
|
@@ -506,7 +506,8 @@ SummaryFactory <- R6::R6Class("SummaryFactory", | |
"expectedEventsH1", | ||
"expectedNumberOfEvents", | ||
"expectedStudyDurationH1", | ||
"studyDuration")) { | ||
"studyDuration", | ||
"earlyStop")) { | ||
transposed <- TRUE | ||
} | ||
} | ||
|
@@ -3552,8 +3553,9 @@ SummaryFactory <- R6::R6Class("SummaryFactory", | |
} | ||
|
||
if (designPlan$.getParameterType(parameterNameSubjects) == C_PARAM_GENERATED) { | ||
subjectsCaption <- ifelse(design$kMax > 1 && inherits(designPlan, "SimulationResults") && | ||
!survivalEnabled, "Stage-wise number of subjects", "Number of subjects") | ||
subjectsCaption <- ifelse(design$kMax > 1 && | ||
inherits(designPlan, "SimulationResults") && !survivalEnabled, | ||
"Stage-wise number of subjects", "Number of subjects") | ||
summaryFactory$addParameter(designPlan, | ||
parameterName = parameterNameSubjects, | ||
parameterCaption = subjectsCaption, | ||
|
@@ -3566,33 +3568,6 @@ SummaryFactory <- R6::R6Class("SummaryFactory", | |
} | ||
} | ||
|
||
if (baseEnabled && countDataEnabled && design$kMax > 1 && | ||
!is.null(designPlan[["maxNumberOfSubjects"]]) && | ||
designPlan$.getParameterType("maxNumberOfSubjects") == C_PARAM_GENERATED) { | ||
summaryFactory$addParameter(designPlan, | ||
parameterName = "maxNumberOfSubjects", | ||
parameterCaption = "Maximum number of subjects", | ||
roundDigits = digitSettings$digitsSampleSize | ||
) | ||
summaryFactory$addParameter(designPlan, | ||
parameterName = "expectedNumberOfSubjectsH1", | ||
parameterCaption = "Expected number of subjects", | ||
roundDigits = digitSettings$digitsSampleSize | ||
) | ||
} | ||
if (baseEnabled && !countDataEnabled && design$kMax > 1) { | ||
summaryFactory$addParameter(designPlan, | ||
parameterName = ifelse(inherits(designPlan, "TrialDesignPlan") && | ||
(designPlan$.isSampleSizeObject() || countDataEnabled), | ||
"expectedNumberOfSubjectsH1", "expectedNumberOfSubjects"), | ||
parameterCaption = "Expected number of subjects under H1", | ||
roundDigits = digitSettings$digitsSampleSize, | ||
transpose = TRUE, | ||
validateParameterType = !countDataEnabled, | ||
lastStage = design$kMax | ||
) | ||
} | ||
|
||
if (simulationEnabled && (multiArmEnabled || enrichmentEnabled || countDataEnabled)) { | ||
if (survivalEnabled) { | ||
summaryFactory$addParameter(designPlan, | ||
|
@@ -3612,6 +3587,29 @@ SummaryFactory <- R6::R6Class("SummaryFactory", | |
) | ||
} | ||
} | ||
else if (baseEnabled && design$kMax > 1) { | ||
parameterName <- ifelse(inherits(designPlan, "TrialDesignPlan") && | ||
(designPlan$.isSampleSizeObject() || countDataEnabled), | ||
"expectedNumberOfSubjectsH1", "expectedNumberOfSubjects") | ||
summaryFactory$addParameter(designPlan, | ||
parameterName = parameterName, | ||
parameterCaption = "Expected number of subjects under H1", | ||
roundDigits = digitSettings$digitsSampleSize, | ||
transpose = TRUE, | ||
validateParameterType = !countDataEnabled, | ||
lastStage = design$kMax | ||
) | ||
if (countDataEnabled && | ||
(is.null(designPlan[[parameterName]]) || all(is.na(designPlan[[parameterName]]))) && | ||
!is.null(designPlan[["maxNumberOfSubjects"]]) && | ||
designPlan$.getParameterType("maxNumberOfSubjects") == C_PARAM_GENERATED) { | ||
summaryFactory$addParameter(designPlan, | ||
parameterName = "maxNumberOfSubjects", | ||
parameterCaption = "Maximum number of subjects", | ||
roundDigits = digitSettings$digitsSampleSize | ||
) | ||
} | ||
} | ||
|
||
if (baseEnabled && survivalEnabled && outputSize %in% c("medium", "large")) { | ||
parameterNameEvents <- NULL | ||
|
@@ -3671,7 +3669,8 @@ SummaryFactory <- R6::R6Class("SummaryFactory", | |
parameterCaption = "Overall exit probability", # (under H1) | ||
roundDigits = digitSettings$digitsProbabilities, | ||
smoothedZeroFormat = TRUE, | ||
transpose = TRUE | ||
transpose = TRUE, | ||
lastStage = design$kMax | ||
) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,8 @@ | |
## | | ||
## | Contact us for information about our services: [email protected] | ||
## | | ||
## | File version: $Revision: 8268 $ | ||
## | Last changed: $Date: 2024-09-25 16:14:45 +0200 (Mi, 25 Sep 2024) $ | ||
## | File version: $Revision: 8279 $ | ||
## | Last changed: $Date: 2024-09-27 10:49:35 +0200 (Fr, 27 Sep 2024) $ | ||
## | Last changed by: $Author: wassmer $ | ||
## | | ||
|
||
|
@@ -162,7 +162,7 @@ | |
followUpTime <- studyTime - max(accrualTime) | ||
} | ||
|
||
if (designPlan$.objectType == "power"){ | ||
if (designPlan$.objectType == "power") { | ||
nParameters <- 1 | ||
} else { | ||
nParameters <- length(lambda1) | ||
|
@@ -192,7 +192,7 @@ | |
criticalValues <- .getCriticalValues(design) | ||
futilityBounds <- design$futilityBounds | ||
futilityBounds[!is.na(futilityBounds) & futilityBounds <= C_FUTILITY_BOUNDS_DEFAULT] <- NA_real_ | ||
|
||
for (iCase in 1:nParameters) { | ||
ar <- allocationRatioPlanned[iCase] | ||
|
||
|
@@ -224,7 +224,7 @@ | |
recruit2 <- seq(0, accrualTime, length.out = maxNumberOfSubjects[iCase] / (1 + ar)) | ||
} | ||
} | ||
|
||
# calculate theta that solves (ln(theta) - ln(thetaH0) sqrt(FisherInformation_k) = boundary | ||
for (j in seq_len(length(criticalValues))) { | ||
if (all(is.na(numberOfSubjects[, iCase]))) { | ||
|
@@ -354,12 +354,13 @@ | |
)$root) | ||
}, | ||
error = function(e) { | ||
stop("Failed to calculate the calendar time. ", | ||
warning("Failed to calculate the calendar time. ", | ||
"Fisher information might be bounded, e.g., due to overdispersion > 0", | ||
call. = FALSE | ||
) | ||
} | ||
) | ||
return(NA_real_) | ||
} | ||
|
||
.getMaximumSampleSizeTwoGroups <- function(allocationRatioPlanned, | ||
|
@@ -402,8 +403,7 @@ | |
)) | ||
} | ||
|
||
.getDesignPlanCountData <- function( | ||
design, | ||
.getDesignPlanCountData <- function(design, | ||
designCharacteristics, | ||
objectType, | ||
sided, | ||
|
@@ -1137,7 +1137,9 @@ getPowerCounts <- function(design = NULL, ..., | |
accrualTime <- accrualTime[-1] | ||
} | ||
directionUpper <- .assertIsValidDirectionUpper(directionUpper, | ||
design, objectType = "power", userFunctionCallEnabled = TRUE) | ||
design, | ||
objectType = "power", userFunctionCallEnabled = TRUE | ||
) | ||
.setValueAndParameterType(designPlan, "directionUpper", directionUpper, C_DIRECTION_UPPER_DEFAULT) | ||
|
||
futilityPerStage <- matrix(NA_real_, kMax - 1, totalCases) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,8 @@ | |
## | | ||
## | Contact us for information about our services: [email protected] | ||
## | | ||
## | File version: $Revision: 8243 $ | ||
## | Last changed: $Date: 2024-09-20 07:33:34 +0200 (Fr, 20 Sep 2024) $ | ||
## | File version: $Revision: 8277 $ | ||
## | Last changed: $Date: 2024-09-27 08:16:45 +0200 (Fr, 27 Sep 2024) $ | ||
## | Last changed by: $Author: pahlke $ | ||
## | | ||
|
||
|
@@ -593,27 +593,33 @@ getSimulationCounts <- function(design = NULL, | |
simulationResults$iterations <- iterations | ||
simulationResults$.setParameterType("iterations", C_PARAM_GENERATED) | ||
|
||
if (kMax == 1) { | ||
sampleSizePerStage <- rep(maxNumberOfSubjects, totalCases) | ||
expectedSampleSize <- sampleSizePerStage | ||
} | ||
|
||
sampleSizePerStage[is.nan(sampleSizePerStage)] <- NA_integer_ | ||
simulationResults$numberOfSubjects <- sampleSizePerStage | ||
simulationResults$.setParameterType( | ||
"numberOfSubjects", | ||
ifelse(is.na(nTotal), C_PARAM_NOT_APPLICABLE, C_PARAM_GENERATED) | ||
ifelse(kMax == 1 || is.na(nTotal), C_PARAM_NOT_APPLICABLE, C_PARAM_GENERATED) | ||
) | ||
|
||
simulationResults$expectedNumberOfSubjects <- expectedSampleSize | ||
simulationResults$.setParameterType( | ||
"expectedNumberOfSubjects", | ||
ifelse(all(is.na(expectedSampleSize)), C_PARAM_NOT_APPLICABLE, C_PARAM_GENERATED) | ||
ifelse(kMax == 1 || all(is.na(expectedSampleSize)), C_PARAM_NOT_APPLICABLE, C_PARAM_GENERATED) | ||
) | ||
|
||
simulationResults$numberOfSubjects1 <- n1 | ||
simulationResults$.setParameterType( | ||
"numberOfSubjects1", | ||
ifelse(allocationRatioPlanned == 1, C_PARAM_NOT_APPLICABLE, C_PARAM_GENERATED) | ||
ifelse(kMax == 1 && allocationRatioPlanned != 1, C_PARAM_GENERATED, C_PARAM_NOT_APPLICABLE) | ||
) | ||
simulationResults$numberOfSubjects2 <- n2 | ||
simulationResults$.setParameterType( | ||
"numberOfSubjects2", | ||
ifelse(allocationRatioPlanned == 1, C_PARAM_NOT_APPLICABLE, C_PARAM_GENERATED) | ||
ifelse(kMax == 1 && allocationRatioPlanned != 1, C_PARAM_GENERATED, C_PARAM_NOT_APPLICABLE) | ||
) | ||
|
||
simulationResults$overallReject <- overallReject | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters