-
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.
- Loading branch information
Showing
22 changed files
with
133 additions
and
97 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
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: 8270 $ | ||
## | Last changed: $Date: 2024-09-25 16:37:39 +0200 (Mi, 25 Sep 2024) $ | ||
## | File version: $Revision: 8274 $ | ||
## | Last changed: $Date: 2024-09-26 11:33:59 +0200 (Do, 26 Sep 2024) $ | ||
## | Last changed by: $Author: pahlke $ | ||
## | | ||
|
||
|
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: 8273 $ | ||
## | Last changed: $Date: 2024-09-25 17:19:43 +0200 (Mi, 25 Sep 2024) $ | ||
## | File version: $Revision: 8276 $ | ||
## | Last changed: $Date: 2024-09-26 13:37:54 +0200 (Do, 26 Sep 2024) $ | ||
## | Last changed by: $Author: pahlke $ | ||
## | | ||
|
||
|
@@ -406,15 +406,15 @@ SummaryFactory <- R6::R6Class("SummaryFactory", | |
naText <- getOption("rpact.summary.na", "") | ||
if (length(valuesToShow) == length(valuesToShow2) && !all(is.na(valuesToShow2))) { | ||
for (variantIndex in seq_len(length(valuesToShow))) { | ||
value1 <- as.character(valuesToShow[variantIndex]) | ||
value2 <- as.character(valuesToShow2[variantIndex]) | ||
value1 <- trimws(as.character(valuesToShow[variantIndex])) | ||
value2 <- trimws(as.character(valuesToShow2[variantIndex])) | ||
if (grepl("^ *NA *$", value1)) { | ||
value1 <- naText | ||
} | ||
if (grepl("^ *NA *$", value2)) { | ||
value2 <- naText | ||
} | ||
if (trimws(value1) == "" && trimws(value2) == "") { | ||
if (value1 == "" && value2 == "") { | ||
valuesToShow[variantIndex] <- naText | ||
} else { | ||
valuesToShow[variantIndex] <- sprintf(self$intervalFormat, value1, value2) | ||
|
@@ -1296,7 +1296,7 @@ SummaryFactory <- R6::R6Class("SummaryFactory", | |
comparisonH0 <- " = " | ||
comparisonH1 <- NA_character_ | ||
if (inherits(object, "AnalysisResults") && !is.null(directionUpper)) { | ||
comparisonH1 <- ifelse(sided == 2, " != ", ifelse(directionUpper, " > ", " < ")) | ||
comparisonH1 <- ifelse(sided == 2, " != ", ifelse(!isFALSE(directionUpper), " > ", " < ")) | ||
} | ||
|
||
if (!is.null(object[["thetaH0"]])) { | ||
|
@@ -2093,36 +2093,36 @@ SummaryFactory <- R6::R6Class("SummaryFactory", | |
inherits(designPlan, "SimulationResults"))) { | ||
if (settings$groups == 1) { | ||
if (!is.null(designPlan[["pi1"]]) && length(designPlan$pi1) == 1) { | ||
treatmentRateText <- paste0("H1: treatment rate pi = ", round(designPlan$pi1, 3)) | ||
treatmentRateText <- paste0("H1: pi = ", round(designPlan$pi1, 3)) | ||
} else { | ||
treatmentRateText <- "H1: treatment rate pi as specified" | ||
treatmentRateText <- "H1: pi as specified" | ||
} | ||
|
||
header <- paste0(header, ",\n", .createSummaryHypothesisText(designPlan, summaryFactory)) | ||
header <- .concatenateSummaryText(header, treatmentRateText) | ||
header <- .addAdditionalArgumentsToHeader(header, designPlan, settings) | ||
} else { | ||
if (!is.null(designPlan[["pi1"]]) && length(designPlan$pi1) == 1) { | ||
treatmentRateText <- paste0("H1: treatment rate pi(1) = ", round(designPlan$pi1, 3)) | ||
treatmentRateText <- paste0("H1: pi(1) = ", round(designPlan$pi1, 3)) | ||
} else if (!is.null(designPlan[["piMaxVector"]]) && length(designPlan$piMaxVector) == 1) { | ||
treatmentRateText <- paste0( | ||
"H1: treatment rate pi_max = ", | ||
"H1: pi_max = ", | ||
.arrayToString(round(designPlan$piMaxVector, 3), vectorLookAndFeelEnabled = TRUE) | ||
) | ||
} else if (settings$enrichmentEnabled && !is.null(designPlan[["effectList"]]) && | ||
!is.null(designPlan$effectList[["piTreatments"]])) { | ||
piTreatments <- designPlan$effectList[["piTreatments"]] | ||
if (is.matrix(piTreatments) && nrow(piTreatments) == 1) { | ||
treatmentRateText <- paste0( | ||
"H1: assumed treatment rate pi(treatment) = ", | ||
"H1: assumed pi(treatment) = ", | ||
.arrayToString(round(designPlan$effectList$piTreatments, 3), vectorLookAndFeelEnabled = TRUE) | ||
) | ||
} else { | ||
treatmentRateText <- paste0("H1: assumed treatment rate pi(treatment) as specified") | ||
treatmentRateText <- paste0("H1: assumed pi(treatment) as specified") | ||
} | ||
} else { | ||
treatmentRateText <- paste0( | ||
"H1: treatment rate pi", | ||
"H1: pi", | ||
ifelse(settings$multiArmEnabled, "_max", "(1)"), " as specified" | ||
) | ||
} | ||
|
@@ -2742,7 +2742,9 @@ SummaryFactory <- R6::R6Class("SummaryFactory", | |
|
||
summaryFactory <- SummaryFactory$new( | ||
object = object, | ||
intervalFormat = intervalFormat, output = output, markdown = markdown | ||
intervalFormat = intervalFormat, | ||
output = output, | ||
markdown = markdown | ||
) | ||
|
||
.addDesignInformationToSummary(design, object, summaryFactory, | ||
|
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: 8225 $ | ||
## | Last changed: $Date: 2024-09-18 09:38:40 +0200 (Mi, 18 Sep 2024) $ | ||
## | File version: $Revision: 8276 $ | ||
## | Last changed: $Date: 2024-09-26 13:37:54 +0200 (Do, 26 Sep 2024) $ | ||
## | Last changed by: $Author: pahlke $ | ||
## | | ||
|
||
|
@@ -337,10 +337,14 @@ NULL | |
# final confidence interval & median unbiased estimate | ||
startTime <- Sys.time() | ||
finalConfidenceIntervals <- .getFinalConfidenceIntervalMeans( | ||
design = design, dataInput = dataInput, | ||
thetaH0 = thetaH0, stage = stage, directionUpper = directionUpper, | ||
design = design, | ||
dataInput = dataInput, | ||
thetaH0 = thetaH0, | ||
stage = stage, | ||
directionUpper = directionUpper, | ||
normalApproximation = normalApproximation, | ||
equalVariances = equalVariances, tolerance = tolerance | ||
equalVariances = equalVariances, | ||
tolerance = tolerance | ||
) | ||
|
||
if (!is.null(finalConfidenceIntervals)) { | ||
|
@@ -536,7 +540,7 @@ NULL | |
|
||
direction <- "undefined" | ||
if (design$sided == 1) { | ||
direction <- ifelse(directionUpper, C_DIRECTION_UPPER, C_DIRECTION_LOWER) | ||
direction <- ifelse(!isFALSE(directionUpper), C_DIRECTION_UPPER, C_DIRECTION_LOWER) | ||
} | ||
|
||
if (dataInput$getNumberOfGroups() == 1) { | ||
|
@@ -1604,21 +1608,27 @@ NULL | |
|
||
finalConfidenceIntervalGeneral[1] <- .getDecisionMatrixRoot( | ||
design = design, | ||
stage = finalStage, stageResults = stageResults, tolerance = tolerance, | ||
stage = finalStage, | ||
stageResults = stageResults, | ||
tolerance = tolerance, | ||
firstParameterName = firstParameterName, | ||
case = "finalConfidenceIntervalGeneralLower" | ||
) | ||
|
||
finalConfidenceIntervalGeneral[2] <- .getDecisionMatrixRoot( | ||
design = design, | ||
stage = finalStage, stageResults = stageResults, tolerance = tolerance, | ||
stage = finalStage, | ||
stageResults = stageResults, | ||
tolerance = tolerance, | ||
firstParameterName = firstParameterName, | ||
case = "finalConfidenceIntervalGeneralUpper" | ||
) | ||
|
||
medianUnbiasedGeneral <- .getDecisionMatrixRoot( | ||
design = design, | ||
stage = finalStage, stageResults = stageResults, tolerance = tolerance, | ||
stage = finalStage, | ||
stageResults = stageResults, | ||
tolerance = tolerance, | ||
firstParameterName = firstParameterName, | ||
case = "medianUnbiasedGeneral" | ||
) | ||
|
@@ -1649,7 +1659,7 @@ NULL | |
finalConfidenceInterval[1] <- medianUnbiased - value | ||
finalConfidenceInterval[2] <- medianUnbiased + value | ||
} else { | ||
directionUpperSign <- ifelse(directionUpper, 1, -1) | ||
directionUpperSign <- ifelse(!isFALSE(directionUpper), 1, -1) | ||
finalConfidenceInterval <- finalConfidenceIntervalGeneral * | ||
stageResults$overallStDevs[finalStage] + directionUpperSign * thetaH0 | ||
medianUnbiased <- medianUnbiasedGeneral * | ||
|
@@ -1933,7 +1943,8 @@ NULL | |
.assertIsValidThetaH0DataInput(thetaH0, dataInput) | ||
.warnInCaseOfUnknownArguments( | ||
functionName = "getFinalConfidenceIntervalMeans", | ||
ignore = c(.getDesignArgumentsToIgnoreAtUnknownArgumentCheck(design, powerCalculationEnabled = TRUE), "stage"), ... | ||
ignore = c(.getDesignArgumentsToIgnoreAtUnknownArgumentCheck( | ||
design, powerCalculationEnabled = TRUE), "stage"), ... | ||
) | ||
|
||
if (design$kMax == 1) { | ||
|
@@ -1952,25 +1963,40 @@ NULL | |
|
||
if (.isTrialDesignGroupSequential(design)) { | ||
return(.getFinalConfidenceIntervalMeansGroupSequential( | ||
design = design, dataInput = dataInput, stage = stage, thetaH0 = thetaH0, | ||
directionUpper = directionUpper, normalApproximation = normalApproximation, | ||
equalVariances = equalVariances, tolerance = tolerance | ||
design = design, | ||
dataInput = dataInput, | ||
stage = stage, | ||
thetaH0 = thetaH0, | ||
directionUpper = directionUpper, | ||
normalApproximation = normalApproximation, | ||
equalVariances = equalVariances, | ||
tolerance = tolerance | ||
)) | ||
} | ||
|
||
if (.isTrialDesignInverseNormal(design)) { | ||
return(.getFinalConfidenceIntervalMeansInverseNormal( | ||
design = design, dataInput = dataInput, stage = stage, thetaH0 = thetaH0, | ||
directionUpper = directionUpper, normalApproximation = normalApproximation, | ||
equalVariances = equalVariances, tolerance = tolerance | ||
design = design, | ||
dataInput = dataInput, | ||
stage = stage, | ||
thetaH0 = thetaH0, | ||
directionUpper = directionUpper, | ||
normalApproximation = normalApproximation, | ||
equalVariances = equalVariances, | ||
tolerance = tolerance | ||
)) | ||
} | ||
|
||
if (.isTrialDesignFisher(design)) { | ||
return(.getFinalConfidenceIntervalMeansFisher( | ||
design = design, dataInput = dataInput, stage = stage, thetaH0 = thetaH0, | ||
directionUpper = directionUpper, normalApproximation = normalApproximation, | ||
equalVariances = equalVariances, tolerance = tolerance | ||
design = design, | ||
dataInput = dataInput, | ||
stage = stage, | ||
thetaH0 = thetaH0, | ||
directionUpper = directionUpper, | ||
normalApproximation = normalApproximation, | ||
equalVariances = equalVariances, | ||
tolerance = tolerance | ||
)) | ||
} | ||
|
||
|
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: 8225 $ | ||
## | Last changed: $Date: 2024-09-18 09:38:40 +0200 (Mi, 18 Sep 2024) $ | ||
## | File version: $Revision: 8276 $ | ||
## | Last changed: $Date: 2024-09-26 13:37:54 +0200 (Do, 26 Sep 2024) $ | ||
## | Last changed by: $Author: pahlke $ | ||
## | | ||
|
||
|
@@ -600,7 +600,7 @@ NULL | |
combFisher[k] <- prod(pValues[1:k]^weightsFisher[1:k]) | ||
} | ||
|
||
direction <- ifelse(directionUpper, C_DIRECTION_UPPER, C_DIRECTION_LOWER) | ||
direction <- ifelse(!isFALSE(directionUpper), C_DIRECTION_UPPER, C_DIRECTION_LOWER) | ||
|
||
stageResults <- StageResultsRates$new( # R6$new | ||
design = design, | ||
|
@@ -618,7 +618,7 @@ NULL | |
weightsInverseNormal = weightsInverseNormal, | ||
weightsFisher = weightsFisher, | ||
thetaH0 = thetaH0, | ||
direction = ifelse(directionUpper, C_DIRECTION_UPPER, C_DIRECTION_LOWER), | ||
direction = ifelse(!isFALSE(directionUpper), C_DIRECTION_UPPER, C_DIRECTION_LOWER), | ||
normalApproximation = normalApproximation | ||
) | ||
|
||
|
@@ -1501,8 +1501,7 @@ NULL | |
stageResults$overallSampleSizes2[finalStage]) | ||
} | ||
|
||
directionUpperSign <- ifelse(directionUpper, 1, -1) | ||
|
||
directionUpperSign <- ifelse(!isFALSE(directionUpper), 1, -1) | ||
if (stageGroupSeq == 1) { | ||
finalConfidenceInterval[1] <- .getRootThetaRates( | ||
design = design, | ||
|
@@ -1701,8 +1700,7 @@ NULL | |
stageResults$overallSampleSizes2[finalStage]) | ||
} | ||
|
||
directionUpperSign <- ifelse(directionUpper, 1, -1) | ||
|
||
directionUpperSign <- ifelse(!isFALSE(directionUpper), 1, -1) | ||
if (stageInverseNormal == 1) { | ||
finalConfidenceInterval[1] <- .getRootThetaRates( | ||
design = design, | ||
|
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: 8225 $ | ||
## | Last changed: $Date: 2024-09-18 09:38:40 +0200 (Mi, 18 Sep 2024) $ | ||
## | File version: $Revision: 8276 $ | ||
## | Last changed: $Date: 2024-09-26 13:37:54 +0200 (Do, 26 Sep 2024) $ | ||
## | Last changed by: $Author: pahlke $ | ||
## | | ||
|
||
|
@@ -409,7 +409,7 @@ NULL | |
weightsFisher = weightsFisher, | ||
weightsInverseNormal = weightsInverseNormal, | ||
thetaH0 = thetaH0, | ||
direction = ifelse(directionUpper, C_DIRECTION_UPPER, C_DIRECTION_LOWER) | ||
direction = ifelse(!isFALSE(directionUpper), C_DIRECTION_UPPER, C_DIRECTION_LOWER) | ||
) | ||
|
||
if (.isTrialDesignFisher(design)) { | ||
|
@@ -1241,8 +1241,7 @@ NULL | |
stderr <- (1 + y$overallAllocationRatios[finalStage]) / sqrt(y$overallAllocationRatios[finalStage]) / | ||
sqrt(stageResults$overallEvents[finalStage]) | ||
|
||
directionUpperSign <- ifelse(directionUpper, 1, -1) | ||
|
||
directionUpperSign <- ifelse(!isFALSE(directionUpper), 1, -1) | ||
if (stageGroupSeq == 1) { | ||
finalConfidenceInterval <- exp(stderr * finalConfidenceIntervalGeneral + log(thetaH0)) | ||
medianUnbiased <- exp(stderr * medianUnbiasedGeneral + log(thetaH0)) | ||
|
@@ -1371,7 +1370,7 @@ NULL | |
stderr <- (1 + y$overallAllocationRatios[finalStage]) / sqrt(y$overallAllocationRatios[finalStage]) / | ||
sqrt(stageResults$overallEvents[finalStage]) | ||
|
||
directionUpperSign <- ifelse(directionUpper, 1, -1) | ||
directionUpperSign <- ifelse(!isFALSE(directionUpper), 1, -1) | ||
if (stageInvNormal == 1) { | ||
finalConfidenceInterval <- exp(stderr * finalConfidenceIntervalGeneral + log(thetaH0)) | ||
medianUnbiased <- exp(stderr * medianUnbiasedGeneral + log(thetaH0)) | ||
|
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: 8225 $ | ||
## | Last changed: $Date: 2024-09-18 09:38:40 +0200 (Mi, 18 Sep 2024) $ | ||
## | File version: $Revision: 8276 $ | ||
## | Last changed: $Date: 2024-09-26 13:37:54 +0200 (Do, 26 Sep 2024) $ | ||
## | Last changed by: $Author: pahlke $ | ||
## | | ||
|
||
|
@@ -266,7 +266,7 @@ NULL | |
design = design, | ||
dataInput = dataInput, | ||
thetaH0 = thetaH0, | ||
direction = ifelse(directionUpper, C_DIRECTION_UPPER, C_DIRECTION_LOWER), | ||
direction = ifelse(!isFALSE(directionUpper), C_DIRECTION_UPPER, C_DIRECTION_LOWER), | ||
normalApproximation = normalApproximation, | ||
directionUpper = directionUpper, | ||
stratifiedAnalysis = stratifiedAnalysis, | ||
|
@@ -377,7 +377,8 @@ NULL | |
|
||
singleStepAdjustedPValues[population, k] <- 1 - .getMultivariateDistribution( | ||
type = ifelse(normalApproximation, "normal", "t"), | ||
upper = ifelse(directionUpper, testStatistics[population, k], | ||
upper = ifelse(!isFALSE(directionUpper), | ||
testStatistics[population, k], | ||
-testStatistics[population, k] | ||
), | ||
sigma = sigma, df = df | ||
|
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: 8225 $ | ||
## | Last changed: $Date: 2024-09-18 09:38:40 +0200 (Mi, 18 Sep 2024) $ | ||
## | File version: $Revision: 8276 $ | ||
## | Last changed: $Date: 2024-09-26 13:37:54 +0200 (Do, 26 Sep 2024) $ | ||
## | Last changed by: $Author: pahlke $ | ||
## | | ||
|
||
|
@@ -239,7 +239,7 @@ NULL | |
design = design, | ||
dataInput = dataInput, | ||
thetaH0 = thetaH0, | ||
direction = ifelse(directionUpper, C_DIRECTION_UPPER, C_DIRECTION_LOWER), | ||
direction = ifelse(!isFALSE(directionUpper), C_DIRECTION_UPPER, C_DIRECTION_LOWER), | ||
normalApproximation = normalApproximation, | ||
directionUpper = directionUpper, | ||
stratifiedAnalysis = stratifiedAnalysis, | ||
|
@@ -332,7 +332,9 @@ NULL | |
} | ||
singleStepAdjustedPValues[population, k] <- 1 - .getMultivariateDistribution( | ||
type = "normal", | ||
upper = ifelse(directionUpper, testStatistics[population, k], -testStatistics[population, k]), | ||
upper = ifelse(!isFALSE(directionUpper), | ||
testStatistics[population, k], | ||
-testStatistics[population, k]), | ||
sigma = sigma, df = NA | ||
) | ||
} | ||
|
Oops, something went wrong.