| Title: | Power and Sample Size Calculation for Non-Proportional Hazards and Beyond |
|---|---|
| Description: | Performs power and sample size calculation for non-proportional hazards model using the Fleming-Harrington family of weighted log-rank tests. The sequentially calculated log-rank test score statistics are assumed to have independent increments as characterized in Anastasios A. Tsiatis (1982) <doi:10.1080/01621459.1982.10477898>. The mean and variance of log-rank test score statistics are calculated based on Kaifeng Lu (2021) <doi:10.1002/pst.2069>. The boundary crossing probabilities are calculated using the recursive integration algorithm described in Christopher Jennison and Bruce W. Turnbull (2000, ISBN:0849303168). The package can also be used for continuous, binary, and count data. For continuous data, it can handle missing data through mixed-model for repeated measures (MMRM). In crossover designs, it can estimate direct treatment effects while accounting for carryover effects. For binary data, it can design Simon's 2-stage, modified toxicity probability-2 (mTPI-2), and Bayesian optimal interval (BOIN) trials. For count data, it can design group sequential trials for negative binomial endpoints with censoring. Additionally, it facilitates group sequential equivalence trials for all supported data types. Moreover, it can design adaptive group sequential trials for changes in sample size, error spending function, number and spacing or future looks. Finally, it offers various options for adjusted p-values, including graphical and gatekeeping procedures. |
| Authors: | Kaifeng Lu [aut, cre] (ORCID: <https://orcid.org/0000-0002-6160-7119>) |
| Maintainer: | Kaifeng Lu <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.3.3 |
| Built: | 2026-06-06 21:12:52 UTC |
| Source: | https://github.com/kaifenglu/lrstat |
A comprehensive clinical trial design and analysis package with a focus on non-proportional hazards and weighted log-rank methods, plus broad support for group sequential design, adaptive design, multiplicity, dose-finding, and endpoint-specific power and sample size calculations.
For proportional hazards, power is determined by the total number of events and the constant hazard ratio together with information rates and spending functions. For non-proportional hazards, the hazard ratio varies over time and calendar time determines the mean and variance of the weighted log-rank score statistic. The package uses the analytic approach in Lu (2021) and approximates the variance-covariance matrix of sequential statistics under the alternative by that under the null to leverage the independent increments structure in Tsiatis (1982) for the Fleming-Harrington family.
The package capabilities can be grouped as follows:
Time-to-event design under proportional and
non-proportional hazards: weighted log-rank statistics and design
operating characteristics (for example lrstat, lrpower,
lrsamplesize, lrsim, lrschoenfeld), including
equivalence settings, event prediction, accrual modeling, and calendar
time determination (for example accrual, caltime,
nevent, pevent, patrisk, natrisk,
getDurationFromNevents, getNeventsFromHazardRatio).
Group sequential and adaptive designs: standard,
adaptive, multi-arm multi-stage (MAMS), and seamless frameworks,
including boundaries, conditional power, confidence intervals, and
exit probabilities (for example getDesign, adaptDesign,
getBound, getCP, getCI, getRCI,
getADCI, getADRCI, exitprob, and their
_mams and _seamless variants).
Fixed and sequential sample size/power across endpoint
types: binary, continuous, ordinal/multinomial, paired,
crossover/carryover, MMRM, repeated measures ANOVA, two-way ANOVA,
Wilcoxon, Fisher's exact, McNemar, one-sample exact, agreement,
logistic regression, and negative binomial endpoints (for example
getDesign*, power*Exact, samplesize*Exact,
kmpower, rmpower, nbpower, and associated
*samplesize and *equiv functions).
Multiplicity and graphical procedures: weighted
Bonferroni and graph-based updates, Bonferroni mixtures of weighted
Simes and Dunnett, and gatekeeping procedures for multiple hypotheses
(for example fadjpbon, fadjpsim, fadjpdun,
fseqbon, fstp2seq, fstdmix, fmodmix,
fwgtmat, updateGraph).
Early-phase and dose-finding tools: Simon's two-stage,
Bayesian Simon designs, mTPI-2, and BOIN utilities
(for example simon2stage, simonBayesAnalysis,
simonBayesSim, mTPI2Table, BOINTable).
Estimation, confidence intervals, and supporting
utilities: Clopper-Pearson, exact risk ratio/risk difference,
Brookmeyer-Crowley survival quantiles, Miettinen-Nurminen and REML
intervals/statistics for stratified measures, Hedges' g,
piecewise-exponential distribution tools, multivariate normal
integration, and model diagnostics
(for example ClopperPearsonCI, riskRatioExactCI,
riskDiffExactCI, survQuantile, mnRiskDiffCI,
remlRiskDiff, hedgesg, dtpwexp, ptpwexp,
qtpwexp, rtpwexp, pbvnorm, pmvnormr,
qmvnormr, phregr, liferegr,
residuals_phregr, survfit_phregr, zph_phregr).
Interactive use: a bundled Shiny interface for
exploratory design workflows (runShinyApp_lrstat).
The development of lrstat was strongly influenced by rpact, with
argument naming aligned where possible for ease of adoption. Key
differences include direct approximation (rather than Schoenfeld-based
approximation) for weighted log-rank design calculations, explicit use of
accrualDuration to define the accrual end, and treatment of final
stage trial outcome when early futility stopping does not occur.
Kaifeng Lu, [email protected]
Anastasios A. Tsiatis. Repeated significance testing for a general class of statistics used in censored survival analysis. J Am Stat Assoc. 1982;77:855-861.
Christopher Jennison, Bruce W. Turnbull. Group Sequential Methods with Applications to Clinical Trials. Chapman & Hall/CRC: Boca Raton, 2000, ISBN:0849303168
Kaifeng Lu. Sample size calculation for logrank test and prediction of number of events over time. Pharm Stat. 2021;20:229-244.
rpact, gsDesign
lrpower(kMax = 2, informationRates = c(0.8, 1), criticalValues = c(2.250, 2.025), accrualIntensity = 20, piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = 0.00427, gamma2 = 0.00427, accrualDuration = 22, followupTime = 18)lrpower(kMax = 2, informationRates = c(0.8, 1), criticalValues = c(2.250, 2.025), accrualIntensity = 20, piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = 0.00427, gamma2 = 0.00427, accrualDuration = 22, followupTime = 18)
Obtains the number of subjects enrolled by given calendar times.
accrual(time, accrualTime, accrualIntensity, accrualDuration)accrual(time, accrualTime, accrualIntensity, accrualDuration)
time |
A vector of calendar times at which to calculate the number of enrolled subjects. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
accrualDuration |
Duration of the enrollment period. |
A vector of total number of subjects enrolled by the specified calendar times.
Kaifeng Lu, [email protected]
# Example 1: Uniform enrollment with 20 patients per month for 12 months. accrual(time = 3, accrualTime = 0, accrualIntensity = 20, accrualDuration = 12) # Example 2: Piecewise accrual, 10 patients per month for the first # 3 months, and 20 patients per month thereafter. Patient recruitment # ends at 12 months for the study. accrual(time = c(2, 9), accrualTime = c(0, 3), accrualIntensity = c(10, 20), accrualDuration = 12)# Example 1: Uniform enrollment with 20 patients per month for 12 months. accrual(time = 3, accrualTime = 0, accrualIntensity = 20, accrualDuration = 12) # Example 2: Piecewise accrual, 10 patients per month for the first # 3 months, and 20 patients per month thereafter. Patient recruitment # ends at 12 months for the study. accrual(time = c(2, 9), accrualTime = c(0, 3), accrualIntensity = c(10, 20), accrualDuration = 12)
Calculates the conditional power for specified incremental information, given the interim results, parameter value, data-dependent changes in the error spending function, and the number and spacing of interim looks. Conversely, calculates the incremental information required to attain a specified conditional power, given the interim results, parameter value, data-dependent changes in the error spending function, and the number and spacing of interim looks.
adaptDesign( betaNew = NA_real_, INew = NA_real_, L = NA_integer_, zL = NA_real_, theta = NA_real_, IMax = NA_real_, kMax = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, spendingTime = NA_real_, MullerSchafer = FALSE, kNew = NA_integer_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, futilityStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, futilityBoundsInt = NULL, futilityCPInt = NULL, futilityThetaInt = NULL, typeBetaSpendingNew = "none", parameterBetaSpendingNew = NA_real_, userBetaSpendingNew = NA_real_, spendingTimeNew = NA_real_, varianceRatio = 1 )adaptDesign( betaNew = NA_real_, INew = NA_real_, L = NA_integer_, zL = NA_real_, theta = NA_real_, IMax = NA_real_, kMax = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, spendingTime = NA_real_, MullerSchafer = FALSE, kNew = NA_integer_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, futilityStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, futilityBoundsInt = NULL, futilityCPInt = NULL, futilityThetaInt = NULL, typeBetaSpendingNew = "none", parameterBetaSpendingNew = NA_real_, userBetaSpendingNew = NA_real_, spendingTimeNew = NA_real_, varianceRatio = 1 )
betaNew |
The type II error for the secondary trial. |
INew |
The maximum information of the secondary trial. Either
|
L |
The interim adaptation look of the primary trial. |
zL |
The z-test statistic at the interim adaptation look of the primary trial. |
theta |
The assumed parameter value. |
IMax |
The maximum information of the primary trial. Must be provided. |
kMax |
The maximum number of stages of the primary trial. |
informationRates |
The information rates of the primary trial. |
efficacyStopping |
Indicators of whether efficacy stopping is
allowed at each stage of the primary trial. Defaults to |
futilityStopping |
Indicators of whether futility stopping is
allowed at each stage of the primary trial. Defaults to |
criticalValues |
The upper boundaries on the z-test statistic scale for efficacy stopping for the primary trial. If missing, boundaries will be computed based on the specified alpha spending function. |
alpha |
The significance level of the primary trial. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending for the primary
trial. One of the following:
|
parameterAlphaSpending |
The parameter value of alpha spending
for the primary trial. Corresponds to |
userAlphaSpending |
The user-defined alpha spending for the primary trial. Represents the cumulative alpha spent up to each stage. |
futilityBounds |
The lower boundaries on the z-test statistic scale
for futility stopping for the primary trial. Defaults to
|
futilityCP |
The conditional power-based futility bounds for the primary trial. |
futilityTheta |
The parameter value-based futility bounds for the primary trial. |
spendingTime |
The error spending time of the primary trial.
Defaults to missing, in which case it is assumed to be the same as
|
MullerSchafer |
Whether to use the Muller and Schafer (2001) method for trial adaptation. |
kNew |
The number of looks of the secondary trial. |
informationRatesNew |
The spacing of looks of the secondary trial. |
efficacyStoppingNew |
The indicators of whether efficacy stopping is
allowed at each look of the secondary trial. Defaults to |
futilityStoppingNew |
The indicators of whether futility stopping is
allowed at each look of the secondary trial. Defaults to |
typeAlphaSpendingNew |
The type of alpha spending for the secondary
trial. One of the following:
|
parameterAlphaSpendingNew |
The parameter value of alpha spending
for the secondary trial. Corresponds to |
futilityBoundsInt |
The futility boundaries on the z statistic scale for new stages of the integrated trial. |
futilityCPInt |
The conditional power-based futility bounds for new stages of the integrated trial. |
futilityThetaInt |
The parameter value-based futility bounds for the new stages of the integrated trial. |
typeBetaSpendingNew |
The type of beta spending for the secondary
trial. One of the following:
|
parameterBetaSpendingNew |
The parameter value of beta spending
for the secondary trial. Corresponds to |
userBetaSpendingNew |
The user-defined cumulative beta spending. Represents the cumulative beta spent up to each stage of the secondary trial. |
spendingTimeNew |
The error spending time of the secondary trial.
Defaults to missing, in which case it is assumed to be the same as
|
varianceRatio |
The ratio of the variance under H0 to the variance under H1. |
An adaptDesign object with three list components:
primaryTrial: A list of selected information for the primary
trial, including L, zL, theta,
maxInformation, kMax,
informationRates, efficacyBounds, futilityBounds,
information, alpha, conditionalAlpha,
conditionalPower, predictivePower, and
and MullerSchafer.
secondaryTrial: A list of selected information for the secondary
trial, including overallReject, alpha, kMax,
maxInformation, informationRates, efficacyBounds,
futilityBounds, cumulativeRejection,
cumulativeFutility, cumulativeAlphaSpent,
information, typeAlphaSpending,
parameterAlphaSpending, typeBetaSpending,
parameterBetaSpending, userBetaSpending, and
spendingTime.
integratedTrial: A list of selected information for the integrated
trial, including L, zL, theta, maxInformation,
kMax, informationRates, efficacyBounds,
futilityBounds, and information.
Kaifeng Lu, [email protected]
Lu Chi, H. M. James Hung, and Sue-Jane Wang. Modification of sample size in group sequential clinical trials. Biometrics 1999;55:853-857.
Hans-Helge Muller and Helmut Schafer. Adaptive group sequential designs for clinical trials: Combining the advantages of adaptive and of classical group sequential approaches. Biometrics 2001;57:886-891.
# two-arm randomized clinical trial with a normally distributed endpoint # 90% power to detect mean difference of 15 with a standard deviation of 50 # Design the Stage I Trial with 3 looks and Lan-DeMets O'Brien-Fleming type # spending function delta <- 15 sigma <- 50 (des1 <- getDesignMeanDiff( beta = 0.1, meanDiff = delta, stDev = sigma, kMax = 3, alpha = 0.025, typeAlphaSpending = "sfOF" )) s1 <- des1$byStageResults$informationRates b1 <- des1$byStageResults$efficacyBounds n <- des1$overallResults$numberOfSubjects # Monitoring the Stage I Trial L <- 1 nL <- des1$byStageResults$numberOfSubjects[L] deltahat <- 8 sigmahat <- 55 sedeltahat <- sigmahat * sqrt( 4 / nL) zL <- deltahat / sedeltahat # Making an Adaptive Change: Stage I to Stage II # revised clinically meaningful difference downward to 10 power the study # retain the standard deviation at the design stage # Muller & Schafer (2001) method to design the secondary trial # with 2 looks and Lan-DeMets Pocock type spending function # re-estimate sample size to reach 90% conditional power deltaNew <- 10 (des2 <- adaptDesign( betaNew = 0.1, L = L, zL = zL, theta = deltaNew, IMax = n / (4 * sigma^2), kMax = 3, informationRates = s1, alpha = 0.025, typeAlphaSpending = "sfOF", MullerSchafer = TRUE, kNew = 2, typeAlphaSpendingNew = "sfP" )) INew <- des2$maxInformation (nNew <- ceiling(INew * 4 * sigma^2)) (nTotal <- nL + nNew)# two-arm randomized clinical trial with a normally distributed endpoint # 90% power to detect mean difference of 15 with a standard deviation of 50 # Design the Stage I Trial with 3 looks and Lan-DeMets O'Brien-Fleming type # spending function delta <- 15 sigma <- 50 (des1 <- getDesignMeanDiff( beta = 0.1, meanDiff = delta, stDev = sigma, kMax = 3, alpha = 0.025, typeAlphaSpending = "sfOF" )) s1 <- des1$byStageResults$informationRates b1 <- des1$byStageResults$efficacyBounds n <- des1$overallResults$numberOfSubjects # Monitoring the Stage I Trial L <- 1 nL <- des1$byStageResults$numberOfSubjects[L] deltahat <- 8 sigmahat <- 55 sedeltahat <- sigmahat * sqrt( 4 / nL) zL <- deltahat / sedeltahat # Making an Adaptive Change: Stage I to Stage II # revised clinically meaningful difference downward to 10 power the study # retain the standard deviation at the design stage # Muller & Schafer (2001) method to design the secondary trial # with 2 looks and Lan-DeMets Pocock type spending function # re-estimate sample size to reach 90% conditional power deltaNew <- 10 (des2 <- adaptDesign( betaNew = 0.1, L = L, zL = zL, theta = deltaNew, IMax = n / (4 * sigma^2), kMax = 3, informationRates = s1, alpha = 0.025, typeAlphaSpending = "sfOF", MullerSchafer = TRUE, kNew = 2, typeAlphaSpendingNew = "sfP" )) INew <- des2$maxInformation (nNew <- ceiling(INew * 4 * sigma^2)) (nTotal <- nL + nNew)
Calculates the conditional power for specified incremental information, given the interim results, parameter value, data-dependent changes in treatment selection, the error spending function, and the number and spacing of interim looks. Conversely, calculates the incremental information required to attain a specified conditional power, given the interim results, parameter value, data-dependent changes in treatment selection, the error spending function, and the number and spacing of interim looks.
adaptDesign_mams( betaNew = NA_real_, INew = NA_real_, M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, theta = NA_real_, IMax = NA_real_, kMax = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, spendingTime = NA_real_, MullerSchafer = FALSE, MNew = NA_integer_, selected = NA_integer_, rNew = 1, kNew = NA_integer_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, futilityStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, futilityBoundsInt = NULL, futilityCPInt = NULL, futilityThetaInt = NULL, typeBetaSpendingNew = "none", parameterBetaSpendingNew = NA_real_, userBetaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )adaptDesign_mams( betaNew = NA_real_, INew = NA_real_, M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, theta = NA_real_, IMax = NA_real_, kMax = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, spendingTime = NA_real_, MullerSchafer = FALSE, MNew = NA_integer_, selected = NA_integer_, rNew = 1, kNew = NA_integer_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, futilityStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, futilityBoundsInt = NULL, futilityCPInt = NULL, futilityThetaInt = NULL, typeBetaSpendingNew = "none", parameterBetaSpendingNew = NA_real_, userBetaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )
betaNew |
The type II error for the secondary trial. |
INew |
The maximum information for any active arm versus the common
control in the secondary trial. Either
|
M |
Number of active treatment arms in the primary trial. |
r |
Randomization ratio of each active arm to the common control in the primary trial. |
corr_known |
Logical. If |
L |
The interim adaptation look of the primary trial. |
zL |
The z-test statistics at the interim adaptation look of the primary trial. |
theta |
A vector of length |
IMax |
Maximum information for any active arm versus the common control for the primary trial. Must be provided. |
kMax |
The maximum number of stages of the primary trial. |
informationRates |
The information rates of the primary trial. |
efficacyStopping |
Indicators of whether efficacy stopping is
allowed at each stage of the primary trial. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed at each stage of the primary trial. |
criticalValues |
The matrix of by-level upper boundaries on the
max z-test statistic scale for efficacy stopping for the primary trial.
The first column is for level |
alpha |
The significance level of the primary trial. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending for the primary
trial. One of the following:
|
parameterAlphaSpending |
The parameter value of alpha spending
for the primary trial. Corresponds to |
userAlphaSpending |
The user-defined alpha spending for the primary trial. Represents the cumulative alpha spent up to each stage. |
futilityBounds |
The futility boundaries on the max-z statistic
scale for the primary trial. Defaults to |
futilityCP |
The conditional power-based futility bounds for the primary trial. |
futilityTheta |
The parameter value-based futility bounds for the primary trial. |
spendingTime |
The error spending time of the primary trial.
Defaults to missing, in which case it is assumed to be the same as
|
MullerSchafer |
Whether to use the Muller and Schafer (2001) method for trial adaptation. |
MNew |
Number of active treatment arms in the secondary trial. |
selected |
The indices of the selected active treatment arms for the secondary trial. |
rNew |
Randomization ratio of each active arm to the common control in the secondary trial. |
kNew |
The number of looks of the secondary trial. |
informationRatesNew |
The spacing of looks of the secondary trial. |
efficacyStoppingNew |
The indicators of whether efficacy stopping is
allowed at each look of the secondary trial. Defaults to |
futilityStoppingNew |
The indicators of whether futility stopping is
allowed at each look of the secondary trial. Defaults to |
typeAlphaSpendingNew |
The type of alpha spending for the secondary
trial. One of the following:
|
parameterAlphaSpendingNew |
The parameter value of alpha spending
for the secondary trial. Corresponds to
|
futilityBoundsInt |
The futility boundaries on the max-z statistic scale for new stages of the integrated trial. |
futilityCPInt |
The conditional power-based futility bounds for new stages of the integrated trial. |
futilityThetaInt |
The parameter value-based futility bounds for the new stages of the integrated trial. |
typeBetaSpendingNew |
The type of beta spending for the secondary
trial. One of the following:
|
parameterBetaSpendingNew |
The parameter value of beta spending
for the secondary trial. Corresponds to |
userBetaSpendingNew |
The user-defined cumulative beta spending. Represents the cumulative beta spent up to each stage of the secondary trial. |
spendingTimeNew |
The error spending time of the secondary trial.
Defaults to missing, in which case it is assumed to be the same as
|
An adaptDesign_mams object with three list components:
primaryTrial: A list of selected information for the primary
trial, including M, r, corr_known, L,
zL, theta, maxInformation, kMax,
informationRates, efficacyBounds, futilityBounds,
information, alpha, conditionalAlpha,
conditionalPower, MullerSchafer, and byLevelBounds,
where byLevelBounds is a data frame with columns level,
stage, and efficacyBounds, representing the efficacy
bounds for each combination of the number of active arms and
the stage of analysis in the primary trial.
secondaryTrial: A list of selected information for the secondary
trial, including overallReject, alpha, M, r,
selected, corr_known, kMax, maxInformation,
informationRates, cumulativeRejection,
cumulativeAlphaSpent, information,
typeAlphaSpending, parameterAlphaSpending,
typeBetaSpending, parameterBetaSpending,
userBetaSpending, spendingTime, and
byHypothesisBounds, where byHypothesisBounds is a
data frame with columns hypothesis, stage,
efficacyBounds, and futilityBounds, representing
the efficacy and futility bounds for each hypothesis and each
stage of analysis in the secondary trial.
integratedTrial: A list of selected information for the integrated
trial, including M, r, corr_known, MNew,
rNew, selected, L, zL, theta,
maxInformation, kMax, informationRates,
efficacyBounds, futilityBounds, information,
and byIntersectionBounds, where byIntersectionBounds is
a data frame with columns intersectionHypothesis, stage,
and efficacyBounds, representing the efficacy bounds for
each intersection hypothesis and each stage of analysis in the
integrated trial.
Kaifeng Lu, [email protected]
Ping Gao, Yingqiu Li. Adaptive multiple comparison sequential design (AMCSD) for clinical trials. Journal of Biopharmaceutical Statistics, 2024, 34(3), 424-440.
# Two active treatment arms are compared with a common control in a # two-look time-to-event design using O'Brien–Fleming–type alpha spending. # Suppose each active arm has a true hazard ratio of 0.75 versus control, # and the total number of events across all three arms at the final analysis # is 486. This corresponds to approximately 324 events for each active arm # versus the common control. Under these assumptions, the trial has about # 80% power to detect the treatment effect in at least one active arm. (des1 <- getDesign_mams( IMax = 324 / 4, theta = c(-log(0.75), -log(0.75)), M = 2, r = 1, kMax = 2, informationRates = c(1/2, 1), alpha = 0.025, typeAlphaSpending = "OF")) # Now assume that, at the interim analysis, the observed hazard ratios for # the two active arms versus control are 0.91 and 0.78, respectively. Using # the rule “drop any arm with an observed hazard ratio > 0.9”, arm 1 is # dropped. We then aim to achieve 80% conditional power to detect a hazard # ratio of 0.78 for the remaining arm at the final look. The analysis below # indicates that the required total number of events for arm 2 versus control # at the final analysis should be increased from 324 to 535. (des2 <- adaptDesign_mams( betaNew = 0.2, M = 2, r = 1, corr_known = FALSE, L = 1, zL = c(-log(0.91), -log(0.78)) * sqrt(324 / 4 / 2), theta = c(-log(0.91), -log(0.78)), IMax = 324 / 4, kMax = 2, informationRates = c(1/2, 1), alpha = 0.025, typeAlphaSpending = "OF", MNew = 1, selected = 2, rNew = 1))# Two active treatment arms are compared with a common control in a # two-look time-to-event design using O'Brien–Fleming–type alpha spending. # Suppose each active arm has a true hazard ratio of 0.75 versus control, # and the total number of events across all three arms at the final analysis # is 486. This corresponds to approximately 324 events for each active arm # versus the common control. Under these assumptions, the trial has about # 80% power to detect the treatment effect in at least one active arm. (des1 <- getDesign_mams( IMax = 324 / 4, theta = c(-log(0.75), -log(0.75)), M = 2, r = 1, kMax = 2, informationRates = c(1/2, 1), alpha = 0.025, typeAlphaSpending = "OF")) # Now assume that, at the interim analysis, the observed hazard ratios for # the two active arms versus control are 0.91 and 0.78, respectively. Using # the rule “drop any arm with an observed hazard ratio > 0.9”, arm 1 is # dropped. We then aim to achieve 80% conditional power to detect a hazard # ratio of 0.78 for the remaining arm at the final look. The analysis below # indicates that the required total number of events for arm 2 versus control # at the final analysis should be increased from 324 to 535. (des2 <- adaptDesign_mams( betaNew = 0.2, M = 2, r = 1, corr_known = FALSE, L = 1, zL = c(-log(0.91), -log(0.78)) * sqrt(324 / 4 / 2), theta = c(-log(0.91), -log(0.78)), IMax = 324 / 4, kMax = 2, informationRates = c(1/2, 1), alpha = 0.025, typeAlphaSpending = "OF", MNew = 1, selected = 2, rNew = 1))
Calculates the conditional power for specified incremental information, given the interim results, parameter value, data-dependent changes in the error spending function, and the number and spacing of interim looks. Conversely, calculates the incremental information required to attain a specified conditional power, given the interim results, parameter value, data-dependent changes in the error spending function, and the number and spacing of interim looks.
adaptDesign_seamless( betaNew = NA_real_, INew = NA_real_, M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, theta = NA_real_, IMax = NA_real_, K = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, spendingTime = NA_real_, MullerSchafer = FALSE, kNew = NA_integer_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, futilityStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, futilityBoundsInt = NULL, futilityCPInt = NULL, futilityThetaInt = NULL, typeBetaSpendingNew = "none", parameterBetaSpendingNew = NA_real_, userBetaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )adaptDesign_seamless( betaNew = NA_real_, INew = NA_real_, M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, theta = NA_real_, IMax = NA_real_, K = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, spendingTime = NA_real_, MullerSchafer = FALSE, kNew = NA_integer_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, futilityStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, futilityBoundsInt = NULL, futilityCPInt = NULL, futilityThetaInt = NULL, typeBetaSpendingNew = "none", parameterBetaSpendingNew = NA_real_, userBetaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )
betaNew |
The type II error for the secondary trial. |
INew |
The maximum information for the active arm versus the common
control in the secondary trial. Either
|
M |
Number of active treatment arms in Phase 2. |
r |
Randomization ratio of each active arm to the common control in Phase 2. |
corr_known |
Logical. If |
L |
The interim adaptation look in Phase 3. |
zL |
The z-test statistic at the interim adaptation look of Phase 3. |
theta |
The assumed treatment effect for the selected arm versus the common control. |
IMax |
Maximum information for the active arm versus the common control for the original trial. Must be provided. |
K |
Number of sequential looks in Phase 3. |
informationRates |
A numeric vector of information rates fixed
before the trial. If unspecified, defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is
allowed at each stage of the primary trial. Defaults to |
futilityStopping |
Indicators of whether futility stopping is
allowed at each stage of the primary trial. Defaults to |
criticalValues |
The upper boundaries on the max z-test statistic scale for Phase 2 and the z-test statistics for the selected arm in Phase 3 for the primary trial. If missing, boundaries will be computed based on the specified alpha spending function. |
alpha |
The significance level of the primary trial. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending for the primary
trial. One of the following:
|
parameterAlphaSpending |
The parameter value of alpha spending
for the primary trial. Corresponds to |
userAlphaSpending |
The user-defined alpha spending for the primary trial. Represents the cumulative alpha spent up to each stage. |
futilityBounds |
The lower boundaries on the max-z statistic scale
at end of phase 2 and the z-test statistic scale in phase 3
for futility stopping for the primary trial. Defaults to
|
futilityCP |
The conditional power-based futility bounds for the primary trial. |
futilityTheta |
The parameter value-based futility bounds for the primary trial. |
spendingTime |
The error spending time of the primary trial.
Defaults to missing, in which case it is assumed to be the same as
|
MullerSchafer |
Whether to use the Muller and Schafer (2001) method for trial adaptation. |
kNew |
The number of looks of the secondary trial. |
informationRatesNew |
The spacing of looks of the secondary trial. |
efficacyStoppingNew |
The indicators of whether efficacy stopping is
allowed at each look of the secondary trial. Defaults to |
futilityStoppingNew |
The indicators of whether futility stopping is
allowed at each look of the secondary trial. Defaults to |
typeAlphaSpendingNew |
The type of alpha spending for the secondary
trial. One of the following:
|
parameterAlphaSpendingNew |
The parameter value of alpha spending
for the secondary trial. Corresponds to |
futilityBoundsInt |
The futility boundaries on the z statistic scale for new stages of the integrated trial. |
futilityCPInt |
The conditional power-based futility bounds for new stages of the integrated trial. |
futilityThetaInt |
The parameter value-based futility bounds for the new stages of the integrated trial. |
typeBetaSpendingNew |
The type of beta spending for the secondary
trial. One of the following:
|
parameterBetaSpendingNew |
The parameter value of beta spending
for the secondary trial. Corresponds to |
userBetaSpendingNew |
The user-defined cumulative beta spending. Represents the cumulative beta spent up to each stage of the secondary trial. |
spendingTimeNew |
The error spending time of the secondary trial.
Defaults to missing, in which case it is assumed to be the same as
|
An adaptDesign_seamless object with three list components:
primaryTrial: A list of selected information for the primary
trial, including M, r, corr_known, K,
L, zL, theta, maxInformation, kMax,
informationRates, efficacyBounds, futilityBounds,
information, alpha, conditionalAlpha,
conditionalPower, and MullerSchafer.
secondaryTrial: A list of selected information for the seconary
trial, including overallReject, alpha, kMax,
maxInformation, informationRates, efficacyBounds,
futilityBounds, cumulativeRejection,
cumulativeFutility, cumulativeAlphaSpent,
information, typeAlphaSpending,
parameterAlphaSpending, typeBetaSpending,
parameterBetaSpending, userBetaSpending, and
spendingTime.
integratedTrial: A list of selected information for the integrated
trial, including M, r, corr_known, K,
L, zL, theta, maxInformation, kMax,
informationRates, efficacyBounds, futilityBounds,
and information.
Kaifeng Lu, [email protected]
Ping Gao, Yingqiu Li. Adaptive two-stage seamless sequential design for clinical trials. Journal of Biopharmaceutical Statistics, 2025, 35(4), 565-587.
(des1 <- adaptDesign_seamless( betaNew = 0.1, M = 2, r = 1, corr_known = FALSE, L = 1, zL = -log(0.67) * sqrt(80 / 4), theta = -log(0.691), IMax = 120 / 4, K = 2, informationRates = c(1/3, 2/3, 1), alpha = 0.025, typeAlphaSpending = "OF", kNew = 1))(des1 <- adaptDesign_seamless( betaNew = 0.1, M = 2, r = 1, corr_known = FALSE, L = 1, zL = -log(0.67) * sqrt(80 / 4), theta = -log(0.691), IMax = 120 / 4, K = 2, informationRates = c(1/3, 2/3, 1), alpha = 0.025, typeAlphaSpending = "OF", kNew = 1))
Survival in patients with acute myelogenous leukemia.
timeSurvival or censoring time
statuscensoring status
xmaintenance chemotherapy given or not
amlaml
An object of class data.frame with 23 rows and 3 columns.
Obtains the standardized score processes and the simulated distribution under the null hypothesis as well as the p-values for the supremum tests.
assess_phregr(object, resample = 1000, seed = 12345)assess_phregr(object, resample = 1000, seed = 12345)
object |
The output from the |
resample |
The number of simulation samples for the supremem test. |
seed |
The random seed for the simulations. |
The supremum test corresponds to the ASSESS statement with ph
option of SAS PROC PHREG.
A list with the following components:
time the unique event times.
score_t the observed standardized score process.
score_t_list a list of simulated standardized score processes
under the null hypothesis.
max_abs_value the supremum of the absolute value of the observed
standardized score process for each covariate and the supremum of
the sum of absolute values of the observed standardized score processes
across all covariates.
p_value the p-values for the supremum tests for each covariate
and the global test.
Kaifeng Lu, [email protected]
D. Y. Lin, L. J. Wei, and Z. Ying. Checking the Cox model with cumulative sums of martingale-based residuals. Biometrika 1993; 80:557-572.
fit <- phregr(data = liver, time = "Time", event = "Status", covariates = c("log(Bilirubin)", "log(Protime)", "log(Albumin)", "Age", "Edema"), ties = "breslow") aph <- assess_phregr(fit, resample = 1000, seed = 314159) aph plot(aph, nsim = 20)fit <- phregr(data = liver, time = "Time", event = "Status", covariates = c("log(Bilirubin)", "log(Protime)", "log(Albumin)", "Age", "Edema"), ties = "breslow") aph <- assess_phregr(fit, resample = 1000, seed = 314159) aph plot(aph, nsim = 20)
Performs simulation for two-endpoint two-arm group sequential trials.
Endpoint 1: Binary endpoint, analyzed using the Mantel-Haenszel test for risk difference.
Endpoint 2: Time-to-event endpoint, analyzed using the log-rank test for treatment effect.
The analysis times for the binary endpoint are based on calendar times, while the time-to-event analyses are triggered by reaching the pre-specified number of events. The binary endpoint is assessed at the first post-treatment follow-up visit (PTFU1).
binary_tte_sim( kMax1 = 1, kMax2 = 1, riskDiffH0 = 0, hazardRatioH0 = 1, allocation1 = 1, allocation2 = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, globalOddsRatio = NA, pi1 = NA, pi2 = NA, lambda1 = NA, lambda2 = NA, gamma1 = NA, gamma2 = NA, delta1 = NA, delta2 = NA, upper1 = NA, upper2 = NA, n = NA, plannedTime = NA, plannedEvents = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )binary_tte_sim( kMax1 = 1, kMax2 = 1, riskDiffH0 = 0, hazardRatioH0 = 1, allocation1 = 1, allocation2 = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, globalOddsRatio = NA, pi1 = NA, pi2 = NA, lambda1 = NA, lambda2 = NA, gamma1 = NA, gamma2 = NA, delta1 = NA, delta2 = NA, upper1 = NA, upper2 = NA, n = NA, plannedTime = NA, plannedEvents = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )
kMax1 |
Number of stages for the binary endpoint. |
kMax2 |
Number of stages for the time-to-event endpoint. |
riskDiffH0 |
Risk difference under the null hypothesis for the binary endpoint. |
hazardRatioH0 |
Hazard ratio under the null hypothesis for the time-to-event endpoint. |
allocation1 |
Number of subjects in the treatment group in a randomization block. Defaults to 1 for equal randomization. |
allocation2 |
Number of subjects in the control group in a randomization block. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
globalOddsRatio |
Global odds ratio of the Plackett copula linking the two endpoints. |
pi1 |
Response probabilities by stratum for the treatment group for the binary endpoint. |
pi2 |
Response probabilities by stratum for the control group for the binary endpoint. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the treatment group for the time-to-event endpoint. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group for the time-to-event endpoint. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
delta1 |
The hazard rate for exponential treatment discontinuation, a vector of hazard rates for piecewise exponential treatment discontinuation applicable for all strata, or a vector of hazard rates for treatment discontinuation in each analysis time interval by stratum for the treatment group for the binary endpoint. |
delta2 |
The hazard rate for exponential treatment discontinuation, a vector of hazard rates for piecewise exponential treatment discontinuation applicable for all strata, or a vector of hazard rates for treatment discontinuation in each analysis time interval by stratum for the control group for the binary endpoint. |
upper1 |
Maximim protocol-specified treatment duration for the treatment group. |
upper2 |
Maximum protocol-specified treatment duration for the control group. |
n |
Sample size. |
plannedTime |
Calendar times for the analyses of the binary endpoint. |
plannedEvents |
Target cumulative number of events for the time-to-event analyses. |
maxNumberOfIterations |
Number of simulation iterations to perform. |
maxNumberOfRawDatasetsPerStage |
Number of subject-level datasets to retain per stage. Set to 0 to skip raw data saving. |
seed |
The seed to reproduce the simulation results. |
nthreads |
The number of threads to use in simulations (0 means the default RcppParallel behavior). |
We consider dual primary endpoints with endpoint 1 being a binary endpoint and endpoint 2 being a time-to-event endpoint. The analyses of endpoint 1 will be based on calendar times, while the analyses of endpoint 2 will be based on the number of events. Therefore, the analyses of the two endpoints are not at the same time points. The correlation between the two endpoints is characterized by the global odds ratio of the Plackett copula. In addition, the time-to-event endpoint will render the binary endpoint as a non-responder, and so does the dropout. In addition, the treatment discontinuation will impact the number of available subjects for analysis. The administrative censoring will exclude subjects from the analysis of the binary endpoint.
A list with 4 components:
sumdataBIN: A data frame of summary data by iteration and stage
for the binary endpoint:
iterationNumber: The iteration number.
stageNumber: The stage number, covering all stages even if
the trial stops at an interim look.
analysisTime: The time for the stage since trial start.
accruals1: The number of subjects enrolled at the stage for
the treatment group.
accruals2: The number of subjects enrolled at the stage for
the control group.
totalAccruals: The total number of subjects enrolled at
the stage.
source1: The total number of subjects with response status
determined by the underlying latent response variable.
source2: The total number of subjects with response status
(non-responder) determined by experiencing the event for the
time-to-event endpoint.
source3: The total number of subjects with response status
(non-responder) determined by dropping out prior to the PTFU1
visit.
n1: The number of subjects included in the analysis of
the binary endpoint for the treatment group.
n2: The number of subjects included in the analysis of
the binary endpoint for the control group.
n: The total number of subjects included in the analysis of
the binary endpoint at the stage.
y1: The number of responders for the binary endpoint in
the treatment group.
y2: The number of responders for the binary endpoint in
the control group.
y: The total number of responders for the binary endpoint
at the stage.
riskDiff: The estimated risk difference for the binary
endpoint.
seRiskDiff: The standard error for risk difference based on
the Sato approximation.
mhStatistic: The Mantel-Haenszel test Z-statistic for
the binary endpoint.
sumdataTTE: A data frame of summary data by iteration and stage
for the time-to-event endpoint:
iterationNumber: The iteration number.
eventsNotAchieved: Whether the target number of events
is not achieved for the iteration.
stageNumber: The stage number, covering all stages even if
the trial stops at an interim look.
analysisTime: The time for the stage since trial start.
accruals1: The number of subjects enrolled at the stage for
the treatment group.
accruals2: The number of subjects enrolled at the stage for
the control group.
totalAccruals: The total number of subjects enrolled at
the stage.
events1: The number of events at the stage for
the treatment group.
events2: The number of events at the stage for
the control group.
totalEvents: The total number of events at the stage.
dropouts1: The number of dropouts at the stage for
the treatment group.
dropouts2: The number of dropouts at the stage for
the control group.
totalDropouts: The total number of dropouts at the stage.
uscore: The numerator of the log-rank test statistic for the
time-to-event endpoint.
vscore: The variance of the log-rank test statistic for the
time-to-event endpoint.
logRankStatistic: The log-rank test Z-statistic for
the time-to-event endpoint.
rawdataBIN (exists if maxNumberOfRawDatasetsPerStage is a
positive integer): A data frame for subject-level data for the binary
endpoint for selected replications, containing the following variables:
iterationNumber: The iteration number.
stageNumber: The stage under consideration.
analysisTime: The time for the stage since trial start.
subjectId: The subject ID.
arrivalTime: The enrollment time for the subject.
stratum: The stratum for the subject.
treatmentGroup: The treatment group (1 or 2) for the
subject.
survivalTime: The underlying survival time for the
time-to-event endpoint for the subject.
dropoutTime: The underlying dropout time for the
time-to-event endpoint for the subject.
trtDiscTime: The underlying treatment discontinuation time
for the binary endpoint for the subject.
trtDurUpperLimit: The maximum protocol-specified treatment
duration for the subject based on the treatment group assignment.
ptfu1Time:The underlying assessment time for the
binary endpoint for the subject.
timeUnderObservation: The time under observation
since randomization for the binary endpoint for the subject.
latentResponse: The underlying latent response variable for
the binary endpoint for the subject, which determines the response
status for the binary endpoint at PTFU1 visit.
responder: Whether the subject is a responder for the
binary endpoint.
source: The source of the determination of responder
status for the binary endpoint: = 1 based on the underlying
latent response variable, = 2 based on the occurrence of
the time-to-event endpoint before the assessment time of the
binary endpoint (imputed as a non-responder), = 3 based on
the dropout before the assessment time of the binary endpoint
(imputed as a non-responder), = 4 excluded from analysis
due to administrative censoring.
rawdataTTE (exists if maxNumberOfRawDatasetsPerStage is a
positive integer): A data frame for subject-level data for the
time-to-event endpoint for selected replications, containing the
following variables:
iterationNumber: The iteration number.
stageNumber: The stage under consideration.
analysisTime: The time for the stage since trial start.
subjectId: The subject ID.
arrivalTime: The enrollment time for the subject.
stratum: The stratum for the subject.
treatmentGroup: The treatment group (1 or 2) for the
subject.
survivalTime: The underlying survival time for the
time-to-event endpoint for the subject.
dropoutTime: The underlying dropout time for the
time-to-event endpoint for the subject.
timeUnderObservation: The time under observation
since randomization for the time-to-event endpoint for the subject.
event: Whether the subject experienced the event for the
time-to-event endpoint.
dropoutEvent: Whether the subject dropped out for the
time-to-event endpoint.
Kaifeng Lu, [email protected]
tcut <- c(0, 12, 36, 48) surv <- c(1, 0.95, 0.82, 0.74) lambda2 <- (log(surv[1:3]) - log(surv[2:4]))/(tcut[2:4] - tcut[1:3]) sim1 <- binary_tte_sim( kMax1 = 1, kMax2 = 2, accrualTime = seq(0, 8), accrualIntensity = 40/9 * seq(1, 9), piecewiseSurvivalTime = c(0, 12, 36), globalOddsRatio = 1, pi1 = 0.80, pi2 = 0.65, lambda1 = 0.65*lambda2, lambda2 = lambda2, gamma1 = -log(1-0.04)/12, gamma2 = -log(1-0.04)/12, delta1 = -log(1-0.02)/12, delta2 = -log(1-0.02)/12, upper1 = 15*28/30.4, upper2 = 12*28/30.4, n = 640, plannedTime = 20 + 15*28/30.4, plannedEvents = c(130, 173), maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 1)tcut <- c(0, 12, 36, 48) surv <- c(1, 0.95, 0.82, 0.74) lambda2 <- (log(surv[1:3]) - log(surv[2:4]))/(tcut[2:4] - tcut[1:3]) sim1 <- binary_tte_sim( kMax1 = 1, kMax2 = 2, accrualTime = seq(0, 8), accrualIntensity = 40/9 * seq(1, 9), piecewiseSurvivalTime = c(0, 12, 36), globalOddsRatio = 1, pi1 = 0.80, pi2 = 0.65, lambda1 = 0.65*lambda2, lambda2 = lambda2, gamma1 = -log(1-0.04)/12, gamma2 = -log(1-0.04)/12, delta1 = -log(1-0.02)/12, delta2 = -log(1-0.02)/12, upper1 = 15*28/30.4, upper2 = 12*28/30.4, n = 640, plannedTime = 20 + 15*28/30.4, plannedEvents = c(130, 173), maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 1)
Generates the decision table for the Bayesian Optimal Interval (BOIN) design, a widely used approach for dose-escalation trials that guides dose-finding decisions based on observed toxicity rates.
BOINTable( nMax = NA_integer_, pT = 0.3, phi1 = 0.6 * pT, phi2 = 1.4 * pT, a = 1, b = 1, pExcessTox = 0.95 )BOINTable( nMax = NA_integer_, pT = 0.3, phi1 = 0.6 * pT, phi2 = 1.4 * pT, a = 1, b = 1, pExcessTox = 0.95 )
nMax |
The maximum number of subjects allowed in a dose cohort. |
pT |
The target toxicity probability. Defaults to 0.3. |
phi1 |
The lower equivalence limit for the target toxicity probability. |
phi2 |
The upper equivalence limit for the target toxicity probability. |
a |
The prior toxicity shape parameter for the Beta prior. |
b |
The prior non-toxicity shape parameter for the Beta prior. |
pExcessTox |
The threshold for excessive toxicity.
If the posterior probability that the true toxicity rate exceeds
|
An S3 class BOINTable object with the following
components:
settings: The input settings data frame with the following
variables:
nMax: The maximum number of subjects in a dose cohort.
pT: The target toxicity probability.
phi1: The lower equivalence limit for target toxicity
probability.
phi2: The upper equivalence limit for target toxicity
probability.
lambda1: The lower decision boundary for observed toxicity
probability.
lambda2: The upper decision boundary for observed toxicity
probability.
a: The prior toxicity parameter for the beta prior.
b: The prior non-toxicity parameter for the beta prior.
pExcessTox: The threshold for excessive toxicity.
decisionDataFrame: A data frame listing dose-finding decisions
for each combination of sample size (n) and number of observed
toxicities (y):
n: Cohort size.
y: Number of observed toxicities.
decision: Recommended action: escalate, de-escalate,
or stay at the current dose.
decisionMatrix: A matrix version of the decision table
showing the recommended action based on the number of toxicities
for each possible cohort size.
Kaifeng Lu, [email protected]
Liu, S., & Yuan, Y. (2015). Bayesian optimal interval designs for phase I clinical trials. Journal of the Royal Statistical Society: Series C (Applied Statistics), 64(3), 507-523.
BOINTable(nMax = 18, pT = 0.3, phi = 0.6*0.3, phi2 = 1.4*0.3)BOINTable(nMax = 18, pT = 0.3, phi = 0.6*0.3, phi2 = 1.4*0.3)
Obtains the calendar times needed to reach the target number of subjects experiencing an event.
caltime( nevents = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE )caltime( nevents = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE )
nevents |
A vector of target number of events. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
A vector of calendar times expected to yield the target number of events.
Kaifeng Lu, [email protected]
# Piecewise accrual, piecewise exponential survivals, and 5% dropout by # the end of 1 year. caltime(nevents = c(24, 80), allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)# Piecewise accrual, piecewise exponential survivals, and 5% dropout by # the end of 1 year. caltime(nevents = c(24, 80), allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)
Obtains the Clopper-Pearson exact confidence interval for a one-sample proportion.
ClopperPearsonCI(n, y, cilevel = 0.95)ClopperPearsonCI(n, y, cilevel = 0.95)
n |
The sample size. |
y |
The number of responses. |
cilevel |
The confidence interval level. |
A data frame with the following variables:
n: The sample size.
y: The number of responses.
phat: The observed proportion of responses.
lower: The lower limit of the confidence interval.
upper: The upper limit of the confidence interval.
cilevel: The confidence interval level.
Kaifeng Lu, [email protected]
Clopper, C. J., & Pearson, E. S. (1934). The use of confidence or fiducial limits illustrated in the case of the binomial. Biometrika, 26(4), 404-413.
ClopperPearsonCI(20, 3)ClopperPearsonCI(20, 3)
Computes the correlation between PFS and OS given the correlation between PD and OS.
corr_pfs_os( piecewiseSurvivalTime = 0L, hazard_pfs = NA_real_, hazard_os = NA_real_, rho_pd_os = NA_real_ )corr_pfs_os( piecewiseSurvivalTime = 0L, hazard_pfs = NA_real_, hazard_os = NA_real_, rho_pd_os = NA_real_ )
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
hazard_pfs |
A scalar or numeric vector specifying the hazard(s) for PFS based on a piecewise exponential distribution. |
hazard_os |
A scalar or numeric vector specifying the hazard(s) for overall survival (OS) based on a piecewise exponential distribution. |
rho_pd_os |
A numeric value specifying the correlation between PD and OS times. |
This function first determines the piecewise exponential distribution
for PD such that the implied survival function for PFS time,
, closely
matches the specified piecewise exponential distribution for PFS
with hazard vector . Then, it calculates
the correlation between PFS and OS times based on the derived
piecewise exponential distribution for PD and the given piecewise
exponential distribution for OS.
The estimated correlation between PFS and OS.
Kaifeng Lu ([email protected])
u <- c(0, 1, 3, 4) lambda1 <- c(0.0151, 0.0403, 0.0501, 0.0558) lambda2 <- 0.0145 rho_pd_os <- 0.5 corr_pfs_os(u, lambda1, lambda2, rho_pd_os)u <- c(0, 1, 3, 4) lambda1 <- c(0.0151, 0.0403, 0.0501, 0.0558) lambda2 <- 0.0145 rho_pd_os <- 0.5 corr_pfs_os(u, lambda1, lambda2, rho_pd_os)
Obtains the covariance between restricted mean survival times at two different time points.
covrmst( t2 = NA_real_, tau1 = NA_real_, tau2 = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, maxFollowupTime = NA_real_ )covrmst( t2 = NA_real_, tau1 = NA_real_, tau2 = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, maxFollowupTime = NA_real_ )
t2 |
The calendar time for analysis 2. |
tau1 |
The milestone time for analysis 1. |
tau2 |
The milestone time for analysis 2. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
lambda1 |
A vector of hazard rates for the event for the active treatment group. One for each analysis time interval. |
lambda2 |
A vector of hazard rates for the event for the control group. One for each analysis time interval. |
gamma1 |
The hazard rate for exponential dropout, or a vector of hazard rates for piecewise exponential dropout for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, or a vector of hazard rates for piecewise exponential dropout for the control group. |
accrualDuration |
Duration of the enrollment period. |
maxFollowupTime |
Follow-up time for the first enrolled subject.
For fixed follow-up, |
The covariance between the restricted mean survival times for each treatment group.
Kaifeng Lu, [email protected]
covrmst(t2 = 25, tau1 = 16, tau2 = 18, allocationRatioPlanned = 1, accrualTime = c(0, 3), accrualIntensity = c(10, 20), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 12, maxFollowupTime = 30)covrmst(t2 = 25, tau1 = 16, tau2 = 18, allocationRatioPlanned = 1, accrualTime = c(0, 3), accrualIntensity = c(10, 20), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 12, maxFollowupTime = 30)
Obtains the density of a truncated piecewise exponential distribution.
dtpwexp( q, piecewiseSurvivalTime = 0, lambda = 0.0578, lowerBound = 0, log.d = FALSE )dtpwexp( q, piecewiseSurvivalTime = 0, lambda = 0.0578, lowerBound = 0, log.d = FALSE )
q |
The vector of quantiles. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
lambda |
A vector of hazard rates for the event. One for each analysis time interval. |
lowerBound |
The left truncation time point for the survival time. Defaults to 0 for no truncation. |
log.d |
Logical; if TRUE, densities d are given as log(d). |
The density d such that d = lambda(q) * P(X > q | X > lowerBound).
Kaifeng Lu, [email protected]
dtpwexp(q = c(8, 18), piecewiseSurvivalTime = c(0, 6, 9, 15), lambda = c(0.025, 0.04, 0.015, 0.007))dtpwexp(q = c(8, 18), piecewiseSurvivalTime = c(0, 6, 9, 15), lambda = c(0.025, 0.04, 0.015, 0.007))
Obtains the error spent at given spending times for the specified error spending function.
errorSpent(t, error = 0.025, sf = "sfOF", sfpar = NA_real_)errorSpent(t, error = 0.025, sf = "sfOF", sfpar = NA_real_)
t |
A vector of spending times, typically equal to information fractions. |
error |
The total error to spend. |
sf |
The spending function. One of the following:
|
sfpar |
The parameter for the spending function. Corresponds to
|
This function implements a variety of error spending functions commonly used in group sequential designs, assuming one-sided hypothesis testing.
O'Brien-Fleming-Type Spending Function
This spending function allocates very little alpha early on and more alpha later in the trial. It is defined as:
where is the standard normal cumulative distribution function,
is the critical value from the standard normal
distribution, and denotes the information fraction.
Pocock-Type Spending Function
This function spends alpha more evenly throughout the study:
where is Euler's number (approximately 2.718).
Kim and DeMets Power-Type Spending Function
This family of spending functions is defined as:
When , the function mimics Pocock-type boundaries.
When , it approximates O’Brien-Fleming-type boundaries.
Hwang, Shih, and DeCani Spending Function
This flexible family of functions is given by:
When , the spending function resembles
O’Brien-Fleming boundaries.
When , it resembles Pocock boundaries.
A vector of errors spent up to the interim look.
Kaifeng Lu, [email protected]
errorSpent(t = 0.5, error = 0.025, sf = "sfOF") errorSpent(t = c(0.5, 0.75, 1), error = 0.025, sf = "sfHSD", sfpar = -4)errorSpent(t = 0.5, error = 0.025, sf = "sfOF") errorSpent(t = c(0.5, 0.75, 1), error = 0.025, sf = "sfHSD", sfpar = -4)
Obtains the stagewise exit probabilities for both efficacy and futility stopping.
exitprob(b, a = NA_real_, theta = 0L, I = NA_real_)exitprob(b, a = NA_real_, theta = 0L, I = NA_real_)
b |
Upper boundaries on the z-test statistic scale. |
a |
Lower boundaries on the z-test statistic scale. Defaults to
|
theta |
Stagewise parameter of interest, e.g., |
I |
Stagewise cumulative information, e.g., |
A list of stagewise exit probabilities:
exitProbUpper: The vector of efficacy stopping probabilities
exitProbLower: The vector of futility stopping probabilities.
Kaifeng Lu, [email protected]
exitprob(b = c(3.471, 2.454, 2.004), theta = -log(0.6), I = c(50, 100, 150)/4) exitprob(b = c(2.963, 2.359, 2.014), a = c(-0.264, 0.599, 2.014), theta = c(0.141, 0.204, 0.289), I = c(81, 121, 160))exitprob(b = c(3.471, 2.454, 2.004), theta = -log(0.6), I = c(50, 100, 150)/4) exitprob(b = c(2.963, 2.359, 2.014), a = c(-0.264, 0.599, 2.014), theta = c(0.141, 0.204, 0.289), I = c(81, 121, 160))
Computes the exit (rejection) probabilities for a multi-arm multi-stage design.
exitprob_mams( M = NA_integer_, r = 1, theta = NA_real_, corr_known = TRUE, kMax = NA_integer_, b = NULL, a = NULL, I = NULL )exitprob_mams( M = NA_integer_, r = 1, theta = NA_real_, corr_known = TRUE, kMax = NA_integer_, b = NULL, a = NULL, I = NULL )
M |
Number of active treatment arms. |
r |
Randomization ratio of each active arm to the common control. |
theta |
A vector of length |
corr_known |
Logical. If |
kMax |
Number of sequential looks. |
b |
A vector of efficacy boundaries for the max-Z statistics. |
a |
A vector of futility boundaries for the max-Z statistics. |
I |
A vector of information levels for any active arm versus the common control. |
The function assumes a multivariate normal distribution for the Wald statistics and all active arms share the same information level.
A vector exitProb of length kMax containing the
probability of rejection at each look.
Kaifeng Lu, [email protected]
Ping Gao, Yingqiu Li. Adaptive multiple comparison sequential design (AMCSD) for clinical trials. Journal of Biopharmaceutical Statistics, 2024, 34(3), 424-440.
# Setup: 2 active arms vs control and 3 sequential looks. # Information levels: equal spacing over 3 looks based on a maximum of # 95 patients per arm, SD = 1.0 I <- 95 / (2 * 1.0^2) * seq(1, 3)/3 # O'Brien-Fleming critical values b <- c(3.886562, 2.748214, 2.243907) # Type I error under the global null hypothesis p0 <- exitprob_mams(M = 2, theta = c(0, 0), kMax = 3, b = b, I = I) cumsum(p0$exitProbUpper) # Power under alternative: Treatment effects of 0.3 and 0.5 p1 <- exitprob_mams(M = 2, theta = c(0.3, 0.5), kMax = 3, b = b, I = I) cumsum(p1$exitProbUpper)# Setup: 2 active arms vs control and 3 sequential looks. # Information levels: equal spacing over 3 looks based on a maximum of # 95 patients per arm, SD = 1.0 I <- 95 / (2 * 1.0^2) * seq(1, 3)/3 # O'Brien-Fleming critical values b <- c(3.886562, 2.748214, 2.243907) # Type I error under the global null hypothesis p0 <- exitprob_mams(M = 2, theta = c(0, 0), kMax = 3, b = b, I = I) cumsum(p0$exitProbUpper) # Power under alternative: Treatment effects of 0.3 and 0.5 p1 <- exitprob_mams(M = 2, theta = c(0.3, 0.5), kMax = 3, b = b, I = I) cumsum(p1$exitProbUpper)
Computes the upper and lower exit probabilities for a phase 2/3 seamless design. In Phase 2, multiple active arms are compared against a common control arm. If the phase-2 max-Z statistic crosses the efficacy boundary, the trial stops early for efficacy; if it falls below the futility boundary, the trial stops early for futility. Otherwise, the best-performing arm is selected to proceed to Phase 3, where it is tested against the common control over multiple looks with upper and optional lower stopping boundaries.
exitprob_seamless( M = NA_integer_, r = 1, theta = NA_real_, corr_known = TRUE, K = NA_integer_, b = NULL, a = NULL, I = NULL )exitprob_seamless( M = NA_integer_, r = 1, theta = NA_real_, corr_known = TRUE, K = NA_integer_, b = NULL, a = NULL, I = NULL )
M |
Number of active treatment arms in Phase 2. |
r |
Randomization ratio of each active arm to the common control in Phase 2. |
theta |
A vector of length |
corr_known |
Logical. If |
K |
Number of sequential looks in Phase 3. |
b |
A vector of efficacy boundaries (length |
a |
An optional vector of futility boundaries (length |
I |
A vector of information levels (length |
The function assumes a multivariate normal distribution for the Wald statistics. The "best" arm is defined as the active arm with the largest Z-statistic at the end of Phase 2 among designs that continue beyond the phase-2 analysis.
Decision Rules:
Phase 2 efficacy stop: reject if the phase-2 max-Z statistic
satisfies .
Phase 2 futility stop: stop for futility if the phase-2 max-Z
statistic satisfies .
Continue to Phase 3: if ,
select the arm with the largest phase-2 Z-statistic and continue with
that arm only.
Phase 3 efficacy stop: at look , reject if the selected
arm's Z-statistic exceeds the efficacy boundary and no earlier stop has
occurred.
Phase 3 futility stop: at look , stop for futility if
the selected arm's Z-statistic is below the futility boundary and no
earlier stop has occurred.
Design Assumptions:
All active arms share the same information level in Phase 2.
Exactly one active arm is selected at the end of Phase 2 based on the largest observed Z-statistic when the trial continues to Phase 3.
A list containing the following components:
exitProbUpper: A vector of length . The first element
is the probability of stopping for efficacy in Phase 2; the remaining
elements are the probabilities of stopping for efficacy at each look in
Phase 3.
exitProbLower: A vector of length . The first element
is the probability of stopping for futility in Phase 2; the remaining
elements are the probabilities of stopping for futility at each look in
Phase 3.
exitProbByArmUpper: A matrix. The
-th entry gives the probability of stopping for efficacy at
look given that arm is selected as best.
exitProbByArmLower: A matrix. The
-th entry gives the probability of stopping for futility at
look given that arm is selected as best.
selectAsBest: A vector of length containing the
probability that each active arm is selected to move on to Phase 3.
Kaifeng Lu, [email protected]
Ping Gao, Yingqiu Li. Adaptive two-stage seamless sequential design for clinical trials. Journal of Biopharmaceutical Statistics, 2025, 35(4), 565-587.
# Setup: 2 active arms vs control in Phase 2; 1 selected arm vs control # in Phase 3. Phase 3 has 2 sequential looks. # Information levels: equal spacing over 3 looks based on a maximum of # 110 patients per arm, SD = 1.0 I <- c(110 / (2 * 1.0^2) * seq(1, 3)/3) # O'Brien-Fleming efficacy boundaries b <- c(3.776605, 2.670463, 2.180424) # No futility stopping p0 <- exitprob_seamless(M = 2, theta = c(0, 0), K = 2, b = b, I = I) cumsum(p0$exitProbUpper) # Add futility stopping a <- c(0, 0.5, b[3]) p1 <- exitprob_seamless(M = 2, theta = c(0.3, 0.5), K = 2, b = b, a = a, I = I) cbind( cumulativeEfficacy = cumsum(p1$exitProbUpper), cumulativeFutility = cumsum(p1$exitProbLower) )# Setup: 2 active arms vs control in Phase 2; 1 selected arm vs control # in Phase 3. Phase 3 has 2 sequential looks. # Information levels: equal spacing over 3 looks based on a maximum of # 110 patients per arm, SD = 1.0 I <- c(110 / (2 * 1.0^2) * seq(1, 3)/3) # O'Brien-Fleming efficacy boundaries b <- c(3.776605, 2.670463, 2.180424) # No futility stopping p0 <- exitprob_seamless(M = 2, theta = c(0, 0), K = 2, b = b, I = I) cumsum(p0$exitProbUpper) # Add futility stopping a <- c(0, 0.5, b[3]) p1 <- exitprob_seamless(M = 2, theta = c(0.3, 0.5), K = 2, b = b, a = a, I = I) cbind( cumulativeEfficacy = cumsum(p1$exitProbUpper), cumulativeFutility = cumsum(p1$exitProbLower) )
Obtains the adjusted p-values for graphical approaches using weighted Bonferroni tests.
fadjpbon(w, G, p)fadjpbon(w, G, p)
w |
The vector of initial weights for elementary hypotheses. |
G |
The initial transition matrix. |
p |
The raw p-values for elementary hypotheses. |
A matrix of adjusted p-values.
Kaifeng Lu, [email protected]
Frank Bretz, Willi Maurer, Werner Brannath and Martin Posch. A graphical approach to sequentially rejective multiple test procedures. Statistics in Medicine. 2009; 28:586-604.
pvalues <- matrix(c(0.01,0.005,0.015,0.022, 0.02,0.015,0.010,0.023), nrow=2, ncol=4, byrow=TRUE) w <- c(0.5,0.5,0,0) g <- matrix(c(0,0,1,0,0,0,0,1,0,1,0,0,1,0,0,0), nrow=4, ncol=4, byrow=TRUE) fadjpbon(w, g, pvalues)pvalues <- matrix(c(0.01,0.005,0.015,0.022, 0.02,0.015,0.010,0.023), nrow=2, ncol=4, byrow=TRUE) w <- c(0.5,0.5,0,0) g <- matrix(c(0,0,1,0,0,0,0,1,0,1,0,0,1,0,0,0), nrow=4, ncol=4, byrow=TRUE) fadjpbon(w, g, pvalues)
Obtains the adjusted p-values for graphical approaches using weighted Dunnett tests.
fadjpdun(wgtmat, p, family = NULL, corr = NULL)fadjpdun(wgtmat, p, family = NULL, corr = NULL)
wgtmat |
The weight matrix for intersection hypotheses. |
p |
The raw p-values for elementary hypotheses. |
family |
The matrix of family indicators for elementary hypotheses. |
corr |
The correlation matrix that should be used for the parametric test. Can contain NAs for unknown correlations between families. |
A matrix of adjusted p-values.
Kaifeng Lu, [email protected]
Frank Bretz, Martin Posch, Ekkehard Glimm, Florian Klinglmueller, Willi Maurer, and Kornelius Rohmeyer. Graphical approach for multiple comparison procedures using weighted Bonferroni, Simes, or parameter tests. Biometrical Journal. 2011; 53:894-913.
pvalues <- matrix(c(0.01,0.005,0.015,0.022, 0.02,0.015,0.010,0.023), nrow=2, ncol=4, byrow=TRUE) w <- c(0.5,0.5,0,0) g <- matrix(c(0,0,1,0,0,0,0,1,0,1,0,0,1,0,0,0), nrow=4, ncol=4, byrow=TRUE) wgtmat <- fwgtmat(w,g) family <- matrix(c(1,1,0,0,0,0,1,1), nrow=2, ncol=4, byrow=TRUE) corr <- matrix(c(1,0.5,NA,NA, 0.5,1,NA,NA, NA,NA,1,0.5, NA,NA,0.5,1), nrow = 4, byrow = TRUE) fadjpdun(wgtmat, pvalues, family, corr)pvalues <- matrix(c(0.01,0.005,0.015,0.022, 0.02,0.015,0.010,0.023), nrow=2, ncol=4, byrow=TRUE) w <- c(0.5,0.5,0,0) g <- matrix(c(0,0,1,0,0,0,0,1,0,1,0,0,1,0,0,0), nrow=4, ncol=4, byrow=TRUE) wgtmat <- fwgtmat(w,g) family <- matrix(c(1,1,0,0,0,0,1,1), nrow=2, ncol=4, byrow=TRUE) corr <- matrix(c(1,0.5,NA,NA, 0.5,1,NA,NA, NA,NA,1,0.5, NA,NA,0.5,1), nrow = 4, byrow = TRUE) fadjpdun(wgtmat, pvalues, family, corr)
Obtains the adjusted p-values for graphical approaches using weighted Simes tests.
fadjpsim(wgtmat, p, family = NULL)fadjpsim(wgtmat, p, family = NULL)
wgtmat |
The weight matrix for intersection hypotheses. |
p |
The raw p-values for elementary hypotheses. |
family |
The matrix of family indicators for elementary hypotheses. |
A matrix of adjusted p-values.
Kaifeng Lu, [email protected]
Frank Bretz, Martin Posch, Ekkehard Glimm, Florian Klinglmueller, Willi Maurer, and Kornelius Rohmeyer. Graphical approach for multiple comparison procedures using weighted Bonferroni, Simes, or parameter tests. Biometrical Journal. 2011; 53:894-913.
Kaifeng Lu. Graphical approaches using a Bonferroni mixture of weighted Simes tests. Statistics in Medicine. 2016; 35:4041-4055.
pvalues <- matrix(c(0.01,0.005,0.015,0.022, 0.02,0.015,0.010,0.023), nrow=2, ncol=4, byrow=TRUE) w <- c(0.5,0.5,0,0) g <- matrix(c(0,0,1,0,0,0,0,1,0,1,0,0,1,0,0,0), nrow=4, ncol=4, byrow=TRUE) wgtmat <- fwgtmat(w,g) family <- matrix(c(1,1,0,0,0,0,1,1), nrow=2, ncol=4, byrow=TRUE) fadjpsim(wgtmat, pvalues, family)pvalues <- matrix(c(0.01,0.005,0.015,0.022, 0.02,0.015,0.010,0.023), nrow=2, ncol=4, byrow=TRUE) w <- c(0.5,0.5,0,0) g <- matrix(c(0,0,1,0,0,0,0,1,0,1,0,0,1,0,0,0), nrow=4, ncol=4, byrow=TRUE) wgtmat <- fwgtmat(w,g) family <- matrix(c(1,1,0,0,0,0,1,1), nrow=2, ncol=4, byrow=TRUE) fadjpsim(wgtmat, pvalues, family)
Converts a decimal to a fraction based on the algorithm from http://stackoverflow.com/a/5128558/221955.
float_to_fraction(x, tol = 1e-06)float_to_fraction(x, tol = 1e-06)
x |
The fraction in decimal form. |
tol |
The tolerance level for the conversion error. |
Kaifeng Lu, [email protected]
float_to_fraction(5/3)float_to_fraction(5/3)
Obtains the adjusted p-values for the modified gatekeeping procedures for multiplicity problems involving serial and parallel logical restrictions.
fmodmix( p, family = NULL, serial, parallel = NULL, gamma, test = "hommel", exhaust = TRUE )fmodmix( p, family = NULL, serial, parallel = NULL, gamma, test = "hommel", exhaust = TRUE )
p |
The raw p-values for elementary hypotheses. |
family |
The matrix of family indicators for the hypotheses. |
serial |
The matrix of serial rejection set for the hypotheses. |
parallel |
The matrix of parallel rejection set for the hypotheses. |
gamma |
The truncation parameters for each family. The truncation parameter for the last family is automatically set to 1. |
test |
The component multiple testing procedure. Options include "holm", "hochberg", or "hommel". Defaults to "hommel". |
exhaust |
Whether to use alpha-exhausting component testing procedure
for the last family with active hypotheses. It defaults to |
A matrix of adjusted p-values.
Kaifeng Lu, [email protected]
Alex Dmitrienko, George Kordzakhia, and Thomas Brechenmacher. Mixture-based gatekeeping procedures for multiplicity problems with multiple sequences of hypotheses. Journal of Biopharmaceutical Statistics. 2016; 26(4):758–780.
George Kordzakhia, Thomas Brechenmacher, Eiji Ishida, Alex Dmitrienko, Winston Wenxiang Zheng, and David Fuyuan Li. An enhanced mixture method for constructing gatekeeping procedures in clinical trials. Journal of Biopharmaceutical Statistics. 2018; 28(1):113–128.
p <- c(0.0194, 0.0068, 0.0271, 0.0088, 0.0370, 0.0018, 0.0814, 0.0066) family <- matrix(c(1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1), nrow=4, byrow=TRUE) serial <- matrix(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), nrow=8, byrow=TRUE) parallel <- matrix(0, 8, 8) gamma <- c(0.6, 0.6, 0.6, 1) fmodmix(p, family, serial, parallel, gamma, test = "hommel", exhaust = TRUE)p <- c(0.0194, 0.0068, 0.0271, 0.0088, 0.0370, 0.0018, 0.0814, 0.0066) family <- matrix(c(1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1), nrow=4, byrow=TRUE) serial <- matrix(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), nrow=8, byrow=TRUE) parallel <- matrix(0, 8, 8) gamma <- c(0.6, 0.6, 0.6, 1) fmodmix(p, family, serial, parallel, gamma, test = "hommel", exhaust = TRUE)
Obtains the quantiles of a survival distribution.
fquantile(S, probs, ...)fquantile(S, probs, ...)
S |
The survival function of a univariate survival time. |
probs |
The numeric vector of probabilities. |
... |
Additional arguments to be passed to S. |
A vector of length(probs) for the quantiles.
Kaifeng Lu, [email protected]
fquantile(pweibull, probs = c(0.25, 0.5, 0.75), shape = 1.37, scale = 1/0.818, lower.tail = FALSE)fquantile(pweibull, probs = c(0.25, 0.5, 0.75), shape = 1.37, scale = 1/0.818, lower.tail = FALSE)
Obtains the test results for group sequential trials using graphical approaches based on weighted Bonferroni tests.
fseqbon( w, G, alpha = 0.025, kMax, typeAlphaSpending = NULL, parameterAlphaSpending = NULL, maxInformation = NULL, incidenceMatrix = NULL, k1, p, information, spendingTime = NULL, lookback = TRUE, nthreads = 0 )fseqbon( w, G, alpha = 0.025, kMax, typeAlphaSpending = NULL, parameterAlphaSpending = NULL, maxInformation = NULL, incidenceMatrix = NULL, k1, p, information, spendingTime = NULL, lookback = TRUE, nthreads = 0 )
w |
The vector of initial weights for elementary hypotheses. |
G |
The initial transition matrix. |
alpha |
The significance level. Defaults to 0.025. |
kMax |
The maximum number of stages. |
typeAlphaSpending |
The vector of alpha spending functions for
the hypotheses. Each element is one of the following:
|
parameterAlphaSpending |
The vector of parameter values for the
alpha spending functions for the hypotheses. Each element corresponds
to the value of |
maxInformation |
The vector of target maximum information for each hypothesis. Defaults to a vector of 1s if not provided. |
incidenceMatrix |
The |
k1 |
The number of study looks at the interim analysis. |
p |
The |
information |
The |
spendingTime |
The |
lookback |
Whether to allow retesting at earlier looks. It defaults to
|
nthreads |
The number of threads to use in simulations (0 means the default RcppParallel behavior). |
When lookback = TRUE, the procedure allows the user to retest an
unrejected hypothesis at earlier looks if its weight increased after
rejection of other hypotheses.
The procedure will return the first look at which the
specific hypothesis is rejected. If the hypothesis is not rejected at
any look, it will return 0.
A vector to indicate the first look the specific hypothesis is rejected (0 if the hypothesis is not rejected).
Kaifeng Lu, [email protected]
Willi Maurer and Frank Bretz. Multiple testing in group sequential trials using graphical approaches. Statistics in Biopharmaceutical Research. 2013; 5:311-320.
# Case study from Maurer & Bretz (2013) fseqbon( w = c(0.5, 0.5, 0, 0), G = matrix(c(0, 0.5, 0.5, 0, 0.5, 0, 0, 0.5, 0, 1, 0, 0, 1, 0, 0, 0), nrow=4, ncol=4, byrow=TRUE), alpha = 0.025, kMax = 3, typeAlphaSpending = rep("sfOF", 4), maxInformation = rep(1, 4), k1 = 2, p = matrix(c(0.0062, 0.017, 0.009, 0.13, 0.0002, 0.0035, 0.002, 0.06), nrow=2, ncol=4, byrow=TRUE), information = matrix(c(rep(1/3, 4), rep(2/3, 4)), nrow=2, ncol=4, byrow=TRUE), nthreads = 1)# Case study from Maurer & Bretz (2013) fseqbon( w = c(0.5, 0.5, 0, 0), G = matrix(c(0, 0.5, 0.5, 0, 0.5, 0, 0, 0.5, 0, 1, 0, 0, 1, 0, 0, 0), nrow=4, ncol=4, byrow=TRUE), alpha = 0.025, kMax = 3, typeAlphaSpending = rep("sfOF", 4), maxInformation = rep(1, 4), k1 = 2, p = matrix(c(0.0062, 0.017, 0.009, 0.13, 0.0002, 0.0035, 0.002, 0.06), nrow=2, ncol=4, byrow=TRUE), information = matrix(c(rep(1/3, 4), rep(2/3, 4)), nrow=2, ncol=4, byrow=TRUE), nthreads = 1)
Obtains the adjusted p-values for the standard gatekeeping procedures for multiplicity problems involving serial and parallel logical restrictions.
fstdmix( p, family = NULL, serial, parallel = NULL, gamma, test = "hommel", exhaust = TRUE )fstdmix( p, family = NULL, serial, parallel = NULL, gamma, test = "hommel", exhaust = TRUE )
p |
The raw p-values for elementary hypotheses. |
family |
The matrix of family indicators for the hypotheses. |
serial |
The matrix of serial rejection set for the hypotheses. |
parallel |
The matrix of parallel rejection set for the hypotheses. |
gamma |
The truncation parameters for each family. The truncation parameter for the last family is automatically set to 1. |
test |
The component multiple testing procedure. Options include "holm", "hochberg", or "hommel". Defaults to "hommel". |
exhaust |
Whether to use alpha-exhausting component testing procedure
for the last family with active hypotheses. It defaults to |
A matrix of adjusted p-values.
Kaifeng Lu, [email protected]
Alex Dmitrienko and Ajit C Tamhane. Mixtures of multiple testing procedures for gatekeeping applications in clinical trials. Statistics in Medicine. 2011; 30(13):1473–1488.
p <- c(0.0194, 0.0068, 0.0271, 0.0088, 0.0370, 0.0018, 0.0814, 0.0066) family <- matrix(c(1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1), nrow=4, byrow=TRUE) serial <- matrix(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), nrow=8, byrow=TRUE) parallel <- matrix(0, 8, 8) gamma <- c(0.6, 0.6, 0.6, 1) fstdmix(p, family, serial, parallel, gamma, test = "hommel", exhaust = FALSE)p <- c(0.0194, 0.0068, 0.0271, 0.0088, 0.0370, 0.0018, 0.0814, 0.0066) family <- matrix(c(1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1), nrow=4, byrow=TRUE) serial <- matrix(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), nrow=8, byrow=TRUE) parallel <- matrix(0, 8, 8) gamma <- c(0.6, 0.6, 0.6, 1) fstdmix(p, family, serial, parallel, gamma, test = "hommel", exhaust = FALSE)
Obtains the adjusted p-values for the stepwise gatekeeping procedures for multiplicity problems involving two sequences of hypotheses.
fstp2seq(p, gamma, test = "hochberg", retest = TRUE)fstp2seq(p, gamma, test = "hochberg", retest = TRUE)
p |
The raw p-values for elementary hypotheses. |
gamma |
The truncation parameters for each family. The truncation parameter for the last family is automatically set to 1. |
test |
The component multiple testing procedure. It is either "Holm" or "Hochberg", and it defaults to "Hochberg". |
retest |
Whether to allow retesting. It defaults to |
A matrix of adjusted p-values.
Kaifeng Lu, [email protected]
p <- c(0.0194, 0.0068, 0.0271, 0.0088, 0.0370, 0.0018, 0.0814, 0.0066) gamma <- c(0.6, 0.6, 0.6, 1) fstp2seq(p, gamma, test="hochberg", retest=1)p <- c(0.0194, 0.0068, 0.0271, 0.0088, 0.0370, 0.0018, 0.0814, 0.0066) gamma <- c(0.6, 0.6, 0.6, 1) fstp2seq(p, gamma, test="hochberg", retest=1)
Obtains the adjusted p-values for possibly truncated Holm, Hochberg, and Hommel procedures.
ftrunc(p, test = "hommel", gamma = 1)ftrunc(p, test = "hommel", gamma = 1)
p |
The raw p-values for elementary hypotheses. |
test |
The test to use, e.g., "holm", "hochberg", or "hommel" (default). |
gamma |
The value of the truncation parameter. Defaults to 1 for the regular Holm, Hochberg, or Hommel procedure. |
A matrix of adjusted p-values.
Kaifeng Lu, [email protected]
Alex Dmitrienko, Ajit C. Tamhane, and Brian L. Wiens. General multistage gatekeeping procedures. Biometrical Journal. 2008; 5:667-677.
pvalues <- matrix(c(0.01,0.005,0.015,0.022, 0.02,0.015,0.010,0.023), nrow=2, ncol=4, byrow=TRUE) ftrunc(pvalues, "hochberg")pvalues <- matrix(c(0.01,0.005,0.015,0.022, 0.02,0.015,0.010,0.023), nrow=2, ncol=4, byrow=TRUE) ftrunc(pvalues, "hochberg")
Obtains the weight matrix for all intersection hypotheses.
fwgtmat(w, G)fwgtmat(w, G)
w |
The vector of weights for elementary hypotheses. |
G |
The transition matrix. |
The weight matrix starting with the global null hypothesis.
Kaifeng Lu, [email protected]
w <- c(0.5,0.5,0,0) g <- matrix(c(0,0,1,0, 0,0,0,1, 0,1,0,0, 1,0,0,0), nrow=4, ncol=4, byrow=TRUE) (wgtmat <- fwgtmat(w,g))w <- c(0.5,0.5,0,0) g <- matrix(c(0,0,1,0, 0,0,0,1, 0,1,0,0, 1,0,0,0), nrow=4, ncol=4, byrow=TRUE) (wgtmat <- fwgtmat(w,g))
Obtains the accrual duration to enroll the target number of subjects.
getAccrualDurationFromN(nsubjects, accrualTime, accrualIntensity)getAccrualDurationFromN(nsubjects, accrualTime, accrualIntensity)
nsubjects |
The vector of target number of subjects. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
A vector of accrual durations.
Kaifeng Lu, [email protected]
getAccrualDurationFromN(nsubjects = c(20, 150), accrualTime = c(0, 3), accrualIntensity = c(10, 20))getAccrualDurationFromN(nsubjects = c(20, 150), accrualTime = c(0, 3), accrualIntensity = c(10, 20))
Obtains the p-value, median unbiased point estimate, and confidence interval after the end of an adaptive trial.
getADCI( L = NA_integer_, zL = NA_real_, IMax = NA_real_, kMax = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.25, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_, MullerSchafer = FALSE, Lc = NA_integer_, zLc = NA_real_, INew = NA_real_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )getADCI( L = NA_integer_, zL = NA_real_, IMax = NA_real_, kMax = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.25, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_, MullerSchafer = FALSE, Lc = NA_integer_, zLc = NA_real_, INew = NA_real_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )
L |
The interim adaptation look of the primary trial. |
zL |
The z-test statistic at the interim adaptation look of the primary trial. |
IMax |
The maximum information of the primary trial. |
kMax |
The maximum number of stages of the primary trial. |
informationRates |
The information rates of the primary trial. |
efficacyStopping |
Indicators of whether efficacy stopping is allowed at each stage of the primary trial. Defaults to true if left unspecified. |
criticalValues |
The upper boundaries on the z-test statistic scale for efficacy stopping for the primary trial. |
alpha |
The significance level of the primary trial. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending for the primary
trial. One of the following:
|
parameterAlphaSpending |
The parameter value of alpha spending
for the primary trial. Corresponds to |
spendingTime |
The error spending time of the primary trial.
Defaults to missing, in which case, it is the same as
|
MullerSchafer |
Whether to use the Muller and Schafer (2001) method for trial adaptation. |
Lc |
The termination look of the integrated trial. |
zLc |
The z-test statistic at the termination look of the integrated trial. |
INew |
The maximum information of the secondary trial. |
informationRatesNew |
The spacing of looks of the secondary trial
up to look |
efficacyStoppingNew |
The indicators of whether efficacy stopping is
allowed at each look of the secondary trial up to look |
typeAlphaSpendingNew |
The type of alpha spending for the secondary
trial. One of the following:
|
parameterAlphaSpendingNew |
The parameter value of alpha spending
for the secondary trial. Corresponds to |
spendingTimeNew |
The error spending time of the secondary trial
up to look |
If typeAlphaSpendingNew is "OF", "P", "WT", or
"none", then informationRatesNew, efficacyStoppingNew,
and spendingTimeNew must be of full length kNew, and
informationRatesNew and spendingTimeNew must end with 1.
A data frame with the following variables:
pvalue: p-value for rejecting the null hypothesis.
thetahat: Median unbiased point estimate of the parameter.
cilevel: Confidence interval level.
lower: Lower bound of confidence interval.
upper: Upper bound of confidence interval.
Kaifeng Lu, [email protected]
Ping Gao, Lingyun Liu and Cyrus Mehta. Exact inference for adaptive group sequential designs. Stat Med. 2013;32(23):3991-4005.
# two-arm randomized clinical trial with a normally distributed endpoint # 90% power to detect mean difference of 15 with a standard deviation of 50 # Design the Stage I Trial with 3 looks and Lan-DeMets O'Brien-Fleming type # spending function delta <- 15 sigma <- 50 (des1 <- getDesignMeanDiff( beta = 0.1, meanDiff = delta, stDev = sigma, kMax = 3, alpha = 0.025, typeAlphaSpending = "sfOF" )) s1 <- des1$byStageResults$informationRates b1 <- des1$byStageResults$efficacyBounds n <- des1$overallResults$numberOfSubjects # Monitoring the Stage I Trial L <- 1 nL <- des1$byStageResults$numberOfSubjects[L] deltahat <- 8 sigmahat <- 55 sedeltahat <- sigmahat * sqrt( 4 / nL) zL <- deltahat / sedeltahat # Making an Adaptive Change: Stage I to Stage II # revised clinically meaningful difference downward to 10 power the study # retain the standard deviation at the design stage # Muller & Schafer (2001) method to design the secondary trial # with 2 looks and Lan-DeMets Pocock type spending function # re-estimate sample size to reach 90% conditional power deltaNew <- 10 (des2 <- adaptDesign( betaNew = 0.1, L = L, zL = zL, theta = deltaNew, IMax = n / (4 * sigma^2), kMax = 3, informationRates = s1, alpha = 0.025, typeAlphaSpending = "sfOF", MullerSchafer = TRUE, kNew = 2, typeAlphaSpendingNew = "sfP" )) INew <- des2$secondaryTrial$maxInformation (nNew <- ceiling(INew * 4 * sigma^2)) (nTotal <- nL + nNew) # Monitoring the Integrated Trial s2 <- des2$secondaryTrial$informationRates Lc <- 2 deltahatc <- 9.5 sigmahatc <- 52.759 L2 <- Lc - L nL2 <- nNew * s2[L2] nc <- nL + nL2 sedeltahatc <- sigmahatc * sqrt(4 / nc) zLc <- deltahatc / sedeltahatc zL2 <- (zLc * sqrt(nc) - zL * sqrt(nL)) / sqrt(nL2) getADCI( L = L, zL = zL, IMax = n / (4 * sigmahatc^2), kMax = 3, informationRates = s1, alpha = 0.025, typeAlphaSpending = "sfOF", MullerSchafer = TRUE, Lc = Lc, zLc = zLc, INew = nNew / (4 * sigmahatc^2), informationRatesNew = s2, typeAlphaSpendingNew = "sfP")# two-arm randomized clinical trial with a normally distributed endpoint # 90% power to detect mean difference of 15 with a standard deviation of 50 # Design the Stage I Trial with 3 looks and Lan-DeMets O'Brien-Fleming type # spending function delta <- 15 sigma <- 50 (des1 <- getDesignMeanDiff( beta = 0.1, meanDiff = delta, stDev = sigma, kMax = 3, alpha = 0.025, typeAlphaSpending = "sfOF" )) s1 <- des1$byStageResults$informationRates b1 <- des1$byStageResults$efficacyBounds n <- des1$overallResults$numberOfSubjects # Monitoring the Stage I Trial L <- 1 nL <- des1$byStageResults$numberOfSubjects[L] deltahat <- 8 sigmahat <- 55 sedeltahat <- sigmahat * sqrt( 4 / nL) zL <- deltahat / sedeltahat # Making an Adaptive Change: Stage I to Stage II # revised clinically meaningful difference downward to 10 power the study # retain the standard deviation at the design stage # Muller & Schafer (2001) method to design the secondary trial # with 2 looks and Lan-DeMets Pocock type spending function # re-estimate sample size to reach 90% conditional power deltaNew <- 10 (des2 <- adaptDesign( betaNew = 0.1, L = L, zL = zL, theta = deltaNew, IMax = n / (4 * sigma^2), kMax = 3, informationRates = s1, alpha = 0.025, typeAlphaSpending = "sfOF", MullerSchafer = TRUE, kNew = 2, typeAlphaSpendingNew = "sfP" )) INew <- des2$secondaryTrial$maxInformation (nNew <- ceiling(INew * 4 * sigma^2)) (nTotal <- nL + nNew) # Monitoring the Integrated Trial s2 <- des2$secondaryTrial$informationRates Lc <- 2 deltahatc <- 9.5 sigmahatc <- 52.759 L2 <- Lc - L nL2 <- nNew * s2[L2] nc <- nL + nL2 sedeltahatc <- sigmahatc * sqrt(4 / nc) zLc <- deltahatc / sedeltahatc zL2 <- (zLc * sqrt(nc) - zL * sqrt(nL)) / sqrt(nL2) getADCI( L = L, zL = zL, IMax = n / (4 * sigmahatc^2), kMax = 3, informationRates = s1, alpha = 0.025, typeAlphaSpending = "sfOF", MullerSchafer = TRUE, Lc = Lc, zLc = zLc, INew = nNew / (4 * sigmahatc^2), informationRatesNew = s2, typeAlphaSpendingNew = "sfP")
Obtains the p-value, conservative point estimate, and confidence interval after the end of an adaptive multi-arm multi-stage trial.
getADCI_mams( M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, IMax = NA_real_, kMax = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NULL, alpha = 0.25, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_, MullerSchafer = FALSE, MNew = NA_integer_, selected = NA_integer_, rNew = 1, Lc = NA_integer_, zLc = NA_real_, INew = NA_real_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )getADCI_mams( M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, IMax = NA_real_, kMax = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NULL, alpha = 0.25, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_, MullerSchafer = FALSE, MNew = NA_integer_, selected = NA_integer_, rNew = 1, Lc = NA_integer_, zLc = NA_real_, INew = NA_real_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )
M |
Number of active treatment arms in the primary trial. |
r |
Randomization ratio of each active arm to the common control in the primary trial. |
corr_known |
Logical. If |
L |
The interim adaptation look of the primary trial. |
zL |
The z-test statistics at the interim adaptation look of the primary trial. |
IMax |
Maximum information for any active arm versus the common control for the primary trial. Must be provided. |
kMax |
The maximum number of stages of the primary trial. |
informationRates |
The information rates of the primary trial. |
efficacyStopping |
Indicators of whether efficacy stopping is
allowed at each stage of the primary trial. Defaults to |
criticalValues |
The matrix of by-level upper boundaries on the
max z-test statistic scale for efficacy stopping up to look |
alpha |
The significance level of the primary trial. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending for the primary
trial. One of the following:
|
parameterAlphaSpending |
The parameter value of alpha spending
for the primary trial. Corresponds to |
spendingTime |
The error spending time of the primary trial.
Defaults to missing, in which case, it is the same as
|
MullerSchafer |
Whether to use the Muller and Schafer (2001) method for trial adaptation. |
MNew |
The number of active treatment arms in the secondary trial. |
selected |
The indices of the selected treatment arms for the
secondary trial among the |
rNew |
The randomization ratio of each active arm to the common control in the secondary trial. |
Lc |
The termination look of the integrated trial. |
zLc |
The z-test statistics at the termination look of the integrated trial. |
INew |
The maximum information for any active arm versus the common control in the secondary trial. |
informationRatesNew |
The spacing of looks of the secondary trial. |
efficacyStoppingNew |
The indicators of whether efficacy stopping is
allowed at each look of the secondary trial.
Defaults to |
typeAlphaSpendingNew |
The type of alpha spending for the secondary
trial. One of the following:
|
parameterAlphaSpendingNew |
The parameter value of alpha spending
for the secondary trial. Corresponds to
|
spendingTimeNew |
The error spending time of the secondary trial.
Defaults to missing, in which case, it is
the same as |
If typeAlphaSpendingNew is "OF" or "none", then
informationRatesNew, efficacyStoppingNew, and
spendingTimeNew must be of full length kNew, and
informationRatesNew and spendingTimeNew must end with 1.
A data frame with the following variables:
level: Number of individual hypotheses considered for multiplicity.
index: The treatment arm with max Z among the active arms.
pvalue: p-value for rejecting the null hypothesis.
thetahat: Point estimate of the parameter.
cilevel: Confidence interval level.
lower: Lower bound of confidence interval.
upper: Upper bound of confidence interval.
Kaifeng Lu, [email protected]
Ping Gao, Yingqiu Li. Adaptive multiple comparison sequential design (AMCSD) for clinical trials. Journal of Biopharmaceutical Statistics, 2024, 34(3), 424-440.
getADCI_mams( M = 2, r = 1, corr_known = FALSE, L = 1, zL = c(2.075, 2.264), IMax = 300 / 4, kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", MNew = 1, selected = 2, rNew = 1, Lc = 2, zLc = 1.667, INew = 374 / 4)getADCI_mams( M = 2, r = 1, corr_known = FALSE, L = 1, zL = c(2.075, 2.264), IMax = 300 / 4, kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", MNew = 1, selected = 2, rNew = 1, Lc = 2, zLc = 1.667, INew = 374 / 4)
Obtains the p-value, conservative point estimate, and confidence interval after the end of an adaptive phase 2/3 seamless design.
getADCI_seamless( M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, IMax = NA_real_, K = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.25, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_, MullerSchafer = FALSE, Lc = NA_integer_, zLc = NA_real_, INew = NA_real_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )getADCI_seamless( M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, IMax = NA_real_, K = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.25, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_, MullerSchafer = FALSE, Lc = NA_integer_, zLc = NA_real_, INew = NA_real_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )
M |
Number of active treatment arms in Phase 2. |
r |
Randomization ratio of each active arm to the common control in Phase 2. |
corr_known |
Logical. If |
L |
The interim adaptation look in Phase 3. |
zL |
The z-test statistic at the interim adaptation look of Phase 3. |
IMax |
Maximum information for the active arm versus the common control for the original trial. Must be provided. |
K |
Number of sequential looks in Phase 3. |
informationRates |
A numeric vector of information rates fixed
before the trial. If unspecified, defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is
allowed at each stage of the primary trial. Defaults to |
criticalValues |
The upper boundaries on the max z-test statistic scale for Phase 2 and the z-test statistics for the selected arm in Phase 3 for the primary trial. If missing, boundaries will be computed based on the specified alpha spending function. |
alpha |
The significance level of the primary trial. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending for the primary
trial. One of the following:
|
parameterAlphaSpending |
The parameter value of alpha spending
for the primary trial. Corresponds to |
spendingTime |
The error spending time of the primary trial.
Defaults to missing, in which case, it is the same as
|
MullerSchafer |
Whether to use the Muller and Schafer (2001) method for trial adaptation. |
Lc |
The termination look of the integrated trial. |
zLc |
The z-test statistic at the termination look of the integrated trial. |
INew |
The maximum information for the active arm versus the common control in the secondary trial. |
informationRatesNew |
The spacing of looks of the secondary trial. |
efficacyStoppingNew |
The indicators of whether efficacy stopping is
allowed at each look of the secondary trial.
Defaults to |
typeAlphaSpendingNew |
The type of alpha spending for the secondary
trial. One of the following:
|
parameterAlphaSpendingNew |
The parameter value of alpha spending
for the secondary trial. Corresponds to |
spendingTimeNew |
The error spending time of the secondary trial.
Defaults to missing, in which case, it is
the same as |
If typeAlphaSpendingNew is "OF", "P", "WT",
or "none", then
informationRatesNew, efficacyStoppingNew, and
spendingTimeNew must be of full length kNew, and
informationRatesNew and spendingTimeNew must end with 1.
A data frame with the following variables:
pvalue: p-value for rejecting the null hypothesis.
thetahat: Point estimate of the parameter.
cilevel: Confidence interval level.
lower: Lower bound of confidence interval.
upper: Upper bound of confidence interval.
Kaifeng Lu, [email protected]
Ping Gao, Yingqiu Li. Adaptive multiple comparison sequential design (AMCSD) for clinical trials. Journal of Biopharmaceutical Statistics, 2024, 34(3), 424-440.
getADCI_seamless( M = 2, r = 1, corr_known = FALSE, L = 1, zL = -log(0.67) * sqrt(80 / 4), IMax = 120 / 4, K = 2, informationRates = c(1/3, 2/3, 1), alpha = 0.025, typeAlphaSpending = "OF", Lc = 2, zLc = -log(0.677) * sqrt(236 / 4), INew = 236 / 4)getADCI_seamless( M = 2, r = 1, corr_known = FALSE, L = 1, zL = -log(0.67) * sqrt(80 / 4), IMax = 120 / 4, K = 2, informationRates = c(1/3, 2/3, 1), alpha = 0.025, typeAlphaSpending = "OF", Lc = 2, zLc = -log(0.677) * sqrt(236 / 4), INew = 236 / 4)
Obtains the repeated p-value, conservative point estimate, and repeated confidence interval for an adaptive group sequential trial.
getADRCI( L = NA_integer_, zL = NA_real_, IMax = NA_real_, kMax = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_, MullerSchafer = FALSE, Lc = NA_integer_, zLc = NA_real_, INew = NA_real_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )getADRCI( L = NA_integer_, zL = NA_real_, IMax = NA_real_, kMax = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_, MullerSchafer = FALSE, Lc = NA_integer_, zLc = NA_real_, INew = NA_real_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )
L |
The interim adaptation look of the primary trial. |
zL |
The z-test statistic at the interim adaptation look of the primary trial. |
IMax |
The maximum information of the primary trial. |
kMax |
The maximum number of stages of the primary trial. |
informationRates |
The information rates of the primary trial. |
efficacyStopping |
Indicators of whether efficacy stopping is allowed at each stage of the primary trial. Defaults to true if left unspecified. |
criticalValues |
The upper boundaries on the z-test statistic scale for efficacy stopping for the primary trial. |
alpha |
The significance level of the primary trial. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending for the primary
trial. One of the following:
|
parameterAlphaSpending |
The parameter value of alpha spending
for the primary trial. Corresponds to |
spendingTime |
The error spending time of the primary trial.
Defaults to missing, in which case, it is the same as
|
MullerSchafer |
Whether to use the Muller and Schafer (2001) method for trial adaptation. |
Lc |
The look of interest in the integrated trial. |
zLc |
The z-test statistic at the look of the integrated trial. |
INew |
The maximum information of the secondary trial. |
informationRatesNew |
The spacing of looks of the secondary trial. |
efficacyStoppingNew |
The indicators of whether efficacy stopping is
allowed at each look of the secondary trial up to look |
typeAlphaSpendingNew |
The type of alpha spending for the secondary
trial. One of the following:
|
parameterAlphaSpendingNew |
The parameter value of alpha spending
for the secondary trial. Corresponds to |
spendingTimeNew |
The error spending time of the secondary trial.
up to look |
If typeAlphaSpendingNew is "OF", "P", "WT", or
"none", then informationRatesNew, efficacyStoppingNew,
and spendingTimeNew must be of full length kNew, and
informationRatesNew and spendingTimeNew must end with 1.
A data frame with the following variables:
pvalue: Repeated p-value for rejecting the null hypothesis.
thetahat: Point estimate of the parameter.
cilevel: Confidence interval level.
lower: Lower bound of repeated confidence interval.
upper: Upper bound of repeated confidence interval.
Kaifeng Lu, [email protected]
Cyrus R. Mehta, Peter Bauer, Martin Posch and Werner Brannath. Repeated confidence intervals for adaptive group sequential trials. Stat Med. 2007;26:5422–5433.
# two-arm randomized clinical trial with a normally distributed endpoint # 90% power to detect mean difference of 15 with a standard deviation of 50 # Design the Stage I Trial with 3 looks and Lan-DeMets O'Brien-Fleming type # spending function delta <- 15 sigma <- 50 (des1 <- getDesignMeanDiff( beta = 0.1, meanDiff = delta, stDev = sigma, kMax = 3, alpha = 0.025, typeAlphaSpending = "sfOF" )) s1 <- des1$byStageResults$informationRates b1 <- des1$byStageResults$efficacyBounds n <- des1$overallResults$numberOfSubjects # Monitoring the Stage I Trial L <- 1 nL <- des1$byStageResults$numberOfSubjects[L] deltahat <- 8 sigmahat <- 55 sedeltahat <- sigmahat * sqrt( 4 / nL) zL <- deltahat / sedeltahat # Making an Adaptive Change: Stage I to Stage II # revised clinically meaningful difference downward to 10 power the study # retain the standard deviation at the design stage # Muller & Schafer (2001) method to design the secondary trial # with 2 looks and Lan-DeMets Pocock type spending function # re-estimate sample size to reach 90% conditional power deltaNew <- 10 (des2 <- adaptDesign( betaNew = 0.1, L = L, zL = zL, theta = deltaNew, IMax = n / (4 * sigma^2), kMax = 3, informationRates = s1, alpha = 0.025, typeAlphaSpending = "sfOF", MullerSchafer = TRUE, kNew = 2, typeAlphaSpendingNew = "sfP" )) INew <- des2$secondaryTrial$maxInformation (nNew <- ceiling(INew * 4 * sigma^2)) (nTotal <- nL + nNew) # Monitoring the Integrated Trial s2 <- des2$secondaryTrial$informationRates Lc <- 2 deltahatc <- 9.5 sigmahatc <- 52.759 L2 <- Lc - L nL2 <- nNew * s2[L2] nc <- nL + nL2 sedeltahatc <- sigmahatc * sqrt(4 / nc) zLc <- deltahatc / sedeltahatc zL2 <- (zLc * sqrt(nc) - zL * sqrt(nL)) / sqrt(nL2) getADRCI( L = L, zL = zL, IMax = n / (4 * sigmahatc^2), kMax = 3, informationRates = s1, alpha = 0.025, typeAlphaSpending = "sfOF", MullerSchafer = TRUE, Lc = Lc, zLc = zLc, INew = nNew / (4 * sigmahatc^2), informationRatesNew = s2, typeAlphaSpendingNew = "sfP")# two-arm randomized clinical trial with a normally distributed endpoint # 90% power to detect mean difference of 15 with a standard deviation of 50 # Design the Stage I Trial with 3 looks and Lan-DeMets O'Brien-Fleming type # spending function delta <- 15 sigma <- 50 (des1 <- getDesignMeanDiff( beta = 0.1, meanDiff = delta, stDev = sigma, kMax = 3, alpha = 0.025, typeAlphaSpending = "sfOF" )) s1 <- des1$byStageResults$informationRates b1 <- des1$byStageResults$efficacyBounds n <- des1$overallResults$numberOfSubjects # Monitoring the Stage I Trial L <- 1 nL <- des1$byStageResults$numberOfSubjects[L] deltahat <- 8 sigmahat <- 55 sedeltahat <- sigmahat * sqrt( 4 / nL) zL <- deltahat / sedeltahat # Making an Adaptive Change: Stage I to Stage II # revised clinically meaningful difference downward to 10 power the study # retain the standard deviation at the design stage # Muller & Schafer (2001) method to design the secondary trial # with 2 looks and Lan-DeMets Pocock type spending function # re-estimate sample size to reach 90% conditional power deltaNew <- 10 (des2 <- adaptDesign( betaNew = 0.1, L = L, zL = zL, theta = deltaNew, IMax = n / (4 * sigma^2), kMax = 3, informationRates = s1, alpha = 0.025, typeAlphaSpending = "sfOF", MullerSchafer = TRUE, kNew = 2, typeAlphaSpendingNew = "sfP" )) INew <- des2$secondaryTrial$maxInformation (nNew <- ceiling(INew * 4 * sigma^2)) (nTotal <- nL + nNew) # Monitoring the Integrated Trial s2 <- des2$secondaryTrial$informationRates Lc <- 2 deltahatc <- 9.5 sigmahatc <- 52.759 L2 <- Lc - L nL2 <- nNew * s2[L2] nc <- nL + nL2 sedeltahatc <- sigmahatc * sqrt(4 / nc) zLc <- deltahatc / sedeltahatc zL2 <- (zLc * sqrt(nc) - zL * sqrt(nL)) / sqrt(nL2) getADRCI( L = L, zL = zL, IMax = n / (4 * sigmahatc^2), kMax = 3, informationRates = s1, alpha = 0.025, typeAlphaSpending = "sfOF", MullerSchafer = TRUE, Lc = Lc, zLc = zLc, INew = nNew / (4 * sigmahatc^2), informationRatesNew = s2, typeAlphaSpendingNew = "sfP")
Obtains the efficacy stopping boundaries for a group sequential design.
getBound( k = NA_integer_, informationRates = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_, efficacyStopping = NA_integer_ )getBound( k = NA_integer_, informationRates = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_, efficacyStopping = NA_integer_ )
k |
Look number for the current analysis. |
informationRates |
Information rates up to the current look. Must be increasing and less than or equal to 1. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
spendingTime |
A vector of length |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
If typeAlphaSpending is "OF", "P", "WT", or
"none", then informationRates, efficacyStopping,
and spendingTime must be of full length kMax, and
informationRates and spendingTime must end with 1.
A numeric vector of critical values up to the current look.
Kaifeng Lu, [email protected]
getBound(k = 2, informationRates = c(0.5,1), alpha = 0.025, typeAlphaSpending = "sfOF")getBound(k = 2, informationRates = c(0.5,1), alpha = 0.025, typeAlphaSpending = "sfOF")
Calculates the efficacy stopping boundaries for a multi-arm multi-stage design.
getBound_mams( M = NA_integer_, r = 1, corr_known = TRUE, k = NA_integer_, informationRates = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_, efficacyStopping = NA_integer_ )getBound_mams( M = NA_integer_, r = 1, corr_known = TRUE, k = NA_integer_, informationRates = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_, efficacyStopping = NA_integer_ )
M |
Number of active treatment arms. |
r |
Randomization ratio of each active arm to the common control. |
corr_known |
Logical. If |
k |
The index of the current look. |
informationRates |
A numeric vector of information rates up to the
current look. Values must be strictly increasing and |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
spendingTime |
A numeric vector of length |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
The function determines critical values by solving for the boundary that satisfies the alpha-spending requirement.
If typeAlphaSpending is "OF", "P", "WT", or
"none", then informationRates, efficacyStopping,
and spendingTime must be of full length kMax, and
informationRates and spendingTime must end with 1.
A numeric vector of length containing the critical
values (on the standard normal Z-scale) for each analysis up to the
current look.
Kaifeng Lu, [email protected]
Ping Gao, Yingqiu Li. Adaptive multiple comparison sequential design (AMCSD) for clinical trials. Journal of Biopharmaceutical Statistics, 2024, 34(3), 424-440.
# Determine O'Brien-Fleming boundaries for a TSSSD with # 2 active arms and 3 looks. getBound_mams(M = 2, k = 3, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "OF")# Determine O'Brien-Fleming boundaries for a TSSSD with # 2 active arms and 3 looks. getBound_mams(M = 2, k = 3, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "OF")
Calculates the efficacy stopping boundaries for a phase 2/3 seamless design, accounting for the selection of the best arm at the end of Phase 2 and sequential testing in Phase 3.
getBound_seamless( M = NA_integer_, r = 1, corr_known = TRUE, k = NA_integer_, informationRates = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_, efficacyStopping = NA_integer_ )getBound_seamless( M = NA_integer_, r = 1, corr_known = TRUE, k = NA_integer_, informationRates = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_, efficacyStopping = NA_integer_ )
M |
Number of active treatment arms in Phase 2. |
r |
Randomization ratio of each active arm to the common control in Phase 2. |
corr_known |
Logical. If |
k |
The index of the current look in Phase 3. |
informationRates |
A numeric vector of information rates up to the
current look. Values must be strictly increasing and |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
spendingTime |
A numeric vector of length |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
The function determines critical values by solving for the boundary that satisfies the alpha-spending requirement, given the selection of the "best" arm at the end of Phase 2.
If typeAlphaSpending is "OF", "P", "WT", or
"none", then informationRates, efficacyStopping,
and spendingTime must be of full length kMax, and
informationRates and spendingTime must end with 1.
A numeric vector of length containing the critical
values (on the standard normal Z-scale) for each analysis up to the
current look.
Kaifeng Lu, [email protected]
Ping Gao, Yingqiu Li. Adaptive two-stage seamless sequential design for clinical trials. Journal of Biopharmaceutical Statistics, 2025, 35(4), 565-587.
# Determine O'Brien-Fleming boundaries for a seamless design with # 2 active arms in Phase 2 and 2 looks in Phase 3 (3 looks total). getBound_seamless(M = 2, k = 2, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "OF")# Determine O'Brien-Fleming boundaries for a seamless design with # 2 active arms in Phase 2 and 2 looks in Phase 3 (3 looks total). getBound_seamless(M = 2, k = 2, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "OF")
Obtains the p-value, median unbiased point estimate, and confidence interval after the end of a group sequential trial.
getCI( L = NA_integer_, zL = NA_real_, IMax = NA_real_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_ )getCI( L = NA_integer_, zL = NA_real_, IMax = NA_real_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_ )
L |
The termination look. |
zL |
The z-test statistic at the termination look. |
IMax |
The maximum information of the trial. |
informationRates |
The information rates up to look |
efficacyStopping |
Indicators of whether efficacy stopping is
allowed at each stage up to look |
criticalValues |
The upper boundaries on the z-test statistic scale
for efficacy stopping up to look |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending for the trial.
One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
spendingTime |
The error spending time up to look |
If typeAlphaSpending is "OF", "P", "WT", or
"none", then informationRates, efficacyStopping,
and spendingTime must be of full length kMax, and
informationRates and spendingTime must end with 1.
A data frame with the following components:
pvalue: p-value for rejecting the null hypothesis.
thetahat: Median unbiased point estimate of the parameter.
cilevel: Confidence interval level.
lower: Lower bound of confidence interval.
upper: Upper bound of confidence interval.
Kaifeng Lu, [email protected]
Anastasios A. Tsiatis, Gary L. Rosner and Cyrus R. Mehta. Exact confidence intervals following a group sequential test. Biometrics 1984;40:797-803.
# group sequential design with 90% power to detect delta = 6 delta <- 6 sigma <- 17 n <- 282 (des1 <- getDesign(IMax = n/(4*sigma^2), theta = delta, kMax = 3, alpha = 0.05, typeAlphaSpending = "sfHSD", parameterAlphaSpending = -4)) # crossed the boundary at the second look L <- 2 n1 <- n*2/3 delta1 <- 7 sigma1 <- 20 zL <- delta1/sqrt(4/n1*sigma1^2) # confidence interval getCI(L = L, zL = zL, IMax = n/(4*sigma1^2), informationRates = c(1/3, 2/3), alpha = 0.05, typeAlphaSpending = "sfHSD", parameterAlphaSpending = -4)# group sequential design with 90% power to detect delta = 6 delta <- 6 sigma <- 17 n <- 282 (des1 <- getDesign(IMax = n/(4*sigma^2), theta = delta, kMax = 3, alpha = 0.05, typeAlphaSpending = "sfHSD", parameterAlphaSpending = -4)) # crossed the boundary at the second look L <- 2 n1 <- n*2/3 delta1 <- 7 sigma1 <- 20 zL <- delta1/sqrt(4/n1*sigma1^2) # confidence interval getCI(L = L, zL = zL, IMax = n/(4*sigma1^2), informationRates = c(1/3, 2/3), alpha = 0.05, typeAlphaSpending = "sfHSD", parameterAlphaSpending = -4)
Obtains the p-value, conservative point estimate, and confidence interval after the end of a multi-arm multi-stage trial.
getCI_mams( M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, IMax = NA_real_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_ )getCI_mams( M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, IMax = NA_real_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_ )
M |
Number of active treatment arms. |
r |
Randomization ratio of each active arm to the common control. |
corr_known |
Logical. If |
L |
The termination look. |
zL |
The vector of z-test statistics at the termination look. |
IMax |
Maximum information for any active arm versus the common control. |
informationRates |
The information rates up to look |
efficacyStopping |
Indicators of whether efficacy stopping is
allowed at each stage up to look |
criticalValues |
The matrix of by-level upper boundaries on the
max z-test statistic scale for efficacy stopping up to look |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending for the trial.
One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
spendingTime |
The error spending time up to look |
If typeAlphaSpending is "OF", "P", "WT", or
"none", then informationRates, efficacyStopping,
and spendingTime must be of full length kMax, and
informationRates and spendingTime must end with 1.
A data frame with the following components:
level: Number of individual hypotheses considered for multiplicity.
index: The treatment arm with max Z among the active arms.
pvalue: p-value for rejecting the null hypothesis.
thetahat: Point estimate of the parameter.
cilevel: Confidence interval level.
lower: Lower bound of confidence interval.
upper: Upper bound of confidence interval.
Kaifeng Lu, [email protected]
Ping Gao, Yingqiu Li. Adaptive multiple comparison sequential design (AMCSD) for clinical trials. Journal of Biopharmaceutical Statistics, 2024, 34(3), 424-440.
getCI_mams( L = 2, zL = c(2.075, 2.264), M = 2, r = 1, corr_known = FALSE, IMax = 300 / 4, informationRates = c(1/2, 1), alpha = 0.025, typeAlphaSpending = "sfOF")getCI_mams( L = 2, zL = c(2.075, 2.264), M = 2, r = 1, corr_known = FALSE, IMax = 300 / 4, informationRates = c(1/2, 1), alpha = 0.025, typeAlphaSpending = "sfOF")
Obtains the p-value, point estimate, and confidence interval after the end of a phase 2/3 seamless trial.
getCI_seamless( M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, IMax = NA_real_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_ )getCI_seamless( M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, IMax = NA_real_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_ )
M |
Number of active treatment arms in Phase 2. |
r |
Randomization ratio of each active arm to the common control in Phase 2. |
corr_known |
Logical. If |
L |
The termination look in Phase 3. |
zL |
The z-test statistic at the termination look. |
IMax |
Maximum information for any active arm versus the common control. |
informationRates |
The information rates up to look |
efficacyStopping |
Indicators of whether efficacy stopping is
allowed at each stage up to look |
criticalValues |
The upper boundaries on the max z-test statistic
scale for Phase 2 and the z-test statistics for the selected arm
in Phase 3 up to look |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending for the trial.
One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
spendingTime |
The error spending time up to look |
If typeAlphaSpending is "OF", "P", "WT", or
"none", then informationRates, efficacyStopping,
and spendingTime must be of full length , and
informationRates and spendingTime must end with 1.
A data frame with the following components:
pvalue: p-value for rejecting the null hypothesis.
thetahat: Point estimate of the parameter.
cilevel: Confidence interval level.
lower: Lower bound of confidence interval.
upper: Upper bound of confidence interval.
Kaifeng Lu, [email protected]
Ping Gao, Yingqiu Li. Adaptive two-stage seamless sequential design for clinical trials. Journal of Biopharmaceutical Statistics, 2025, 35(4), 565-587.
getCI_seamless( L = 2, zL = 2.075, M = 2, r = 1, corr_known = FALSE, IMax = 300 / 4, informationRates = c(1/3, 2/3, 1), alpha = 0.025, typeAlphaSpending = "sfOF")getCI_seamless( L = 2, zL = 2.075, M = 2, r = 1, corr_known = FALSE, IMax = 300 / 4, informationRates = c(1/3, 2/3, 1), alpha = 0.025, typeAlphaSpending = "sfOF")
Obtains the conditional power for specified incremental information given the interim results, parameter values, and data-dependent changes in the error spending function, as well as the number and spacing of interim looks.
getCP( INew = NA_real_, L = NA_integer_, zL = NA_real_, theta = NA_real_, IMax = NA_real_, kMax = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, spendingTime = NA_real_, MullerSchafer = FALSE, kNew = NA_integer_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, futilityStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, futilityBoundsInt = NULL, futilityCPInt = NULL, futilityThetaInt = NULL, typeBetaSpendingNew = "none", parameterBetaSpendingNew = NA_real_, spendingTimeNew = NA_real_, varianceRatio = 1 )getCP( INew = NA_real_, L = NA_integer_, zL = NA_real_, theta = NA_real_, IMax = NA_real_, kMax = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, spendingTime = NA_real_, MullerSchafer = FALSE, kNew = NA_integer_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, futilityStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, futilityBoundsInt = NULL, futilityCPInt = NULL, futilityThetaInt = NULL, typeBetaSpendingNew = "none", parameterBetaSpendingNew = NA_real_, spendingTimeNew = NA_real_, varianceRatio = 1 )
INew |
The maximum information of the secondary trial. |
L |
The interim adaptation look of the primary trial. |
zL |
The z-test statistic at the interim adaptation look of the primary trial. |
theta |
A scalar or a vector of parameter values of
length |
IMax |
The maximum information of the primary trial. |
kMax |
The maximum number of stages of the primary trial. |
informationRates |
The information rates of the primary trial. |
efficacyStopping |
Indicators of whether efficacy stopping is allowed at each stage of the primary trial. Defaults to true if left unspecified. |
futilityStopping |
Indicators of whether futility stopping is allowed at each stage of the primary trial. Defaults to true if left unspecified. |
criticalValues |
The upper boundaries on the z-test statistic scale for efficacy stopping for the primary trial. |
alpha |
The significance level of the primary trial. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending for the primary
trial. One of the following:
|
parameterAlphaSpending |
The parameter value of alpha spending
for the primary trial. Corresponds to |
userAlphaSpending |
The user defined alpha spending for the primary trial. Cumulative alpha spent up to each stage. |
futilityBounds |
The lower boundaries on the z-test statistic scale
for futility stopping for the primary trial. Defaults to
|
futilityCP |
The conditional power-based futility bounds for the primary trial. |
futilityTheta |
The parameter value-based futility bounds for the primary trial. |
spendingTime |
The error spending time of the primary trial.
Defaults to missing, in which case, it is the same as
|
MullerSchafer |
Whether to use the Muller and Schafer (2001) method for trial adaptation. |
kNew |
The number of looks of the secondary trial. |
informationRatesNew |
The spacing of looks of the secondary trial. |
efficacyStoppingNew |
The indicators of whether efficacy stopping is allowed at each look of the secondary trial. Defaults to true if left unspecified. |
futilityStoppingNew |
The indicators of whether futility stopping is allowed at each look of the secondary trial. Defaults to true if left unspecified. |
typeAlphaSpendingNew |
The type of alpha spending for the secondary
trial. One of the following:
|
parameterAlphaSpendingNew |
The parameter value of alpha spending
for the secondary trial. Corresponds to |
futilityBoundsInt |
The futility boundaries on the z statistic scale for new stages of the integrated trial. |
futilityCPInt |
The conditional power-based futility bounds for new stages of the integrated trial. |
futilityThetaInt |
The parameter value-based futility bounds for the new stages of the integrated trial. |
typeBetaSpendingNew |
The type of beta spending for the secondary
trial. One of the following:
|
parameterBetaSpendingNew |
The parameter value of beta spending
for the secondary trial. Corresponds to |
spendingTimeNew |
The error spending time of the secondary trial.
Defaults to missing, in which case, it is the same as
|
varianceRatio |
The ratio of the variance under H0 to the variance under H1. |
A vector of two conditional powers given the interim results and parameter values, one without design change and the other with data-dependent design changes.
Kaifeng Lu, [email protected]
Cyrus R. Mehta and Stuart J. Pocock. Adaptive increase in sample size when interim results are promising: A practical guide with examples. Stat Med. 2011;30:3267–3284.
# Conditional power calculation with delayed treatment effect # Two interim analyses have occurred with 179 and 266 events, # respectively. The observed hazard ratio at the second interim # look is 0.81. trialsdt <- as.Date("2020-03-04") # trial start date iadt <- c(as.Date("2022-02-01"), as.Date("2022-11-01")) # interim dates mo1 <- as.numeric(iadt - trialsdt + 1)/30.4375 # interim months # Assume a piecewise Poisson enrollment process with a 8-month ramp-up # and 521 patients were enrolled after 17.94 months N <- 521 # total number of patients Ta <- 17.94 # enrollment duration Ta1 <- 8 # assumed end of enrollment ramp-up enrate <- N / (Ta - Ta1/2) # enrollment rate after ramp-up # Assume a median survival of 16.7 months for the control group, a # 5-month delay in treatment effect, and a hazard ratio of 0.7 after # the delay lam1 <- log(2)/16.7 # control group hazard of exponential distribution t1 <- 5 # months of delay in treatment effect hr <- 0.7 # hazard ratio after delay lam2 <- hr*lam1 # treatment group hazard after delay # Assume an annual dropout rate of 5% gam <- -log(1-0.05)/12 # hazard for dropout # The original target number of events was 298 and the new target is 335 mo2 <- caltime( nevents = c(298, 335), allocationRatioPlanned = 1, accrualTime = seq(0, Ta1), accrualIntensity = enrate*seq(1, Ta1+1)/(Ta1+1), piecewiseSurvivalTime = c(0, t1), lambda1 = c(lam1, lam2), lambda2 = c(lam1, lam1), gamma1 = gam, gamma2 = gam, accrualDuration = Ta, followupTime = 1000) # expected number of events and average hazard ratios (lr1 <- lrstat( time = c(mo1, mo2), accrualTime = seq(0, Ta1), accrualIntensity = enrate*seq(1, Ta1+1)/(Ta1+1), piecewiseSurvivalTime = c(0, t1), lambda1 = c(lam1, lam2), lambda2 = c(lam1, lam1), gamma1 = gam, gamma2 = gam, accrualDuration = Ta, followupTime = 1000, predictTarget = 3)) hr2 <- 0.81 # observed hazard ratio at interim 2 z2 <- (-log(hr2))*sqrt(266/4) # corresponding z-test statistic value # expected mean of -log(HR) at the original looks and the new final look theta <- -log(lr1$HR[c(1,2,3,4)]) # conditional power with sample size increase getCP(INew = (335 - 266)/4, L = 2, zL = z2, theta = theta, IMax = 298/4, kMax = 3, informationRates = c(179, 266, 298)/298, alpha = 0.025, typeAlphaSpending = "sfOF")# Conditional power calculation with delayed treatment effect # Two interim analyses have occurred with 179 and 266 events, # respectively. The observed hazard ratio at the second interim # look is 0.81. trialsdt <- as.Date("2020-03-04") # trial start date iadt <- c(as.Date("2022-02-01"), as.Date("2022-11-01")) # interim dates mo1 <- as.numeric(iadt - trialsdt + 1)/30.4375 # interim months # Assume a piecewise Poisson enrollment process with a 8-month ramp-up # and 521 patients were enrolled after 17.94 months N <- 521 # total number of patients Ta <- 17.94 # enrollment duration Ta1 <- 8 # assumed end of enrollment ramp-up enrate <- N / (Ta - Ta1/2) # enrollment rate after ramp-up # Assume a median survival of 16.7 months for the control group, a # 5-month delay in treatment effect, and a hazard ratio of 0.7 after # the delay lam1 <- log(2)/16.7 # control group hazard of exponential distribution t1 <- 5 # months of delay in treatment effect hr <- 0.7 # hazard ratio after delay lam2 <- hr*lam1 # treatment group hazard after delay # Assume an annual dropout rate of 5% gam <- -log(1-0.05)/12 # hazard for dropout # The original target number of events was 298 and the new target is 335 mo2 <- caltime( nevents = c(298, 335), allocationRatioPlanned = 1, accrualTime = seq(0, Ta1), accrualIntensity = enrate*seq(1, Ta1+1)/(Ta1+1), piecewiseSurvivalTime = c(0, t1), lambda1 = c(lam1, lam2), lambda2 = c(lam1, lam1), gamma1 = gam, gamma2 = gam, accrualDuration = Ta, followupTime = 1000) # expected number of events and average hazard ratios (lr1 <- lrstat( time = c(mo1, mo2), accrualTime = seq(0, Ta1), accrualIntensity = enrate*seq(1, Ta1+1)/(Ta1+1), piecewiseSurvivalTime = c(0, t1), lambda1 = c(lam1, lam2), lambda2 = c(lam1, lam1), gamma1 = gam, gamma2 = gam, accrualDuration = Ta, followupTime = 1000, predictTarget = 3)) hr2 <- 0.81 # observed hazard ratio at interim 2 z2 <- (-log(hr2))*sqrt(266/4) # corresponding z-test statistic value # expected mean of -log(HR) at the original looks and the new final look theta <- -log(lr1$HR[c(1,2,3,4)]) # conditional power with sample size increase getCP(INew = (335 - 266)/4, L = 2, zL = z2, theta = theta, IMax = 298/4, kMax = 3, informationRates = c(179, 266, 298)/298, alpha = 0.025, typeAlphaSpending = "sfOF")
Obtains the conditional power for specified incremental information given the interim results, parameter values, and data-dependent changes in the selected treatment(s), the error spending function, as well as the number and spacing of interim looks.
getCP_mams( INew = NA_real_, M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, theta = NA_real_, IMax = NA_real_, kMax = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, spendingTime = NA_real_, MullerSchafer = FALSE, MNew = NA_integer_, selected = NA_integer_, rNew = 1, kNew = NA_integer_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, futilityStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, futilityBoundsInt = NULL, futilityCPInt = NULL, futilityThetaInt = NULL, typeBetaSpendingNew = "none", parameterBetaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )getCP_mams( INew = NA_real_, M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, theta = NA_real_, IMax = NA_real_, kMax = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, spendingTime = NA_real_, MullerSchafer = FALSE, MNew = NA_integer_, selected = NA_integer_, rNew = 1, kNew = NA_integer_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, futilityStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, futilityBoundsInt = NULL, futilityCPInt = NULL, futilityThetaInt = NULL, typeBetaSpendingNew = "none", parameterBetaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )
INew |
The maximum information for any active arm versus the common control in the secondary trial. |
M |
Number of active treatment arms in the primary trial. |
r |
Randomization ratio of each active arm to the common control in the primary trial. |
corr_known |
Logical. If |
L |
The interim adaptation look of the primary trial. |
zL |
The z-test statistics at the interim adaptation look of the primary trial. |
theta |
A vector of length |
IMax |
Maximum information for any active arm versus the common control for the primary trial. Must be provided. |
kMax |
The maximum number of stages of the primary trial. |
informationRates |
The information rates of the primary trial. |
efficacyStopping |
Indicators of whether efficacy stopping is
allowed at each stage of the primary trial. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed at each stage of the primary trial. |
criticalValues |
The upper boundaries on the max z-test statistic scale for efficacy stopping for the primary trial. If missing, boundaries will be computed based on the specified alpha spending function. |
alpha |
The significance level of the primary trial. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending for the primary
trial. One of the following:
|
parameterAlphaSpending |
The parameter value of alpha spending
for the primary trial. Corresponds to |
userAlphaSpending |
The user-defined alpha spending for the primary trial. Represents the cumulative alpha spent up to each stage. |
futilityBounds |
The futility boundaries on the max-z statistic
scale for the primary trial. Defaults to |
futilityCP |
The conditional power-based futility bounds for the primary trial. |
futilityTheta |
The parameter value-based futility bounds for the primary trial. |
spendingTime |
The error spending time of the primary trial.
Defaults to missing, in which case it is assumed to be the same as
|
MullerSchafer |
Whether to use the Muller and Schafer (2001) method for trial adaptation. |
MNew |
Number of active treatment arms in the secondary trial. |
selected |
The indices of the selected active treatment arms for the secondary trial. |
rNew |
Randomization ratio of each active arm to the common control in the secondary trial. |
kNew |
The number of looks of the secondary trial. |
informationRatesNew |
The spacing of looks of the secondary trial. |
efficacyStoppingNew |
The indicators of whether efficacy stopping is
allowed at each look of the secondary trial. Defaults to |
futilityStoppingNew |
The indicators of whether futility stopping is
allowed at each look of the secondary trial. Defaults to |
typeAlphaSpendingNew |
The type of alpha spending for the secondary
trial. One of the following:
|
parameterAlphaSpendingNew |
The parameter value of alpha spending
for the secondary trial. Corresponds to
|
futilityBoundsInt |
The futility boundaries on the max-z statistic scale for new stages of the integrated trial. |
futilityCPInt |
The conditional power-based futility bounds for new stages of the integrated trial. |
futilityThetaInt |
The parameter value-based futility bounds for the new stages of the integrated trial. |
typeBetaSpendingNew |
The type of beta spending for the secondary
trial. One of the following:
|
parameterBetaSpendingNew |
The parameter value of beta spending
for the secondary trial. Corresponds to |
spendingTimeNew |
The error spending time of the secondary trial.
Defaults to missing, in which case it is assumed to be the same as
|
A vector of two conditional powers given the interim results and parameter values, one without design change and the other with data-dependent design changes.
Kaifeng Lu, [email protected]
Ping Gao, Yingqiu Li. Adaptive multiple comparison sequential design (AMCSD) for clinical trials. Journal of Biopharmaceutical Statistics, 2024, 34(3), 424-440.
getCP_mams( INew = 373 / 4, M = 2, r = 1, corr_known = FALSE, L = 1, zL = c(-log(0.91), -log(0.78)) * sqrt(324 / 4 / 2), theta = c(-log(0.91), -log(0.78)), IMax = 324 / 4, kMax = 2, informationRates = c(1/2, 1), alpha = 0.025, typeAlphaSpending = "OF", MNew = 1, selected = 2, rNew = 1)getCP_mams( INew = 373 / 4, M = 2, r = 1, corr_known = FALSE, L = 1, zL = c(-log(0.91), -log(0.78)) * sqrt(324 / 4 / 2), theta = c(-log(0.91), -log(0.78)), IMax = 324 / 4, kMax = 2, informationRates = c(1/2, 1), alpha = 0.025, typeAlphaSpending = "OF", MNew = 1, selected = 2, rNew = 1)
Obtains the conditional power for specified incremental information given the interim results, parameter values, and data-dependent changes in the error spending function, as well as the number and spacing of interim looks.
getCP_seamless( INew = NA_real_, M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, theta = NA_real_, IMax = NA_real_, K = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, spendingTime = NA_real_, MullerSchafer = FALSE, kNew = NA_integer_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, futilityStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, futilityBoundsInt = NULL, futilityCPInt = NULL, futilityThetaInt = NULL, typeBetaSpendingNew = "none", parameterBetaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )getCP_seamless( INew = NA_real_, M = NA_integer_, r = 1, corr_known = TRUE, L = NA_integer_, zL = NA_real_, theta = NA_real_, IMax = NA_real_, K = NA_integer_, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, spendingTime = NA_real_, MullerSchafer = FALSE, kNew = NA_integer_, informationRatesNew = NA_real_, efficacyStoppingNew = NA_integer_, futilityStoppingNew = NA_integer_, typeAlphaSpendingNew = "sfOF", parameterAlphaSpendingNew = NA_real_, futilityBoundsInt = NULL, futilityCPInt = NULL, futilityThetaInt = NULL, typeBetaSpendingNew = "none", parameterBetaSpendingNew = NA_real_, spendingTimeNew = NA_real_ )
INew |
The maximum information for the active arm versus the common control in the secondary trial. |
M |
Number of active treatment arms in Phase 2. |
r |
Randomization ratio of each active arm to the common control in Phase 2. |
corr_known |
Logical. If |
L |
The interim adaptation look in Phase 3. |
zL |
The z-test statistic at the interim adaptation look of Phase 3. |
theta |
The assumed treatment effect for the selected arm versus the common control. |
IMax |
Maximum information for the active arm versus the common control for the original trial. Must be provided. |
K |
Number of sequential looks in Phase 3. |
informationRates |
A numeric vector of information rates fixed
before the trial. If unspecified, defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is
allowed at each stage of the primary trial. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed at each stage of the primary trial. Defaults to true if left unspecified. |
criticalValues |
The upper boundaries on the max z-test statistic scale for Phase 2 and the z-test statistics for the selected arm in Phase 3 for the primary trial. If missing, boundaries will be computed based on the specified alpha spending function. |
alpha |
The significance level of the primary trial. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending for the primary
trial. One of the following:
|
parameterAlphaSpending |
The parameter value of alpha spending
for the primary trial. Corresponds to |
userAlphaSpending |
The user-defined alpha spending for the primary trial. Represents the cumulative alpha spent up to each stage. |
futilityBounds |
The lower boundaries on the max z-test statistic scale for Phase 2 and the z-test statistics for the selected arm in Phase 3 for the primary trial. |
futilityCP |
The conditional power-based futility bounds for the primary trial. |
futilityTheta |
The parameter value-based futility bounds for the primary trial. |
spendingTime |
The error spending time of the primary trial.
Defaults to missing, in which case it is assumed to be the same as
|
MullerSchafer |
Whether to use the Muller and Schafer (2001) method for trial adaptation. |
kNew |
The number of looks of the secondary trial. |
informationRatesNew |
The spacing of looks of the secondary trial. |
efficacyStoppingNew |
The indicators of whether efficacy stopping is
allowed at each look of the secondary trial. Defaults to |
futilityStoppingNew |
The indicators of whether futility stopping is allowed at each look of the secondary trial. Defaults to true if left unspecified. |
typeAlphaSpendingNew |
The type of alpha spending for the secondary
trial. One of the following:
|
parameterAlphaSpendingNew |
The parameter value of alpha spending
for the secondary trial. Corresponds to |
futilityBoundsInt |
The futility boundaries on the z statistic scale for new stages of the integrated trial. |
futilityCPInt |
The conditional power-based futility bounds for new stages of the integrated trial. |
futilityThetaInt |
The parameter value-based futility bounds for the new stages of the integrated trial. |
typeBetaSpendingNew |
The type of beta spending for the secondary
trial. One of the following:
|
parameterBetaSpendingNew |
The parameter value of beta spending
for the secondary trial. Corresponds to |
spendingTimeNew |
The error spending time of the secondary trial.
Defaults to missing, in which case it is assumed to be the same as
|
A vector of two conditional powers given the interim results and parameter values, one without design change and the other with data-dependent design changes.
Kaifeng Lu, [email protected]
Ping Gao, Yingqiu Li. Adaptive two-stage seamless sequential design for clinical trials. Journal of Biopharmaceutical Statistics, 2025, 35(4), 565-587.
getCP_seamless( INew = 198 / 4, M = 2, r = 1, corr_known = FALSE, L = 1, zL = -log(0.67) * sqrt(80 / 4), theta = -log(0.691), IMax = 120 / 4, K = 2, informationRates = c(1/3, 2/3, 1), alpha = 0.025, typeAlphaSpending = "OF", kNew = 1)getCP_seamless( INew = 198 / 4, M = 2, r = 1, corr_known = FALSE, L = 1, zL = -log(0.67) * sqrt(80 / 4), theta = -log(0.691), IMax = 120 / 4, K = 2, informationRates = c(1/3, 2/3, 1), alpha = 0.025, typeAlphaSpending = "OF", kNew = 1)
Obtains the maximum information and stopping boundaries for a generic group sequential design assuming a constant treatment effect, or obtains the power given the maximum information and stopping boundaries.
getDesign( beta = NA_real_, IMax = NA_real_, theta = NA_real_, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_, varianceRatio = 1 )getDesign( beta = NA_real_, IMax = NA_real_, theta = NA_real_, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_, varianceRatio = 1 )
beta |
The type II error. |
IMax |
The maximum information. Either |
theta |
The parameter value. Null hypothesis is at |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility bounds on the conditional power scale. |
futilityTheta |
The futility bounds on the parameter scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
varianceRatio |
The ratio of the variance under H0 to the variance under H1. |
The function determines efficacy and futility bounds based on the inputs provided, following a clear priority order.
Efficacy bounds:
If criticalValues are supplied, they take precedence and all
alpha-spending parameters are ignored. Otherwise, efficacy bounds are
derived from the specified alpha-spending function.
Futility bounds: Futility inputs are evaluated in the following order of priority:
If futilityBounds are provided, they override all other
futility-related inputs (futilityCP, futilityTheta,
and beta-spending parameters).
If futilityBounds are not provided but futilityCP
is specified, then futilityTheta and beta-spending parameters
are ignored.
If only futilityTheta is provided, beta-spending parameters
are ignored.
If none of futilityBounds, futilityCP,
or futilityTheta are specified, futility bounds are computed
using the beta-spending approach.
An S3 class design object with three components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyTheta: The efficacy boundaries on the parameter
scale.
futilityTheta: The futility boundaries on the parameter
scale.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for
futility stopping under H0.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta
spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
varianceRatio: The ratio of the variance under H0
to the variance under H1.
Kaifeng Lu, [email protected]
Christopher Jennison, Bruce W. Turnbull. Group Sequential Methods with Applications to Clinical Trials. Chapman & Hall/CRC: Boca Raton, 2000, ISBN:0849303168
# Example 1: obtain the maximum information given power (design1 <- getDesign( beta = 0.2, theta = -log(0.7), kMax = 2, informationRates = c(0.5,1), alpha = 0.025, typeAlphaSpending = "sfOF", typeBetaSpending = "sfP")) # Example 2: obtain power given the maximum information (design2 <- getDesign( IMax = 72.5, theta = -log(0.7), kMax = 3, informationRates = c(0.5, 0.75, 1), alpha = 0.025, typeAlphaSpending = "sfOF", typeBetaSpending = "sfP"))# Example 1: obtain the maximum information given power (design1 <- getDesign( beta = 0.2, theta = -log(0.7), kMax = 2, informationRates = c(0.5,1), alpha = 0.025, typeAlphaSpending = "sfOF", typeBetaSpending = "sfP")) # Example 2: obtain power given the maximum information (design2 <- getDesign( IMax = 72.5, theta = -log(0.7), kMax = 3, informationRates = c(0.5, 0.75, 1), alpha = 0.025, typeAlphaSpending = "sfOF", typeBetaSpending = "sfP"))
Computes either the maximum information and stopping boundaries for a multi-arm multi-stage design, or the achieved power when the maximum information and stopping boundaries are provided.
getDesign_mams( beta = NA_real_, IMax = NA_real_, theta = NA_real_, M = NA_integer_, r = 1, corr_known = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesign_mams( beta = NA_real_, IMax = NA_real_, theta = NA_real_, M = NA_integer_, r = 1, corr_known = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
Type II error rate. Provide either |
IMax |
Maximum information for any active arm versus the common
control. Provide either |
theta |
A vector of length |
M |
Number of active treatment arms. |
r |
Randomization ratio of each active arm to the common control. |
corr_known |
Logical. If |
kMax |
Number of sequential looks. |
informationRates |
A numeric vector of information rates fixed
before the trial. If unspecified, defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
The matrix of by-level upper boundaries on the
max z-test statistic scale for efficacy stopping.
The first column is for level |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
A numeric vector of length |
futilityCP |
A numeric vector of length |
futilityTheta |
A numeric vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A numeric vector of length |
If corr_known is FALSE, critical boundaries are
computed assuming independence among the Wald statistics in each stage
(a conservative assumption). Power calculations, however, use the
correlation implied by the randomization ratio .
An S3 object of class mams with the following components:
overallResults: A data frame containing:
overallReject: Overall probability of rejecting the global
null hypothesis.
alpha: Overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
M: Number of active arms.
r: Randomization ratio per active arm versus control.
corr_known: Whether the correlation among Wald statistics
was assumed known.
kMax: Number of stages.
information: Maximum information for any active arm versus
control.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
byStageResults: A data frame containing:
informationRates: Information rates at each analysis.
efficacyBounds: Efficacy boundaries on the max Z-scale.
futilityBounds: Futility boundaries on the max Z-scale.
rejectPerStage: Probability of efficacy stopping at each stage.
futilityPerStage: Probability of futility stopping at each stage.
cumulativeRejection: Cumulative probability of efficacy stopping.
cumulativeFutility: Cumulative probability of futility stopping.
cumulativeAlphaSpent: Cumulative alpha spent.
efficacyTheta: Efficacy boundaries on the parameter scale.
futilityTheta: Futility boundaries on the parameter scale.
efficacyP: Efficacy boundaries on the p-value scale.
futilityP: Futility boundaries on the p-value scale.
information: Cumulative information for any active arm versus
control at each analysis.
efficacyStopping: Indicator of whether efficacy stopping
is permitted at each stage.
futilityStopping: Indicator of whether futility stopping
is permitted at each stage.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for
futility stopping under H0.
settings: A list of input settings:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for the chosen
alpha spending function.
userAlphaSpending: The user-specified alpha spending values.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for the chosen
beta spending function.
userBetaSpending: The user-specified beta spending values.
spendingTime: The error-spending time at each analysis.
byLevelBounds: A data frame containing the efficacy boundaries
for each level of testing (i.e., number of active arms remaining) and
each stage. Columns include:
level: Number of active arms remaining (1 to ).
stage: Stage index (1 to kMax).
efficacyBounds: Efficacy boundaries on the max Z-scale
for the given level and stage.
Kaifeng Lu, [email protected]
Ping Gao, Yingqiu Li. Adaptive multiple comparison sequential design (AMCSD) for clinical trials. Journal of Biopharmaceutical Statistics, 2024, 34(3), 424-440.
# Example 1: obtain the maximum information given power (design1 <- getDesign_mams( beta = 0.1, theta = c(0.3, 0.5), M = 2, r = 1.0, kMax = 3, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "OF")) # Example 2: obtain power given the maximum information (design2 <- getDesign_mams( IMax = 110/(2*1^2), theta = c(0.3, 0.5), M = 2, r = 1.0, kMax = 3, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "OF")) # Example 3: derive futility boundaries using beta spending (design3 <- getDesign_mams( IMax = 27.22, theta = c(-log(0.5), -log(0.75)), M = 2, r = 1.0, corr_known = FALSE, kMax = 3, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "sfOF", typeBetaSpending = "sfHSD", parameterBetaSpending = -2))# Example 1: obtain the maximum information given power (design1 <- getDesign_mams( beta = 0.1, theta = c(0.3, 0.5), M = 2, r = 1.0, kMax = 3, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "OF")) # Example 2: obtain power given the maximum information (design2 <- getDesign_mams( IMax = 110/(2*1^2), theta = c(0.3, 0.5), M = 2, r = 1.0, kMax = 3, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "OF")) # Example 3: derive futility boundaries using beta spending (design3 <- getDesign_mams( IMax = 27.22, theta = c(-log(0.5), -log(0.75)), M = 2, r = 1.0, corr_known = FALSE, kMax = 3, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "sfOF", typeBetaSpending = "sfHSD", parameterBetaSpending = -2))
Computes either the maximum information and stopping boundaries for a phase 2/3 seamless design, or the achieved power when the maximum information and stopping boundaries are provided. Both efficacy and futility stopping can be incorporated.
getDesign_seamless( beta = NA_real_, IMax = NA_real_, theta = NA_real_, M = NA_integer_, r = 1, corr_known = TRUE, K = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesign_seamless( beta = NA_real_, IMax = NA_real_, theta = NA_real_, M = NA_integer_, r = 1, corr_known = TRUE, K = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityTheta = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
Type II error rate. Provide either |
IMax |
Maximum information for any active arm versus the common
control. Provide either |
theta |
A vector of length |
M |
Number of active treatment arms in Phase 2. |
r |
Randomization ratio of each active arm to the common control in Phase 2. |
corr_known |
Logical. If |
K |
Number of sequential looks in Phase 3. |
informationRates |
A numeric vector of information rates fixed
before the trial. If unspecified, defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
The upper boundaries on the max-Z statistic scale for Phase 2 and the Z statistics for the selected arm in Phase 3. If missing, boundaries will be computed based on the specified alpha spending function. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
A numeric vector of length |
futilityCP |
A numeric vector of length |
futilityTheta |
A numeric vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A numeric vector of length |
If corr_known is FALSE, critical boundaries are
computed assuming independence among the Phase-2 Wald statistics
(a conservative assumption). Power calculations, however, use the
correlation implied by the randomization ratio .
Futility boundaries may be supplied directly on the Z scale, derived from conditional power, derived from parameter values, or computed from a beta spending function.
An S3 object of class seamless with the following components:
overallResults: A data frame containing:
overallReject: Overall probability of rejecting the null
hypothesis.
alpha: Overall significance level.
attainedAlpha: The attained significance level, which may
differ from alpha in the presence of futility stopping.
M: Number of active arms in Phase 2.
r: Randomization ratio per active arm versus control in
Phase 2.
corr_known: Whether the phase-2 correlation was assumed known.
K: Number of looks in Phase 3.
information: Maximum information for any active arm versus
control.
expectedInformationH1: Expected information under the
alternative.
expectedInformationH0: Expected information under the null.
informationOverall: Maximum information for the overall study.
expectedInformationH1: Expected information under the
alternative for the overall study.
expectedInformationH0: Expected information under the null
for the overall study.
byStageResults: A data frame containing:
informationRates: Information rates at each analysis.
efficacyBounds: Efficacy boundaries on the Z scale.
futilityBounds: Futility boundaries on the Z scale.
rejectPerStage: Probability of efficacy stopping at each stage.
futilityPerStage: Probability of futility stopping at each
stage.
cumulativeRejection: Cumulative probability of efficacy
stopping.
cumulativeFutility: Cumulative probability of futility
stopping.
cumulativeAlphaSpent: Cumulative alpha spent.
efficacyTheta: Efficacy boundaries on the parameter scale.
futilityTheta: Futility boundaries on the parameter scale.
efficacyP: Efficacy boundaries on the p-value scale.
futilityP: Futility boundaries on the p-value scale.
information: Cumulative information at each analysis.
informationOverall: Cumulative information for the overall
study at each analysis.
efficacyStopping: Indicator of whether efficacy stopping is
permitted.
futilityStopping: Indicator of whether futility stopping is
permitted.
rejectPerStageH0: Probability of efficacy stopping under the
global null.
futilityPerStageH0: Probability of futility stopping under the
global null.
cumulativeRejectionH0: Cumulative probability of efficacy
stopping under the global null.
cumulativeFutilityH0: Cumulative probability of futility
stopping under the global null.
byArmResults: A data frame containing:
theta: Parameter values for the active arms.
selectAsBest: Probability an arm is selected as best at the
end of Phase 2.
powerByArm: Probability of rejecting the null for each arm by
trial end.
condPowerByArm: Conditional power for each arm given it was
selected as the best at the end of Phase 2.
settings: A list of input settings:
typeAlphaSpending: Type of alpha spending function.
parameterAlphaSpending: Parameter value for the chosen alpha
spending function.
userAlphaSpending: User-specified alpha spending values.
typeBetaSpending: Type of beta spending function.
parameterBetaSpending: Parameter value for the chosen beta
spending function.
userBetaSpending: User-specified beta spending values.
spendingTime: Error-spending times at each analysis.
Kaifeng Lu, [email protected]
Ping Gao, Yingqiu Li. Adaptive two-stage seamless sequential design for clinical trials. Journal of Biopharmaceutical Statistics, 2025, 35(4), 565-587.
# Example 1: obtain the maximum information given power with no futility (design1 <- getDesign_seamless( beta = 0.1, theta = c(0.3, 0.5), M = 2, r = 1.0, K = 2, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "OF")) # Example 2: obtain power given the maximum information and a futility rule (design2 <- getDesign_seamless( IMax = 110/(2*1^2), theta = c(0.3, 0.5), M = 2, r = 1.0, K = 2, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "OF", futilityBounds = c(0.0, 0.5))) # Example 3: derive futility boundaries using beta spending (design3 <- getDesign_seamless( beta = 0.1, theta = c(-log(0.5), -log(0.7)), M = 2, r = 1.0, corr_known = FALSE, K = 2, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "sfOF", typeBetaSpending = "sfHSD", parameterBetaSpending = -2))# Example 1: obtain the maximum information given power with no futility (design1 <- getDesign_seamless( beta = 0.1, theta = c(0.3, 0.5), M = 2, r = 1.0, K = 2, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "OF")) # Example 2: obtain power given the maximum information and a futility rule (design2 <- getDesign_seamless( IMax = 110/(2*1^2), theta = c(0.3, 0.5), M = 2, r = 1.0, K = 2, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "OF", futilityBounds = c(0.0, 0.5))) # Example 3: derive futility boundaries using beta spending (design3 <- getDesign_seamless( beta = 0.1, theta = c(-log(0.5), -log(0.7)), M = 2, r = 1.0, corr_known = FALSE, K = 2, informationRates = seq(1, 3)/3, alpha = 0.025, typeAlphaSpending = "sfOF", typeBetaSpending = "sfHSD", parameterBetaSpending = -2))
Obtains the maximum information and stopping boundaries for a generic group sequential design with futility stopping under the null hypothesis assuming a constant treatment effect, or obtains the power given the maximum information and stopping boundaries.
getDesign2( beta = NA_real_, IMax = NA_real_, theta = NA_real_, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, symmetricBounds = TRUE, astar = 0.025, futilityBounds = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_, varianceRatio = 1 )getDesign2( beta = NA_real_, IMax = NA_real_, theta = NA_real_, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, symmetricBounds = TRUE, astar = 0.025, futilityBounds = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_, varianceRatio = 1 )
beta |
The type II error. |
IMax |
The maximum information. Either |
theta |
The parameter value. Null hypothesis is at |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
symmetricBounds |
If |
astar |
The overall futility stopping probability under the null hypothesis. |
futilityBounds |
A vector of length |
typeBetaSpending |
The type of beta spending function for determining
futility bounds under the null hypothesis when |
parameterBetaSpending |
The parameter for the beta spending function.
Corresponds to |
userBetaSpending |
A vector of length |
spendingTime |
A vector of length |
varianceRatio |
The ratio of the variance under H0 to the variance under H1. |
The futility stopping boundaries under the null hypothesis are non-binding. The function determines efficacy and futility bounds based on the inputs provided, following a clear priority order.
Efficacy bounds:
If criticalValues are supplied, they take precedence and all
alpha-spending parameters are ignored. Otherwise, efficacy bounds are
derived from the specified alpha-spending function.
Futility bounds: Futility inputs are evaluated in the following order of priority:
If futilityBounds are provided, they override
beta-spending parameters.
If futilityBounds are not
specified, futility bounds are computed using the beta-spending approach
with astar being the maximum futility stopping probability under
the null hypothesis. If typeBetaSpending == "none",
then there is no futility stopping under the null hypothesis.
If symmetricBounds = TRUE, the futility bounds are set to
-efficacyBounds and beta-spending inputs are ignored.
An S3 class design object with three components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
astar: The overall futility stopping probability under the
null hypothesis.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyTheta: The efficacy boundaries on the parameter
scale.
futilityTheta: The futility boundaries on the parameter
scale.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for
futility stopping under H0.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta
spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
varianceRatio: The ratio of the variance under H0
to the variance under H1.
Kaifeng Lu, [email protected]
Christopher Jennison, Bruce W. Turnbull. Group Sequential Methods with Applications to Clinical Trials. Chapman & Hall/CRC: Boca Raton, 2000, ISBN:0849303168
(design1 <- getDesign2( beta = 0.149, theta = -log(0.65), kMax = 2, informationRates = c(0.87, 1), alpha = 0.004, typeAlphaSpending = "sfOF", astar = 0.1, typeBetaSpending = "sfHSD", parameterBetaSpending = -8))(design1 <- getDesign2( beta = 0.149, theta = -log(0.65), kMax = 2, informationRates = c(0.87, 1), alpha = 0.004, typeAlphaSpending = "sfOF", astar = 0.1, typeBetaSpending = "sfHSD", parameterBetaSpending = -8))
Obtains the power given sample size or obtains the sample size given power for Cohen's kappa.
getDesignAgreement( beta = NA_real_, n = NA_real_, ncats = NA_integer_, kappaH0 = NA_real_, kappa = NA_real_, p1 = NA_real_, p2 = NA_real_, rounding = TRUE, alpha = 0.025 )getDesignAgreement( beta = NA_real_, n = NA_real_, ncats = NA_integer_, kappaH0 = NA_real_, kappa = NA_real_, p1 = NA_real_, p2 = NA_real_, rounding = TRUE, alpha = 0.025 )
beta |
The type II error. |
n |
The total sample size. |
ncats |
The number of categories. |
kappaH0 |
The kappa coefficient under the null hypothesis. |
kappa |
The kappa coefficient under the alternative hypothesis. |
p1 |
The marginal probabilities for the first rater. |
p2 |
The marginal probabilities for the second rater. Defaults to be equal to the marginal probabilities for the first rater if not provided. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
alpha |
The one-sided significance level. Defaults to 0.025. |
The kappa coefficient is defined as
where
is the observed agreement, and
is the expected agreement
by chance.
By Fleiss et al. (1969), the variance of is given by
where
Given and marginals
,
we obtain . The only unknowns are the double summation
in and the single summation in .
We find the optimal configuration of cell probabilities that yield the
maximum variance of by treating the problem as a
linear programming problem with constraints to match the given
marginal probabilities and the observed agreement and ensure that
the cell probabilities are nonnegative. This is an extension of
Flack et al. (1988) by allowing unequal marginal probabilities
of the two raters.
We perform the optimization under both the null and alternative
hypotheses to obtain
and for a
single subject, and then calculate the sample size or power
according to the following equation:
An S3 class designAgreement object with the
following components:
power: The power to reject the null hypothesis.
alpha: The one-sided significance level.
n: The total sample size.
ncats: The number of categories.
kappaH0: The kappa coefficient under the null hypothesis.
kappa: The kappa coefficient under the alternative hypothesis.
p1: The marginal probabilities for the first rater.
p2: The marginal probabilities for the second rater.
piH0: The cell probabilities that maximize the
variance of estimated kappa under H0.
pi: The cell probabilities that maximize the
variance of estimated kappa under H1.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
V. F. Flack, A. A. Afifi, and P. A. Lachenbruch. Sample size determinations for the two rater kappa statistic. Psychometrika 1988; 53:321-325.
(design1 <- getDesignAgreement( beta = 0.2, n = NA, ncats = 4, kappaH0 = 0.4, kappa = 0.6, p1 = c(0.1, 0.2, 0.3, 0.4), p2 = c(0.15, 0.2, 0.24, 0.41), rounding = TRUE, alpha = 0.05))(design1 <- getDesignAgreement( beta = 0.2, n = NA, ncats = 4, kappaH0 = 0.4, kappa = 0.6, p1 = c(0.1, 0.2, 0.3, 0.4), p2 = c(0.15, 0.2, 0.24, 0.41), rounding = TRUE, alpha = 0.05))
Obtains the power and sample size for one-way analysis of variance.
getDesignANOVA( beta = NA_real_, n = NA_real_, ngroups = 2, means = NA_real_, stDev = 1, allocationRatioPlanned = NA_real_, rounding = TRUE, alpha = 0.05 )getDesignANOVA( beta = NA_real_, n = NA_real_, ngroups = 2, means = NA_real_, stDev = 1, allocationRatioPlanned = NA_real_, rounding = TRUE, alpha = 0.05 )
beta |
The type II error. |
n |
The total sample size. |
ngroups |
The number of treatment groups. |
means |
The treatment group means. |
stDev |
The common standard deviation. |
allocationRatioPlanned |
Allocation ratio for the treatment
groups. It has length |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
alpha |
The two-sided significance level. Defaults to 0.05. |
Let denote the group means, and
denote the randomization probabilities
to the treatment groups. Let denote the
common standard deviation, and denote the total sample
size. Then the -statistic
where
is the noncentrality parameter, and
.
An S3 class designANOVA object with the following
components:
power: The power to reject the null hypothesis that
there is no difference among the treatment groups.
alpha: The two-sided significance level.
n: The number of subjects.
ngroups: The number of treatment groups.
means: The treatment group means.
stDev: The common standard deviation.
effectsize: The effect size.
allocationRatioPlanned: Allocation ratio for the treatment
groups.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignANOVA( beta = 0.1, ngroups = 4, means = c(1.5, 2.5, 2, 0), stDev = 3.5, allocationRatioPlanned = c(2, 2, 2, 1), alpha = 0.05))(design1 <- getDesignANOVA( beta = 0.1, ngroups = 4, means = c(1.5, 2.5, 2, 0), stDev = 3.5, allocationRatioPlanned = c(2, 2, 2, 1), alpha = 0.05))
Obtains the power and sample size for a single contrast in one-way analysis of variance.
getDesignANOVAContrast( beta = NA_real_, n = NA_real_, ngroups = 2, means = NA_real_, stDev = 1, contrast = NA_real_, meanContrastH0 = 0, allocationRatioPlanned = NA_real_, rounding = TRUE, alpha = 0.025 )getDesignANOVAContrast( beta = NA_real_, n = NA_real_, ngroups = 2, means = NA_real_, stDev = 1, contrast = NA_real_, meanContrastH0 = 0, allocationRatioPlanned = NA_real_, rounding = TRUE, alpha = 0.025 )
beta |
The type II error. |
n |
The total sample size. |
ngroups |
The number of treatment groups. |
means |
The treatment group means. |
stDev |
The common standard deviation. |
contrast |
The coefficients for the single contrast. |
meanContrastH0 |
The mean of the contrast under the null hypothesis. |
allocationRatioPlanned |
Allocation ratio for the treatment
groups. It has length |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
alpha |
The one-sided significance level. Defaults to 0.025. |
An S3 class designANOVAContrast object with the following
components:
power: The power to reject the null hypothesis for the
treatment contrast.
alpha: The one-sided significance level.
n: The number of subjects.
ngroups: The number of treatment groups.
means: The treatment group means.
stDev: The common standard deviation.
contrast: The coefficients for the single contrast.
meanContrastH0: The mean of the contrast under the null
hypothesis.
meanContrast: The mean of the contrast under the alternative
hypothesis.
effectsize: The effect size.
allocationRatioPlanned: Allocation ratio for the treatment
groups.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignANOVAContrast( beta = 0.1, ngroups = 4, means = c(1.5, 2.5, 2, 0), stDev = 3.5, contrast = c(1, 1, 1, -3), allocationRatioPlanned = c(2, 2, 2, 1), alpha = 0.025))(design1 <- getDesignANOVAContrast( beta = 0.1, ngroups = 4, means = c(1.5, 2.5, 2, 0), stDev = 3.5, contrast = c(1, 1, 1, -3), allocationRatioPlanned = c(2, 2, 2, 1), alpha = 0.025))
Obtains the maximum information and stopping boundaries for a generic group sequential equivalence design assuming a constant treatment effect, or obtains the power given the maximum information and stopping boundaries.
getDesignEquiv( beta = NA_real_, IMax = NA_real_, thetaLower = NA_real_, thetaUpper = NA_real_, theta = 0, kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )getDesignEquiv( beta = NA_real_, IMax = NA_real_, thetaLower = NA_real_, thetaUpper = NA_real_, theta = 0, kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
IMax |
The maximum information. Either |
thetaLower |
The parameter value at the lower equivalence limit. |
thetaUpper |
The parameter value at the upper equivalence limit. |
theta |
The parameter value under the alternative hypothesis. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level for each of the two one-sided tests, e.g., 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
spendingTime |
A vector of length |
Consider the equivalence design with two one-sided hypotheses:
We reject at or before look if
for some , where are the
critical values associated with the specified alpha-spending function,
and is the information for (inverse variance of
) at the
th look. For example,
for estimating the risk difference ,
It follows that
where .
Similarly, we reject at or before look if
for some . We have
Let ,
and .
The cumulative probability to reject at
or before look under the alternative hypothesis is
given by
where
and
Of note, both and can be evaluated using
one-sided exit probabilities for group sequential designs.
If there exists such that , then
. Otherwise, can be evaluated using
two-sided exit probabilities for group sequential designs.
Since the equivalent hypothesis is tested using two one-sided tests,
the type I error is controlled. To evaluate the attained type I error
of the equivalence trial under (or ),
we simply fix the control group parameters, update the active
treatment group parameters according to the null hypothesis, and
use the parameters in the power calculation outlined above.
An S3 class designEquiv object with three components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlphaH10: The attained significance level under H10.
attainedAlphaH20: The attained significance level under H20.
kMax: The number of stages.
thetaLower: The parameter value at the lower equivalence
limit.
thetaUpper: The parameter value at the upper equivalence
limit.
theta: The parameter value under the alternative hypothesis.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH10: The expected information under H10.
expectedInformationH20: The expected information under H20.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale for
each of the two one-sided tests.
rejectPerStage: The probability for efficacy stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeAlphaSpent: The cumulative alpha for each of
the two one-sided tests.
cumulativeAttainedAlphaH10: The cumulative probability for
efficacy stopping under H10.
cumulativeAttainedAlphaH20: The cumulative probability for
efficacy stopping under H20.
efficacyThetaLower: The efficacy boundaries on the
parameter scale for the one-sided null hypothesis at the
lower equivalence limit.
efficacyThetaUpper: The efficacy boundaries on the
parameter scale for the one-sided null hypothesis at the
upper equivalence limit.
efficacyP: The efficacy bounds on the p-value scale for
each of the two one-sided tests.
information: The cumulative information.
settings: A list containing the following components:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
spendingTime: The error spending time at each analysis.
Kaifeng Lu, [email protected]
# Example 1: obtain the maximum information given power (design1 <- getDesignEquiv( beta = 0.2, thetaLower = log(0.8), thetaUpper = log(1.25), kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: obtain power given the maximum information (design2 <- getDesignEquiv( IMax = 72.5, thetaLower = log(0.7), thetaUpper = -log(0.7), kMax = 3, informationRates = c(0.5, 0.75, 1), alpha = 0.05, typeAlphaSpending = "sfOF"))# Example 1: obtain the maximum information given power (design1 <- getDesignEquiv( beta = 0.2, thetaLower = log(0.8), thetaUpper = log(1.25), kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: obtain power given the maximum information (design2 <- getDesignEquiv( IMax = 72.5, thetaLower = log(0.7), thetaUpper = -log(0.7), kMax = 3, informationRates = c(0.5, 0.75, 1), alpha = 0.05, typeAlphaSpending = "sfOF"))
Obtains the power given sample size or obtains the sample size given power for Fisher's exact test for two proportions.
getDesignFisherExact( beta = NA_real_, n = NA_real_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, alpha = 0.05 )getDesignFisherExact( beta = NA_real_, n = NA_real_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, alpha = 0.05 )
beta |
The type II error. |
n |
The total sample size. |
pi1 |
The assumed probability for the active treatment group. |
pi2 |
The assumed probability for the control group. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
alpha |
The two-sided significance level. Defaults to 0.05. |
A data frame with the following variables:
alpha: The two-sided significance level.
power: The power.
n: The sample size.
pi1: The assumed probability for the active treatment group.
pi2: The assumed probability for the control group.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
Kaifeng Lu, [email protected]
(design1 <- getDesignFisherExact( beta = 0.2, pi1 = 0.5, pi2 = 0.2, alpha = 0.05))(design1 <- getDesignFisherExact( beta = 0.2, pi1 = 0.5, pi2 = 0.2, alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for logistic regression of a binary response given the covariate of interest and other covariates.
getDesignLogistic( beta = NA_real_, n = NA_real_, ncovariates = NA_integer_, nconfigs = NA_integer_, x = NA_real_, pconfigs = NA_real_, corr = 0, oddsratios = NA_real_, responseprob = NA_real_, rounding = TRUE, alpha = 0.05 )getDesignLogistic( beta = NA_real_, n = NA_real_, ncovariates = NA_integer_, nconfigs = NA_integer_, x = NA_real_, pconfigs = NA_real_, corr = 0, oddsratios = NA_real_, responseprob = NA_real_, rounding = TRUE, alpha = 0.05 )
beta |
The type II error. |
n |
The total sample size. |
ncovariates |
The number of covariates. |
nconfigs |
The number of configurations of discretized covariate values. |
x |
The matrix of covariate values. |
pconfigs |
The vector of probabilities for the configurations. |
corr |
The multiple correlation between the predictor and other covariates. Defaults to 0. |
oddsratios |
The odds ratios for one unit increase in the covariates. |
responseprob |
The response probability in the full model when all predictor variables are equal to their means. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
alpha |
The two-sided significance level. Defaults to 0.05. |
We consider the logistic regression of a binary response variable
on a set of predictor variables
with being the covariate of interest:
where .
Similar to Self et al (1992), we assume that all covariates are
either inherently discrete or discretized from continuous
distributions (e.g. using the quantiles). Let denote the total
number of configurations of the covariate values. Let
denote the probabilities for the configurations of the covariates
under independence. The likelihood ratio test statistic for testing
can be approximated by a noncentral chi-square
distribution with one degree of freedom and noncentrality parameter
where
for , and
for . Here is the mean of ,
e.g., In addition, by
formulating the logistic regression in the framework of generalized
linear models,
and
The regression coefficients can be obtained by taking the
log of the odds ratios for the covariates. The intercept
can be derived as
where denotes the
response probability when all predictor variables are equal to their
means.
Finally, let denote the multiple correlation between
the predictor and other covariates. The noncentrality parameter
of the chi-square test is adjusted downward by multiplying by
.
An S3 class designLogistic object with the
following components:
power: The power to reject the null hypothesis.
alpha: The two-sided significance level.
n: The total sample size.
ncovariates: The number of covariates.
nconfigs: The number of configurations of discretized covariate
values.
x: The matrix of covariate values.
pconfigs: The vector of probabilities for the configurations.
corr: The multiple correlation between the predictor and other
covariates.
oddsratios: The odds ratios for one unit increase in the
covariates.
responseprob: The response probability in the full model when
all predictor variables are equal to their means.
effectsize: The effect size for the chi-square test.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
Steven G. Self, Robert H. Mauritsen and Jill Ohara. Power calculations for likelihood ratio tests in generalized linear models. Biometrics 1992; 48:31-39.
# two ordinal covariates x1 = c(5, 10, 15, 20) px1 = c(0.2, 0.3, 0.3, 0.2) x2 = c(2, 4, 6) px2 = c(0.4, 0.4, 0.2) # discretizing a normal distribution with mean 4 and standard deviation 2 nbins = 10 x3 = qnorm(((1:nbins) - 0.5)/nbins)*2 + 4 px3 = rep(1/nbins, nbins) # combination of covariate values nconfigs = length(x1)*length(x2)*length(x3) x = expand.grid(x3 = x3, x2 = x2, x1 = x1) x = as.matrix(x[, ncol(x):1]) # probabilities for the covariate configurations under independence pconfigs = as.numeric(px1 %x% px2 %x% px3) # convert the odds ratio for the predictor variable in 5-unit change # to the odds ratio in 1-unit change (design1 <- getDesignLogistic( beta = 0.1, ncovariates = 3, nconfigs = nconfigs, x = x, pconfigs = pconfigs, oddsratios = c(1.2^(1/5), 1.4, 1.3), responseprob = 0.25, alpha = 0.1))# two ordinal covariates x1 = c(5, 10, 15, 20) px1 = c(0.2, 0.3, 0.3, 0.2) x2 = c(2, 4, 6) px2 = c(0.4, 0.4, 0.2) # discretizing a normal distribution with mean 4 and standard deviation 2 nbins = 10 x3 = qnorm(((1:nbins) - 0.5)/nbins)*2 + 4 px3 = rep(1/nbins, nbins) # combination of covariate values nconfigs = length(x1)*length(x2)*length(x3) x = expand.grid(x3 = x3, x2 = x2, x1 = x1) x = as.matrix(x[, ncol(x):1]) # probabilities for the covariate configurations under independence pconfigs = as.numeric(px1 %x% px2 %x% px3) # convert the odds ratio for the predictor variable in 5-unit change # to the odds ratio in 1-unit change (design1 <- getDesignLogistic( beta = 0.1, ncovariates = 3, nconfigs = nconfigs, x = x, pconfigs = pconfigs, oddsratios = c(1.2^(1/5), 1.4, 1.3), responseprob = 0.25, alpha = 0.1))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for two-sample mean difference.
getDesignMeanDiff( beta = NA_real_, n = NA_real_, meanDiffH0 = 0, meanDiff = 0.5, stDev = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityMeanDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignMeanDiff( beta = NA_real_, n = NA_real_, meanDiffH0 = 0, meanDiff = 0.5, stDev = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityMeanDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
meanDiffH0 |
The mean difference under the null hypothesis. Defaults to 0. |
meanDiff |
The mean difference under the alternative hypothesis. |
stDev |
The standard deviation. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility boundary on the conditional power scale. |
futilityMeanDiff |
The futility boundary on the mean difference scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designMeanDiff object with three components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
meanDiffH0: The mean difference under the null hypothesis.
meanDiff: The mean difference under the alternative
hypothesis.
stDev: The standard deviation.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
efficacyMeanDiff: The efficacy boundaries on the mean
difference scale.
futilityMeanDiff: The futility boundaries on the mean
difference scale.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
# Example 1: group sequential trial power calculation (design1 <- getDesignMeanDiff( beta = NA, n = 456, meanDiff = 9, stDev = 32, kMax = 5, alpha = 0.025, typeAlphaSpending = "sfOF", typeBetaSpending = "sfP")) # Example 2: sample size calculation for two-sample t-test (design2 <- getDesignMeanDiff( beta = 0.1, n = NA, meanDiff = 0.3, stDev = 1, normalApproximation = FALSE, alpha = 0.025))# Example 1: group sequential trial power calculation (design1 <- getDesignMeanDiff( beta = NA, n = 456, meanDiff = 9, stDev = 32, kMax = 5, alpha = 0.025, typeAlphaSpending = "sfOF", typeBetaSpending = "sfP")) # Example 2: sample size calculation for two-sample t-test (design2 <- getDesignMeanDiff( beta = 0.1, n = NA, meanDiff = 0.3, stDev = 1, normalApproximation = FALSE, alpha = 0.025))
Obtains the power and sample size for direct treatment effects in crossover trials accounting or without accounting for carryover effects.
getDesignMeanDiffCarryover( beta = NA_real_, n = NA_real_, trtpair = NA_real_, carryover = TRUE, meanDiffH0 = 0, meanDiff = 0.5, stDev = 1, corr = 0.5, design = NA_real_, cumdrop = NA_real_, allocationRatioPlanned = NA_real_, normalApproximation = FALSE, rounding = TRUE, alpha = 0.025 )getDesignMeanDiffCarryover( beta = NA_real_, n = NA_real_, trtpair = NA_real_, carryover = TRUE, meanDiffH0 = 0, meanDiff = 0.5, stDev = 1, corr = 0.5, design = NA_real_, cumdrop = NA_real_, allocationRatioPlanned = NA_real_, normalApproximation = FALSE, rounding = TRUE, alpha = 0.025 )
beta |
The type II error. |
n |
The total sample size. |
trtpair |
The treatment pair of interest to power the study. If not given, it defaults to comparing the first treatment to the last treatment. |
carryover |
Whether to account for carryover effects in the power calculation. Defaults to TRUE. |
meanDiffH0 |
The mean difference for the treatment pair of interest under the null hypothesis. Defaults to 0. |
meanDiff |
The mean difference for the treatment pair of interest under the alternative hypothesis. |
stDev |
The standard deviation for within-subject random error. |
corr |
The intra-subject correlation due to subject random effect. |
design |
The crossover design represented by a matrix with rows indexing the sequences, columns indexing the periods, and matrix entries indicating the treatments. |
cumdrop |
The cumulative dropout rate over periods. |
allocationRatioPlanned |
Allocation ratio for the sequences. Defaults to equal randomization if not provided. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up the sample size. Defaults to TRUE for sample size rounding. |
alpha |
The one-sided significance level. Defaults to 0.025. |
The linear mixed-effects model to assess the direct treatment effects in the presence of carryover treatment effects is given by
where is the general mean, is the effect of
the th treatment sequence, is the random effect
with variance for the th subject of the
th treatment sequence, is the period effect,
and is the random error with variance
for the subject in period . The direct effect of the treatment
administered in period of sequence is
, and is the carryover
effect of the treatment administered in period of sequence
. The value of the carryover effect for the observed
response in the first period is since
there is no carryover effect in the first period. The intra-subject
correlation due to the subject random effect is
Therefore, stDev = and corr = .
By constructing the design matrix for the linear model with
a compound symmetry covariance matrix for the response vector of
a subject, we can obtain
The covariance matrix for the direct treatment effects and carryover treatment effects can be extracted from the appropriate sub-matrices. The covariance matrix for the direct treatment effects without accounting for the carryover treatment effects can be obtained by omitting the carryover effect terms from the model.
The power is for the direct treatment effect for the treatment pair of
interest with or without accounting for carryover effects as determined
by the input parameter carryover. The relative efficiency is
for the direct treatment effect for the treatment pair of interest
accounting for carryover effects relative to that without accounting
for carryover effects.
The degrees of freedom for the t-test accounting for carryover effects
can be calculated as the total number of observations minus
the number of subjects minus minus
to account for the subject effect, period effect, and direct and
carryover treatment effects. The degrees of freedom for the t-test
without accounting for carryover effects is equal to the total number
of observations minus the number of subjects minus minus
to account for the subject effect, period effect, and direct
treatment effects.
An S3 class designMeanDiffCarryover object with the
following components:
power: The power to reject the null hypothesis.
alpha: The one-sided significance level.
numberOfSubjects: The maximum number of subjects.
trtpair: The treatment pair of interest to power the study.
carryover: Whether to account for carryover effects in
the power calculation.
meanDiffH0: The mean difference for the treatment pair of
interest under the null hypothesis.
meanDiff: The mean difference for the treatment pair of
interest under the alternative hypothesis.
stDev: The standard deviation for within-subject random error.
corr: The intra-subject correlation due to subject random effect.
design: The crossover design represented by a matrix with
rows indexing the sequences, columns indexing the periods, and
matrix entries indicating the treatments.
designMatrix: The design matrix accounting for intercept,
sequence, period, direct treatment effects and carryover treatment
effects when carryover = TRUE, or the design matrix
accounting for intercept, sequence, period, and direct treatment
effects when carryover = FALSE.
nseq: The number of sequences.
nprd: The number of periods.
ntrt: The number of treatments.
cumdrop: The cumulative dropout rate over periods.
V_direct_only: The covariance matrix for direct treatment
effects without accounting for carryover effects. The treatment
comparisons for the covariance matrix are for the first
treatments relative to the last treatment.
V_direct_carry: The covariance matrix for direct and
carryover treatment effects.
v_direct_only: The variance of the direct treatment effect for
the treatment pair of interest without accounting for carryover
effects.
v_direct: The variance of the direct treatment effect for
the treatment pair of interest accounting for carryover effects.
v_carry: The variance of the carryover treatment effect for
the treatment pair of interest.
releff_direct: The relative efficiency of the design
for estimating the direct treatment effect for the treatment pair
of interest after accounting for carryover effects with respect to
that without accounting for carryover effects. This is equal to
v_direct_only/v_direct.
releff_carry: The relative efficiency of the design
for estimating the carryover effect for the treatment pair
of interest. This is equal to v_direct_only/v_carry.
half_width: The half-width of the confidence interval for the
direct treatment effect for the treatment pair of interest.
nu: Degrees of freedom for the t-test.
allocationRatioPlanned: Allocation ratio for the sequences.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution.
rounding: Whether to round up the sample size.
Kaifeng Lu, [email protected]
Robert O. Kuehl. Design of Experiments: Statistical Principles of Research Design and Analysis. Brooks/Cole: Pacific Grove, CA. 2000.
# Williams design for 4 treatments (design1 <- getDesignMeanDiffCarryover( beta = 0.2, n = NA, meanDiff = 0.5, stDev = 1, design = matrix(c(1, 4, 2, 3, 2, 1, 3, 4, 3, 2, 4, 1, 4, 3, 1, 2), 4, 4, byrow = TRUE), alpha = 0.025))# Williams design for 4 treatments (design1 <- getDesignMeanDiffCarryover( beta = 0.2, n = NA, meanDiff = 0.5, stDev = 1, design = matrix(c(1, 4, 2, 3, 2, 1, 3, 4, 3, 2, 4, 1, 4, 3, 1, 2), 4, 4, byrow = TRUE), alpha = 0.025))
Obtains the power and sample size for equivalence in direct treatment effects in crossover trials accounting or without accounting for carryover effects.
getDesignMeanDiffCarryoverEquiv( beta = NA_real_, n = NA_real_, trtpair = NA_real_, carryover = TRUE, meanDiffLower = NA_real_, meanDiffUpper = NA_real_, meanDiff = 0, stDev = 1, corr = 0.5, design = NA_real_, cumdrop = NA_real_, allocationRatioPlanned = NA_real_, normalApproximation = FALSE, rounding = TRUE, alpha = 0.025 )getDesignMeanDiffCarryoverEquiv( beta = NA_real_, n = NA_real_, trtpair = NA_real_, carryover = TRUE, meanDiffLower = NA_real_, meanDiffUpper = NA_real_, meanDiff = 0, stDev = 1, corr = 0.5, design = NA_real_, cumdrop = NA_real_, allocationRatioPlanned = NA_real_, normalApproximation = FALSE, rounding = TRUE, alpha = 0.025 )
beta |
The type II error. |
n |
The total sample size. |
trtpair |
The treatment pair of interest to power the study. If not given, it defaults to comparing the first treatment to the last treatment. |
carryover |
Whether to account for carryover effects in the power calculation. Defaults to TRUE. |
meanDiffLower |
The lower equivalence limit of mean difference for the treatment pair of interest. |
meanDiffUpper |
The upper equivalence limit of mean difference for the treatment pair of interest. |
meanDiff |
The mean difference under the alternative hypothesis, |
stDev |
The standard deviation for within-subject random error. |
corr |
The intra-subject correlation due to subject random effect. |
design |
The crossover design represented by a matrix with rows indexing the sequences, columns indexing the periods, and matrix entries indicating the treatments. |
cumdrop |
The cumulative dropout rate over periods. |
allocationRatioPlanned |
Allocation ratio for the sequences. Defaults to equal randomization if not provided. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up the sample size. Defaults to TRUE for sample size rounding. |
alpha |
The one-sided significance level. Defaults to 0.025. |
The linear mixed-effects model to assess the direct treatment effects in the presence of carryover treatment effects is given by
where is the general mean, is the effect of
the th treatment sequence, is the random effect
with variance for the th subject of the
th treatment sequence, is the period effect,
and is the random error with variance
for the subject in period . The direct effect of the treatment
administered in period of sequence is
, and is the carryover
effect of the treatment administered in period of sequence
. The value of the carryover effect for the observed
response in the first period is since
there is no carryover effect in the first period. The intra-subject
correlation due to the subject random effect is
Therefore, stDev = and corr = .
By constructing the design matrix for the linear model with
a compound symmetry covariance matrix for the response vector of
a subject, we can obtain
The covariance matrix for the direct treatment effects and carryover treatment effects can be extracted from the appropriate sub-matrices. The covariance matrix for the direct treatment effects without accounting for the carryover treatment effects can be obtained by omitting the carryover effect terms from the model.
The power is for the direct treatment effect for the treatment pair of
interest with or without accounting for carryover effects as determined
by the input parameter carryover. The relative efficiency is
for the direct treatment effect for the treatment pair of interest
accounting for carryover effects relative to that without accounting
for carryover effects.
The degrees of freedom for the t-test accounting for carryover effects
can be calculated as the total number of observations minus
the number of subjects minus minus
to account for the subject effect, period effect, and direct and
carryover treatment effects. The degrees of freedom for the t-test
without accounting for carryover effects is equal to the total number
of observations minus the number of subjects minus minus
to account for the subject effect, period effect, and direct
treatment effects.
An S3 class designMeanDiffCarryover object with the
following components:
power: The power to reject the null hypothesis.
alpha: The one-sided significance level.
numberOfSubjects: The maximum number of subjects.
trtpair: The treatment pair of interest to power the study.
carryover: Whether to account for carryover effects in
the power calculation.
meanDiffLower: The lower equivalence limit of mean difference
for the treatment pair of interest.
meanDiffUpper: The upper equivalence limit of mean difference
for the treatment pair of interest.
meanDiff: The mean difference for the treatment pair of interest
under the alternative hypothesis.
stDev: The standard deviation for within-subject random error.
corr: The intra-subject correlation due to subject random effect.
design: The crossover design represented by a matrix with
rows indexing the sequences, columns indexing the periods, and
matrix entries indicating the treatments.
designMatrix: The design matrix accounting for intercept,
sequence, period, direct treatment effects and carryover treatment
effects when carryover = TRUE, or the design matrix
accounting for intercept, sequence, period, and direct treatment
effects when carryover = FALSE.
nseq: The number of sequences.
nprd: The number of periods.
ntrt: The number of treatments.
cumdrop: The cumulative dropout rate over periods.
V_direct_only: The covariance matrix for direct treatment
effects without accounting for carryover effects. The treatment
comparisons for the covariance matrix are for the first
treatments relative to the last treatment.
V_direct_carry: The covariance matrix for direct and
carryover treatment effects.
v_direct_only: The variance of the direct treatment effect for
the treatment pair of interest without accounting for carryover
effects.
v_direct: The variance of the direct treatment effect for
the treatment pair of interest accounting for carryover effects.
v_carry: The variance of the carryover treatment effect for
the treatment pair of interest.
releff_direct: The relative efficiency of the design
for estimating the direct treatment effect for the treatment pair
of interest after accounting for carryover effects with respect to
that without accounting for carryover effects. This is equal to
v_direct_only/v_direct.
releff_carry: The relative efficiency of the design
for estimating the carryover effect for the treatment pair
of interest. This is equal to v_direct_only/v_carry.
half_width: The half-width of the confidence interval for the
direct treatment effect for the treatment pair of interest.
nu: Degrees of freedom for the t-test.
allocationRatioPlanned: Allocation ratio for the sequences.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution.
rounding: Whether to round up the sample size.
Kaifeng Lu, [email protected]
Robert O. Kuehl. Design of Experiments: Statistical Principles of Research Design and Analysis. Brooks/Cole: Pacific Grove, CA. 2000.
# Williams design for 4 treatments (design1 <- getDesignMeanDiffCarryoverEquiv( beta = 0.2, n = NA, meanDiffLower = -1.3, meanDiffUpper = 1.3, meanDiff = 0, stDev = 2.2, design = matrix(c(1, 4, 2, 3, 2, 1, 3, 4, 3, 2, 4, 1, 4, 3, 1, 2), 4, 4, byrow = TRUE), alpha = 0.025))# Williams design for 4 treatments (design1 <- getDesignMeanDiffCarryoverEquiv( beta = 0.2, n = NA, meanDiffLower = -1.3, meanDiffUpper = 1.3, meanDiff = 0, stDev = 2.2, design = matrix(c(1, 4, 2, 3, 2, 1, 3, 4, 3, 2, 4, 1, 4, 3, 1, 2), 4, 4, byrow = TRUE), alpha = 0.025))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for equivalence in two-sample mean difference.
getDesignMeanDiffEquiv( beta = NA_real_, n = NA_real_, meanDiffLower = NA_real_, meanDiffUpper = NA_real_, meanDiff = 0, stDev = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )getDesignMeanDiffEquiv( beta = NA_real_, n = NA_real_, meanDiffLower = NA_real_, meanDiffUpper = NA_real_, meanDiff = 0, stDev = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
meanDiffLower |
The lower equivalence limit of mean difference. |
meanDiffUpper |
The upper equivalence limit of mean difference. |
meanDiff |
The mean difference under the alternative hypothesis. |
stDev |
The standard deviation. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designMeanDiffEquiv object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The significance level for each of the two one-sided
tests. Defaults to 0.05.
attainedAlpha: The attained significance level.
kMax: The number of stages.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
meanDiffLower: The lower equivalence limit of mean
difference.
meanDiffUpper: The upper equivalence limit of mean
difference.
meanDiff: The mean difference under the alternative
hypothesis.
stDev: The standard deviation.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale for
each of the two one-sided tests.
rejectPerStage: The probability for efficacy stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeAlphaSpent: The cumulative alpha for each of
the two one-sided tests.
cumulativeAttainedAlpha: The cumulative probability for
efficacy stopping under H0.
efficacyMeanDiffLower: The efficacy boundaries on the
mean difference scale for the one-sided null hypothesis on the
lower equivalence limit.
efficacyMeanDiffUpper: The efficacy boundaries on the
mean difference scale for the one-sided null hypothesis on the
upper equivalence limit.
efficacyP: The efficacy bounds on the p-value scale for
each of the two one-sided tests.
information: The cumulative information.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
spendingTime: The error spending time at each analysis.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution. The exact
calculation using the t distribution is only implemented for the
fixed design.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
# Example 1: group sequential trial power calculation (design1 <- getDesignMeanDiffEquiv( beta = 0.1, n = NA, meanDiffLower = -1.3, meanDiffUpper = 1.3, meanDiff = 0, stDev = 2.2, kMax = 4, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for t-test (design2 <- getDesignMeanDiffEquiv( beta = 0.1, n = NA, meanDiffLower = -1.3, meanDiffUpper = 1.3, meanDiff = 0, stDev = 2.2, normalApproximation = FALSE, alpha = 0.05))# Example 1: group sequential trial power calculation (design1 <- getDesignMeanDiffEquiv( beta = 0.1, n = NA, meanDiffLower = -1.3, meanDiffUpper = 1.3, meanDiff = 0, stDev = 2.2, kMax = 4, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for t-test (design2 <- getDesignMeanDiffEquiv( beta = 0.1, n = NA, meanDiffLower = -1.3, meanDiffUpper = 1.3, meanDiff = 0, stDev = 2.2, normalApproximation = FALSE, alpha = 0.05))
Obtains the power and sample size for two-sample mean difference at the last time point from the mixed-model for repeated measures (MMRM) model.
getDesignMeanDiffMMRM( beta = NA_real_, meanDiffH0 = 0, meanDiff = 0.5, k = 1, t = NA_real_, covar1 = diag(k), covar2 = NA_real_, accrualTime = 0, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0, gamma1 = 0, gamma2 = 0, accrualDuration = NA_real_, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityMeanDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignMeanDiffMMRM( beta = NA_real_, meanDiffH0 = 0, meanDiff = 0.5, k = 1, t = NA_real_, covar1 = diag(k), covar2 = NA_real_, accrualTime = 0, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0, gamma1 = 0, gamma2 = 0, accrualDuration = NA_real_, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityMeanDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
meanDiffH0 |
The mean difference at the last time point under the null hypothesis. Defaults to 0. |
meanDiff |
The mean difference at the last time point under the alternative hypothesis. |
k |
The number of postbaseline time points. |
t |
The postbaseline time points. |
covar1 |
The covariance matrix for the repeated measures given baseline for the active treatment group. |
covar2 |
The covariance matrix for the repeated measures given baseline for the control group. If missing, it will be set equal to the covariance matrix for the active treatment group. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
gamma1 |
The hazard rate for exponential dropout, or a vector of hazard rates for piecewise exponential dropout for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, or a vector of hazard rates for piecewise exponential dropout for the control group. |
accrualDuration |
Duration of the enrollment period. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Defaults to
|
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility bounds on the conditional power scale. |
futilityMeanDiff |
The futility bounds on the mean difference scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
Consider a longitudinal study with two treatment groups.
The outcome is measured at baseline and at postbaseline
time points. For each treatment group, the outcomes are assumed to
follow a multivariate normal distribution.
Conditional on baseline, the covariance matrix of the post-baseline
outcomes is denoted by for the active treatment group
and for the control group.
Let and denote the mean vectors of
post-baseline outcomes for the active and control groups, respectively.
We are interested in testing the null
hypothesis
against the alternative .
The study design is based on the information for treatment difference at the last postbaseline time point. This information is given by
In the presence of monotone missing data, let
denote the proportions of subjects in
observed data patterns 1 through for treatment group
(active) or 2 (control).
A subject in pattern has complete data up to time , i.e.,
the observed outcomes are ,
with missing values for .
According to Lu et al. (2008), the information
matrix for the post-baseline mean vector in group is
where is the proportion of subjects in group ,
and
Here, is the leading
principal submatrix of . It follows that
The observed data pattern probabilities depend on the accrual and
dropout distributions.
Let denote the cumulative distribution function of
enrollment time ,
denote the survival function of dropout time for
treatment group ,
and denote the calendar time at interim or final analysis.
Then, for , the probability that a subject in group
falls into observed data pattern is
For the last pattern (, i.e., completers),
For the final analysis, is the study duration,
so for all .
Therefore, the pattern probabilities depend only on the dropout
distribution:
and
Cumulative dropout probabilities at post-baseline time points
can be used to define a piecewise exponential dropout distribution.
Let denote the cumulative probability of dropout
by time for treatment group .
The left endpoints of the piecewise survival time intervals are given by
.
The hazard rate in the interval is given by
An S3 class designMeanDiffMMRM object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
studyDuration: The maximum study duration.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
expectedStudyDurationH1: The expected study duration
under H1.
expectedStudyDurationH0: The expected study duration
under H0.
accrualDuration: The accrual duration.
followupTime: The follow-up time.
fixedFollowup: Whether a fixed follow-up design is used.
meanDiffH0: The mean difference under H0.
meanDiff: The mean difference under H1.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
efficacyMeanDiff: The efficacy boundaries on the mean
difference scale.
futilityMeanDiff: The futility boundaries on the mean
difference scale.
numberOfSubjects: The number of subjects.
numberOfCompleters: The number of completers.
analysisTime: The average time since trial start.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
allocationRatioPlanned: The allocation ratio for the active
treatment versus control.
accrualTime: A vector that specifies the starting time of
piecewise Poisson enrollment time intervals.
accrualIntensity: A vector of accrual intensities.
One for each accrual time interval.
piecewiseSurvivalTime: A vector that specifies the
starting time of piecewise exponential survival time intervals.
gamma1: The hazard rate for exponential dropout or
a vector of hazard rates for piecewise exponential dropout
for the active treatment group.
gamma2: The hazard rate for exponential dropout or
a vector of hazard rates for piecewise exponential dropout
for the control group.
k: The number of postbaseline time points.
t: The postbaseline time points.
covar1: The covariance matrix for the repeated measures
given baseline for the active treatment group.
covar2: The covariance matrix for the repeated measures
given baseline for the control group.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
Kaifeng Lu, Xiaohui Luo, and Pei-Yun Chen. Sample size estimation for repeated measures analysis in randomized clinical trials with missing data. The International Journal of Biostatistics 2008; 14(1), Article 9.
# function to generate the AR(1) correlation matrix ar1_cor <- function(n, corr) { exponent <- abs(matrix((1:n) - 1, n, n, byrow = TRUE) - ((1:n) - 1)) corr^exponent } (design1 = getDesignMeanDiffMMRM( beta = 0.2, meanDiffH0 = 0, meanDiff = 0.5, k = 4, t = c(1,2,3,4), covar1 = ar1_cor(4, 0.7), accrualIntensity = 10, gamma1 = 0.02634013, gamma2 = 0.02634013, accrualDuration = NA, allocationRatioPlanned = 1, kMax = 3, alpha = 0.025, typeAlphaSpending = "sfOF"))# function to generate the AR(1) correlation matrix ar1_cor <- function(n, corr) { exponent <- abs(matrix((1:n) - 1, n, n, byrow = TRUE) - ((1:n) - 1)) corr^exponent } (design1 = getDesignMeanDiffMMRM( beta = 0.2, meanDiffH0 = 0, meanDiff = 0.5, k = 4, t = c(1,2,3,4), covar1 = ar1_cor(4, 0.7), accrualIntensity = 10, gamma1 = 0.02634013, gamma2 = 0.02634013, accrualDuration = NA, allocationRatioPlanned = 1, kMax = 3, alpha = 0.025, typeAlphaSpending = "sfOF"))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for two-sample mean difference in 2x2 crossover.
getDesignMeanDiffXO( beta = NA_real_, n = NA_real_, meanDiffH0 = 0, meanDiff = 0.5, stDev = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityMeanDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignMeanDiffXO( beta = NA_real_, n = NA_real_, meanDiffH0 = 0, meanDiff = 0.5, stDev = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityMeanDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
meanDiffH0 |
The mean difference under the null hypothesis. Defaults to 0. |
meanDiff |
The mean difference under the alternative hypothesis. |
stDev |
The standard deviation for within-subject random error. |
allocationRatioPlanned |
Allocation ratio for sequence A/B versus sequence B/A. Defaults to 1 for equal randomization. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility boundary on the conditional power scale. |
futilityMeanDiff |
The futility boundary on the mean difference scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designMeanDiffXO object with three components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
meanDiffH0: The mean difference under the null hypothesis.
meanDiff: The mean difference under the alternative
hypothesis.
stDev: The standard deviation for within-subject random
error.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
efficacyMeanDiff: The efficacy boundaries on the mean
difference scale.
futilityMeanDiff: The futility boundaries on the mean
difference scale.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
allocationRatioPlanned: Allocation ratio for sequence A/B
versus sequence B/A.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignMeanDiffXO( beta = 0.2, n = NA, meanDiff = 75, stDev = 150, normalApproximation = FALSE, alpha = 0.05))(design1 <- getDesignMeanDiffXO( beta = 0.2, n = NA, meanDiff = 75, stDev = 150, normalApproximation = FALSE, alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for equivalence in mean difference in 2x2 crossover.
getDesignMeanDiffXOEquiv( beta = NA_real_, n = NA_real_, meanDiffLower = NA_real_, meanDiffUpper = NA_real_, meanDiff = 0, stDev = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )getDesignMeanDiffXOEquiv( beta = NA_real_, n = NA_real_, meanDiffLower = NA_real_, meanDiffUpper = NA_real_, meanDiff = 0, stDev = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
meanDiffLower |
The lower equivalence limit of mean difference. |
meanDiffUpper |
The upper equivalence limit of mean difference. |
meanDiff |
The mean difference under the alternative hypothesis. |
stDev |
The standard deviation for within-subject random error. |
allocationRatioPlanned |
Allocation ratio for sequence A/B versus sequence B/A. Defaults to 1 for equal randomization. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designMeanDiffXOEquiv object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level.
kMax: The number of stages.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
meanDiffLower: The lower equivalence limit of mean
difference.
meanDiffUpper: The upper equivalence limit of mean
difference.
meanDiff: The mean difference under the alternative
hypothesis.
stDev: The standard deviation for within-subject random
error.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale for
each of the two one-sided tests.
rejectPerStage: The probability for efficacy stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeAlphaSpent: The cumulative alpha for each of
the two one-sided tests.
cumulativeAttainedAlpha: The cumulative probability for
efficacy stopping under H0.
efficacyMeanDiffLower: The efficacy boundaries on the
mean difference scale for the one-sided null hypothesis on the
lower equivalence limit.
efficacyMeanDiffUpper: The efficacy boundaries on the
mean difference scale for the one-sided null hypothesis on the
upper equivalence limit.
efficacyP: The efficacy bounds on the p-value scale for
each of the two one-sided tests.
information: The cumulative information.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
spendingTime: The error spending time at each analysis.
allocationRatioPlanned: Allocation ratio for sequence A/B
versus sequence B/A.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution. The exact
calculation using the t distribution is only implemented for the
fixed design.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
# Example 1: group sequential trial power calculation (design1 <- getDesignMeanDiffXOEquiv( beta = 0.1, n = NA, meanDiffLower = -1.3, meanDiffUpper = 1.3, meanDiff = 0, stDev = 2.2, kMax = 4, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for t-test (design2 <- getDesignMeanDiffXOEquiv( beta = 0.1, n = NA, meanDiffLower = -1.3, meanDiffUpper = 1.3, meanDiff = 0, stDev = 2.2, normalApproximation = FALSE, alpha = 0.05))# Example 1: group sequential trial power calculation (design1 <- getDesignMeanDiffXOEquiv( beta = 0.1, n = NA, meanDiffLower = -1.3, meanDiffUpper = 1.3, meanDiff = 0, stDev = 2.2, kMax = 4, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for t-test (design2 <- getDesignMeanDiffXOEquiv( beta = 0.1, n = NA, meanDiffLower = -1.3, meanDiffUpper = 1.3, meanDiff = 0, stDev = 2.2, normalApproximation = FALSE, alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for two-sample mean ratio.
getDesignMeanRatio( beta = NA_real_, n = NA_real_, meanRatioH0 = 1, meanRatio = 1.25, CV = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityMeanRatio = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignMeanRatio( beta = NA_real_, n = NA_real_, meanRatioH0 = 1, meanRatio = 1.25, CV = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityMeanRatio = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
meanRatioH0 |
The mean ratio under the null hypothesis. Defaults to 1. |
meanRatio |
The mean ratio under the alternative hypothesis. |
CV |
The coefficient of variation. The standard deviation on the
log scale is equal to |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility boundary on the conditional power scale. |
futilityMeanRatio |
The futility boundary on the mean ratio scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designMeanRatio object with three components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
meanRatioH0: The mean ratio under the null hypothesis.
meanRatio: The mean ratio under the alternative hypothesis.
CV: The coefficient of variation.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
numberOfSubjects: The number of subjects.
efficacyMeanRatio: The efficacy boundaries on the mean
ratio scale.
futilityMeanRatio: The futility boundaries on the mean
ratio scale.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignMeanRatio( beta = 0.1, n = NA, meanRatio = 1.25, CV = 0.25, alpha = 0.05, normalApproximation = FALSE))(design1 <- getDesignMeanRatio( beta = 0.1, n = NA, meanRatio = 1.25, CV = 0.25, alpha = 0.05, normalApproximation = FALSE))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for equivalence in two-sample mean ratio.
getDesignMeanRatioEquiv( beta = NA_real_, n = NA_real_, meanRatioLower = NA_real_, meanRatioUpper = NA_real_, meanRatio = 1, CV = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )getDesignMeanRatioEquiv( beta = NA_real_, n = NA_real_, meanRatioLower = NA_real_, meanRatioUpper = NA_real_, meanRatio = 1, CV = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
meanRatioLower |
The lower equivalence limit of mean ratio. |
meanRatioUpper |
The upper equivalence limit of mean ratio. |
meanRatio |
The mean ratio under the alternative hypothesis. |
CV |
The coefficient of variation. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designMeanRatioEquiv object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The significance level for each of the two one-sided
tests. Defaults to 0.05.
attainedAlpha: The attained significance level.
kMax: The number of stages.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
meanRatioLower: The lower equivalence limit of mean ratio.
meanRatioUpper: The upper equivalence limit of mean ratio.
meanRatio: The mean ratio under the alternative hypothesis.
CV: The coefficient of variation.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale for
each of the two one-sided tests.
rejectPerStage: The probability for efficacy stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeAlphaSpent: The cumulative alpha for each of
the two one-sided tests.
cumulativeAttainedAlpha: The cumulative probability for
efficacy stopping under H0.
efficacyP: The efficacy bounds on the p-value scale for
each of the two one-sided tests.
information: The cumulative information.
numberOfSubjects: The number of subjects.
efficacyMeanRatioLower: The efficacy boundaries on the
mean ratio scale for the one-sided null hypothesis on the
lower equivalence limit.
efficacyMeanRatioUpper: The efficacy boundaries on the
mean ratio scale for the one-sided null hypothesis on the
upper equivalence limit.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
spendingTime: The error spending time at each analysis.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution. The exact
calculation using the t distribution is only implemented for the
fixed design.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
# Example 1: group sequential trial power calculation (design1 <- getDesignMeanRatioEquiv( beta = 0.1, n = NA, meanRatioLower = 0.8, meanRatioUpper = 1.25, meanRatio = 1, CV = 0.35, kMax = 4, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for t-test (design2 <- getDesignMeanRatioEquiv( beta = 0.1, n = NA, meanRatioLower = 0.8, meanRatioUpper = 1.25, meanRatio = 1, CV = 0.35, normalApproximation = FALSE, alpha = 0.05))# Example 1: group sequential trial power calculation (design1 <- getDesignMeanRatioEquiv( beta = 0.1, n = NA, meanRatioLower = 0.8, meanRatioUpper = 1.25, meanRatio = 1, CV = 0.35, kMax = 4, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for t-test (design2 <- getDesignMeanRatioEquiv( beta = 0.1, n = NA, meanRatioLower = 0.8, meanRatioUpper = 1.25, meanRatio = 1, CV = 0.35, normalApproximation = FALSE, alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for two-sample mean ratio in 2x2 crossover.
getDesignMeanRatioXO( beta = NA_real_, n = NA_real_, meanRatioH0 = 1, meanRatio = 1.25, CV = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityMeanRatio = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignMeanRatioXO( beta = NA_real_, n = NA_real_, meanRatioH0 = 1, meanRatio = 1.25, CV = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityMeanRatio = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
meanRatioH0 |
The mean ratio under the null hypothesis. Defaults to 1. |
meanRatio |
The mean ratio under the alternative hypothesis. |
CV |
The coefficient of variation. The standard deviation on the
log scale is equal to |
allocationRatioPlanned |
Allocation ratio for sequence A/B versus sequence B/A. Defaults to 1 for equal randomization. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility boundary on the conditional power scale. |
futilityMeanRatio |
The futility boundary on the mean ratio scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designMeanRatioXO object with three components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
meanRatioH0: The mean ratio under the null hypothesis.
meanRatio: The mean ratio under the alternative hypothesis.
CV: The coefficient of variation.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyMeanRatio: The efficacy boundaries on the mean
ratio scale.
futilityMeanRatio: The futility boundaries on the mean
ratio scale.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
allocationRatioPlanned: Allocation ratio for sequence A/B
versus sequence B/A.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignMeanRatioXO( beta = 0.1, n = NA, meanRatio = 1.25, CV = 0.25, alpha = 0.05, normalApproximation = FALSE))(design1 <- getDesignMeanRatioXO( beta = 0.1, n = NA, meanRatio = 1.25, CV = 0.25, alpha = 0.05, normalApproximation = FALSE))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for equivalence mean ratio in 2x2 crossover.
getDesignMeanRatioXOEquiv( beta = NA_real_, n = NA_real_, meanRatioLower = NA_real_, meanRatioUpper = NA_real_, meanRatio = 1, CV = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )getDesignMeanRatioXOEquiv( beta = NA_real_, n = NA_real_, meanRatioLower = NA_real_, meanRatioUpper = NA_real_, meanRatio = 1, CV = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
meanRatioLower |
The lower equivalence limit of mean ratio. |
meanRatioUpper |
The upper equivalence limit of mean ratio. |
meanRatio |
The mean ratio under the alternative hypothesis. |
CV |
The coefficient of variation. |
allocationRatioPlanned |
Allocation ratio for sequence A/B versus sequence B/A. Defaults to 1 for equal randomization. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designMeanRatioEquiv object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level.
kMax: The number of stages.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
meanRatioLower: The lower equivalence limit of mean ratio.
meanRatioUpper: The upper equivalence limit of mean ratio.
meanRatio: The mean ratio under the alternative hypothesis.
CV: The coefficient of variation.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale for
each of the two one-sided tests.
rejectPerStage: The probability for efficacy stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeAlphaSpent: The cumulative alpha for each of
the two one-sided tests.
cumulativeAttainedAlpha: The cumulative probability for
efficacy stopping under H0.
efficacyMeanRatioLower: The efficacy boundaries on the
mean ratio scale for the one-sided null hypothesis on the
lower equivalence limit.
efficacyMeanRatioUpper: The efficacy boundaries on the
mean ratio scale for the one-sided null hypothesis on the
upper equivalence limit.
efficacyP: The efficacy bounds on the p-value scale for
each of the two one-sided tests.
information: The cumulative information.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
spendingTime: The error spending time at each analysis.
allocationRatioPlanned: Allocation ratio for sequence A/B
versus sequence B/A.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution. The exact
calculation using the t distribution is only implemented for the
fixed design.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
# Example 1: group sequential trial power calculation (design1 <- getDesignMeanRatioXOEquiv( beta = 0.1, n = NA, meanRatioLower = 0.8, meanRatioUpper = 1.25, meanRatio = 1, CV = 0.35, kMax = 4, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for t-test (design2 <- getDesignMeanRatioXOEquiv( beta = 0.1, n = NA, meanRatioLower = 0.8, meanRatioUpper = 1.25, meanRatio = 1, CV = 0.35, normalApproximation = FALSE, alpha = 0.05))# Example 1: group sequential trial power calculation (design1 <- getDesignMeanRatioXOEquiv( beta = 0.1, n = NA, meanRatioLower = 0.8, meanRatioUpper = 1.25, meanRatio = 1, CV = 0.35, kMax = 4, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for t-test (design2 <- getDesignMeanRatioXOEquiv( beta = 0.1, n = NA, meanRatioLower = 0.8, meanRatioUpper = 1.25, meanRatio = 1, CV = 0.35, normalApproximation = FALSE, alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for two-sample odds ratio.
getDesignOddsRatio( beta = NA_real_, n = NA_real_, oddsRatioH0 = 1, pi1 = NA_real_, pi2 = NA_real_, nullVariance = FALSE, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityOddsRatio = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignOddsRatio( beta = NA_real_, n = NA_real_, oddsRatioH0 = 1, pi1 = NA_real_, pi2 = NA_real_, nullVariance = FALSE, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityOddsRatio = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
oddsRatioH0 |
The odds ratio under the null hypothesis. Defaults to 1. |
pi1 |
The assumed probability for the active treatment group. |
pi2 |
The assumed probability for the control group. |
nullVariance |
Whether to use the variance under the null or the empirical variance under the alternative. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility bounds on the conditional power scale. |
futilityOddsRatio |
The futility bounds on the odds ratio scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
Consider a group sequential design for two-sample odds ratio. The parameter of interest is
where is the response probability for the active
treatment group and is the response probability
for the control group. For statistical inference,
the parameter is often transformed to
the log scale:
The variance of the estimator
can be derived from the binomial distributions as follows:
where is the total number of subjects and is the
randomization probability for the active treatment group.
When nullVariance = TRUE, the variance is computed
under the null hypothesis. In this case, the values of
and in the variance formula are
replaced with their restricted maximum likelihood
counterparts, subject to the constraint
An S3 class designOddsRatio object with three components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
oddsRatioH0: The odds ratio under the null hypothesis.
pi1: The assumed probability for the active treatment group.
pi2: The assumed probability for the control group.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
efficacyOdddsRatio: The efficacy boundaries on the odds
ratio scale.
futilityOddsRatio: The futility boundaries on the odds
ratio scale.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
varianceRatio: The ratio of the variance under H0 to
the variance under H1.
nullVariance: Whether to use the variance under the null
or the empirical variance under the alternative.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignOddsRatio( beta = 0.1, n = NA, pi1 = 0.5, pi2 = 0.3, alpha = 0.05))(design1 <- getDesignOddsRatio( beta = 0.1, n = NA, pi1 = 0.5, pi2 = 0.3, alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for equivalence in two-sample odds ratio.
getDesignOddsRatioEquiv( beta = NA_real_, n = NA_real_, oddsRatioLower = NA_real_, oddsRatioUpper = NA_real_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, criticalValues = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )getDesignOddsRatioEquiv( beta = NA_real_, n = NA_real_, oddsRatioLower = NA_real_, oddsRatioUpper = NA_real_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, criticalValues = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
oddsRatioLower |
The lower equivalence limit of odds ratio. |
oddsRatioUpper |
The upper equivalence limit of odds ratio. |
pi1 |
The assumed probability for the active treatment group. |
pi2 |
The assumed probability for the control group. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designOddsRatioEquiv object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The significance level for each of the two one-sided
tests. Defaults to 0.05.
attainedAlphaH10: The attained significance level under H10.
attainedAlphaH20: The attained significance level under H20.
kMax: The number of stages.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH10: The expected information under H10.
expectedInformationH20: The expected information under H20.
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH10: The expected number of subjects
under H10.
expectedNumberOfSubjectsH20: The expected number of subjects
under H20.
oddsRatioLower: The lower equivalence limit of odds ratio.
oddsRatioUpper: The upper equivalence limit of odds ratio.
pi1: The assumed probability for the active treatment group.
pi2: The assumed probability for the control group.
oddsRatio: The odds ratio.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale for
each of the two one-sided tests.
rejectPerStage: The probability for efficacy stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeAlphaSpent: The cumulative alpha for each of
the two one-sided tests.
cumulativeAttainedAlphaH10: The cumulative alpha attained
under H10.
cumulativeAttainedAlphaH20: The cumulative alpha attained
under H20.
efficacyOddsRatioLower: The efficacy boundaries on the
odds ratio scale for the one-sided null hypothesis on the
lower equivalence limit.
efficacyOddsRatioUpper: The efficacy boundaries on the
odds ratio scale for the one-sided null hypothesis on the
upper equivalence limit.
efficacyP: The efficacy bounds on the p-value scale for
each of the two one-sided tests.
information: The cumulative information.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
spendingTime: The error spending time at each analysis.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignOddsRatioEquiv( beta = 0.2, n = NA, oddsRatioLower = 0.8, oddsRatioUpper = 1.25, pi1 = 0.12, pi2 = 0.12, kMax = 3, alpha = 0.05, typeAlphaSpending = "sfOF"))(design1 <- getDesignOddsRatioEquiv( beta = 0.2, n = NA, oddsRatioLower = 0.8, oddsRatioUpper = 1.25, pi1 = 0.12, pi2 = 0.12, kMax = 3, alpha = 0.05, typeAlphaSpending = "sfOF"))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for one-sample mean.
getDesignOneMean( beta = NA_real_, n = NA_real_, meanH0 = 0, mean = 0.5, stDev = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityMean = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignOneMean( beta = NA_real_, n = NA_real_, meanH0 = 0, mean = 0.5, stDev = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityMean = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
meanH0 |
The mean under the null hypothesis. Defaults to 0. |
mean |
The mean under the alternative hypothesis. |
stDev |
The standard deviation. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility boundary on the conditional power scale. |
futilityMean |
The futility boundary on the mean scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designOneMean object with three components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
meanH0: The mean under the null hypothesis.
mean: The mean under the alternative hypothesis.
stDev: The standard deviation.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
efficacyMean: The efficacy boundaries on the mean scale.
futilityMean: The futility boundaries on the mean scale.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
# Example 1: group sequential trial power calculation (design1 <- getDesignOneMean( beta = 0.1, n = NA, meanH0 = 7, mean = 6, stDev = 2.5, kMax = 5, alpha = 0.025, typeAlphaSpending = "sfOF", typeBetaSpending = "sfP")) # Example 2: sample size calculation for one-sample t-test (design2 <- getDesignOneMean( beta = 0.1, n = NA, meanH0 = 7, mean = 6, stDev = 2.5, normalApproximation = FALSE, alpha = 0.025))# Example 1: group sequential trial power calculation (design1 <- getDesignOneMean( beta = 0.1, n = NA, meanH0 = 7, mean = 6, stDev = 2.5, kMax = 5, alpha = 0.025, typeAlphaSpending = "sfOF", typeBetaSpending = "sfP")) # Example 2: sample size calculation for one-sample t-test (design2 <- getDesignOneMean( beta = 0.1, n = NA, meanH0 = 7, mean = 6, stDev = 2.5, normalApproximation = FALSE, alpha = 0.025))
Obtains the power given sample size or obtains the sample size given power for one-sample multinomial response.
getDesignOneMultinom( beta = NA_real_, n = NA_real_, ncats = NA_integer_, piH0 = NA_real_, pi = NA_real_, rounding = TRUE, alpha = 0.05 )getDesignOneMultinom( beta = NA_real_, n = NA_real_, ncats = NA_integer_, piH0 = NA_real_, pi = NA_real_, rounding = TRUE, alpha = 0.05 )
beta |
The type II error. |
n |
The total sample size. |
ncats |
The number of categories of the multinomial response. |
piH0 |
The prevalence of each category under the null hypothesis.
Only need to provide the values for the first |
pi |
The prevalence of each category. Only need to provide the
values for the first |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
alpha |
The two-sided significance level. Defaults to 0.05. |
A single-arm multinomial response design is used to test whether the
prevalence of each category is different from the null hypothesis
prevalence.
The null hypothesis is that the prevalence of each category
is equal to , while the alternative hypothesis is that
the prevalence of each category is equal to , for
, where is the number of categories.
The sample size is calculated based on the chi-square test for multinomial response. The test statistic is given by
where is the number of subjects in category , and
is the total sample size.
Under the null hypothesis, follows a chi-square distribution
with degrees of freedom.
Under the alternative hypothesis, follows a non-central
chi-square distribution with non-centrality parameter
The sample size is chosen such that the power to reject the null
hypothesis is at least for a given
significance level .
An S3 class designOneMultinom object with the following
components:
power: The power to reject the null hypothesis.
alpha: The two-sided significance level.
n: The maximum number of subjects.
ncats: The number of categories of the multinomial response.
piH0: The prevalence of each category under the null hypothesis.
pi: The prevalence of each category.
effectsize: The effect size for the chi-square test.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignOneMultinom( beta = 0.1, ncats = 3, piH0 = c(0.25, 0.25), pi = c(0.3, 0.4), alpha = 0.05))(design1 <- getDesignOneMultinom( beta = 0.1, ncats = 3, piH0 = c(0.25, 0.25), pi = c(0.3, 0.4), alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for one-sample proportion.
getDesignOneProportion( beta = NA_real_, n = NA_real_, piH0 = 0.1, pi = 0.2, nullVariance = TRUE, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilitypi = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignOneProportion( beta = NA_real_, n = NA_real_, piH0 = 0.1, pi = 0.2, nullVariance = TRUE, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilitypi = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
piH0 |
The response probability under the null hypothesis. |
pi |
The response probability under the alternative hypothesis. |
nullVariance |
Whether to use the variance under the null or the variance under the alternative. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility bounds on the conditional power scale. |
futilitypi |
The futility bounds on the response probability scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designOneProportion object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping as well as for the binomial exact test in a fixed
design.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
piH0: The response probability under the null hypothesis.
pi: The response probability under the alternative
hypothesis.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
efficacyResponses: The efficacy boundaries on the number
of responses scale.
futilityResponses: The futility boundaries on the number
of responses scale.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
varianceRatio: The ratio of the variance under H0 to
the variance under H1.
nullVariance: Whether to use the variance under the null or
the empirical variance under the alternative.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the binomial distribution.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
# Example 1: group sequential trial power calculation (design1 <- getDesignOneProportion( beta = 0.2, n = NA, piH0 = 0.15, pi = 0.25, kMax = 3, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for one-sample binomial exact test (design2 <- getDesignOneProportion( beta = 0.2, n = NA, piH0 = 0.15, pi = 0.25, normalApproximation = FALSE, alpha = 0.05))# Example 1: group sequential trial power calculation (design1 <- getDesignOneProportion( beta = 0.2, n = NA, piH0 = 0.15, pi = 0.25, kMax = 3, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for one-sample binomial exact test (design2 <- getDesignOneProportion( beta = 0.2, n = NA, piH0 = 0.15, pi = 0.25, normalApproximation = FALSE, alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for one-sample Poisson rate.
getDesignOneRateExact( beta = NA_real_, n = NA_real_, lambdaH0 = NA_real_, lambda = NA_real_, D = 1, alpha = 0.025 )getDesignOneRateExact( beta = NA_real_, n = NA_real_, lambdaH0 = NA_real_, lambda = NA_real_, D = 1, alpha = 0.025 )
beta |
The type II error. |
n |
The total sample size. |
lambdaH0 |
The Poisson rate under the null hypothesis. |
lambda |
The Poisson rate under the alternative hypothesis. |
D |
The average exposure per subject. |
alpha |
The one-sided significance level. Defaults to 0.025. |
A data frame containing the following variables:
alpha: The specified significance level.
attainedAlpha: The attained type I error of the exact test.
power: The actual power of the exact test.
n: The sample size.
lambdaH0: The Poisson rate under the null hypothesis.
lambda: The Poisson rate under the alternative hypothesis.
D: The average exposure per subject.
r: The critical value of the number of events for rejecting
the null hypothesis. Reject H0 if Y >= r for upper-tailed
test, and reject H0 if Y <= r for lower-tailed test.
Kaifeng Lu, [email protected]
# Example 1: power calculation (design1 <- getDesignOneRateExact( n = 525, lambdaH0 = 0.049, lambda = 0.012, D = 0.5, alpha = 0.025)) # Example 2: sample size calculation (design2 <- getDesignOneRateExact( beta = 0.2, lambdaH0 = 0.2, lambda = 0.3, D = 1, alpha = 0.05))# Example 1: power calculation (design1 <- getDesignOneRateExact( n = 525, lambdaH0 = 0.049, lambda = 0.012, D = 0.5, alpha = 0.025)) # Example 2: sample size calculation (design2 <- getDesignOneRateExact( beta = 0.2, lambdaH0 = 0.2, lambda = 0.3, D = 1, alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for one-sample slope.
getDesignOneSlope( beta = NA_real_, n = NA_real_, slopeH0 = 0, slope = 0.5, stDev = 1, stDevCovariate = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilitySlope = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignOneSlope( beta = NA_real_, n = NA_real_, slopeH0 = 0, slope = 0.5, stDev = 1, stDevCovariate = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilitySlope = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
slopeH0 |
The slope under the null hypothesis. Defaults to 0. |
slope |
The slope under the alternative hypothesis. |
stDev |
The standard deviation of the residual. |
stDevCovariate |
The standard deviation of the covariate. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility bounds on the conditional power scale. |
futilitySlope |
The futility bounds on the slope scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
We assume a simple linear regression of the form
where is the residual error, which is assumed to
be normally distributed with mean 0 and standard deviation
. The covariate is assumed to
be normally distributed with mean 0 and standard deviation
. The slope under the null hypothesis is
, and the slope under the alternative
hypothesis is . Since
it follows that
Since the variance of is
we can use it to calculate the power and sample size for the group sequential design.
An S3 class designOneSlope object with three components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
slopeH0: The slope under the null hypothesis.
slope: The slope under the alternative hypothesis.
stDev: The standard deviation of the residual.
stDevCovariate: The standard deviation of the covariate.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
efficacySlope: The efficacy boundaries on the slope scale.
futilitySlope: The futility boundaries on the slope scale.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignOneSlope( beta = 0.1, n = NA, slope = 0.5, stDev = 15, stDevCovariate = 9, normalApproximation = FALSE, alpha = 0.025))(design1 <- getDesignOneSlope( beta = 0.1, n = NA, slope = 0.5, stDev = 15, stDevCovariate = 9, normalApproximation = FALSE, alpha = 0.025))
Obtains the power given sample size or obtains the sample size given power for the Cochran-Armitage trend test for ordered multi-sample binomial response.
getDesignOrderedBinom( beta = NA_real_, n = NA_real_, ngroups = NA_integer_, pi = NA_real_, w = NA_real_, allocationRatioPlanned = NA_integer_, rounding = TRUE, alpha = 0.05 )getDesignOrderedBinom( beta = NA_real_, n = NA_real_, ngroups = NA_integer_, pi = NA_real_, w = NA_real_, allocationRatioPlanned = NA_integer_, rounding = TRUE, alpha = 0.05 )
beta |
The type II error. |
n |
The total sample size. |
ngroups |
The number of treatment groups. |
pi |
The response probabilities for the treatment groups. |
w |
The scores assigned to the treatment groups. This should reflect the ordinal nature of the treatment groups, e.g. dose levels. Defaults to equally spaced scores. |
allocationRatioPlanned |
Allocation ratio for the treatment groups. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
alpha |
The two-sided significance level. Defaults to 0.05. |
An ordered multi-sample binomial response design is used to test whether the response probabilities differ across multiple treatment groups. The null hypothesis is that the response probabilities are equal across all treatment groups, while the alternative hypothesis is that the response probabilities are ordered, i.e. the response probability increases with the treatment group index. The Cochran-Armitage trend test is used to test this hypothesis. This test effectively regresses the response probabilities against treatment group scores, and test whether the slope of the regression line is significantly different from zero.
The trend parameter is defined as
where is the number of treatment groups,
is the randomization probability for treatment group
, is the score assigned to treatment group ,
is the response probability for
treatment group , and is
the weighted average score across all treatment groups.
Since is a linear combination of the estimated
response probabilities, its variance is given by
where is the total sample size.
The sample size is chosen such that the power to reject the null
hypothesis is at least for a given
significance level .
An S3 class designOrderedBinom object with the following
components:
power: The power to reject the null hypothesis.
alpha: The two-sided significance level.
n: The maximum number of subjects.
ngroups: The number of treatment groups.
pi: The response probabilities for the treatment groups.
w: The scores assigned to the treatment groups.
trendstat: The Cochran-Armitage trend test statistic.
allocationRatioPlanned: Allocation ratio for the treatment
groups.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignOrderedBinom( beta = 0.1, ngroups = 3, pi = c(0.1, 0.25, 0.5), alpha = 0.05))(design1 <- getDesignOrderedBinom( beta = 0.1, ngroups = 3, pi = c(0.1, 0.25, 0.5), alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for paired mean difference.
getDesignPairedMeanDiff( beta = NA_real_, n = NA_real_, pairedDiffH0 = 0, pairedDiff = 0.5, stDev = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityPairedDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignPairedMeanDiff( beta = NA_real_, n = NA_real_, pairedDiffH0 = 0, pairedDiff = 0.5, stDev = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityPairedDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
pairedDiffH0 |
The paired difference under the null hypothesis. Defaults to 0. |
pairedDiff |
The paired difference under the alternative hypothesis. |
stDev |
The standard deviation for paired difference. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility boundary on the conditional power scale. |
futilityPairedDiff |
The futility boundary on the paired difference scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designPairedMeanDiff object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
pairedDiffH0: The paired difference under the null
hypothesis.
pairedDiff: The paired difference under the alternative
hypothesis.
stDev: The standard deviation for paired difference.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
efficacyPairedDiff: The efficacy boundaries on the paired
difference scale.
futilityPairedDiff: The futility boundaries on the paired
difference scale.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
# Example 1: group sequential trial power calculation (design1 <- getDesignPairedMeanDiff( beta = 0.1, n = NA, pairedDiffH0 = 0, pairedDiff = -2, stDev = 5, kMax = 5, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for one-sample t-test (design2 <- getDesignPairedMeanDiff( beta = 0.1, n = NA, pairedDiffH0 = 0, pairedDiff = -2, stDev = 5, normalApproximation = FALSE, alpha = 0.025))# Example 1: group sequential trial power calculation (design1 <- getDesignPairedMeanDiff( beta = 0.1, n = NA, pairedDiffH0 = 0, pairedDiff = -2, stDev = 5, kMax = 5, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for one-sample t-test (design2 <- getDesignPairedMeanDiff( beta = 0.1, n = NA, pairedDiffH0 = 0, pairedDiff = -2, stDev = 5, normalApproximation = FALSE, alpha = 0.025))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for equivalence in paired mean difference.
getDesignPairedMeanDiffEquiv( beta = NA_real_, n = NA_real_, pairedDiffLower = NA_real_, pairedDiffUpper = NA_real_, pairedDiff = 0, stDev = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )getDesignPairedMeanDiffEquiv( beta = NA_real_, n = NA_real_, pairedDiffLower = NA_real_, pairedDiffUpper = NA_real_, pairedDiff = 0, stDev = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
pairedDiffLower |
The lower equivalence limit of paired difference. |
pairedDiffUpper |
The upper equivalence limit of paired difference. |
pairedDiff |
The paired difference under the alternative hypothesis. |
stDev |
The standard deviation for paired difference. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designPairedMeanDiffEquiv object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The significance level for each of the two one-sided
tests. Defaults to 0.05.
attainedAlpha: The attained significance level under H0.
kMax: The number of stages.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
pairedDiffLower: The lower equivalence limit of paired
difference.
pairedDiffUpper: The upper equivalence limit of paired
difference.
pairedDiff: The paired difference under the alternative
hypothesis.
stDev: The standard deviation for paired difference.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale for
each of the two one-sided tests.
rejectPerStage: The probability for efficacy stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeAlphaSpent: The cumulative alpha for each of
the two one-sided tests.
cumulativeAttainedAlpha: The cumulative probability for
efficacy stopping under H0.
efficacyPairedDiffLower: The efficacy boundaries on the
paired difference scale for the one-sided null hypothesis on the
lower equivalence limit.
efficacyPairedDiffUpper: The efficacy boundaries on the
paired difference scale for the one-sided null hypothesis on the
upper equivalence limit.
efficacyP: The efficacy bounds on the p-value scale for
each of the two one-sided tests.
information: The cumulative information.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
spendingTime: The error spending time at each analysis.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution. The exact
calculation using the t distribution is only implemented for the
fixed design.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
# Example 1: group sequential trial power calculation (design1 <- getDesignPairedMeanDiffEquiv( beta = 0.1, n = NA, pairedDiffLower = -1.3, pairedDiffUpper = 1.3, pairedDiff = 0, stDev = 2.2, kMax = 4, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for t-test (design2 <- getDesignPairedMeanDiffEquiv( beta = 0.1, n = NA, pairedDiffLower = -1.3, pairedDiffUpper = 1.3, pairedDiff = 0, stDev = 2.2, normalApproximation = FALSE, alpha = 0.05))# Example 1: group sequential trial power calculation (design1 <- getDesignPairedMeanDiffEquiv( beta = 0.1, n = NA, pairedDiffLower = -1.3, pairedDiffUpper = 1.3, pairedDiff = 0, stDev = 2.2, kMax = 4, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for t-test (design2 <- getDesignPairedMeanDiffEquiv( beta = 0.1, n = NA, pairedDiffLower = -1.3, pairedDiffUpper = 1.3, pairedDiff = 0, stDev = 2.2, normalApproximation = FALSE, alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for paired mean ratio.
getDesignPairedMeanRatio( beta = NA_real_, n = NA_real_, pairedRatioH0 = 1, pairedRatio = 1.2, CV = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityPairedRatio = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignPairedMeanRatio( beta = NA_real_, n = NA_real_, pairedRatioH0 = 1, pairedRatio = 1.2, CV = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityPairedRatio = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
pairedRatioH0 |
The paired ratio under the null hypothesis. |
pairedRatio |
The paired ratio under the alternative hypothesis. |
CV |
The coefficient of variation for paired ratio. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility boundary on the conditional power scale. |
futilityPairedRatio |
The futility boundary on the paired ratio scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designPairedMeanRatio object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
pairedRatioH0: The paired ratio under the null hypothesis.
pairedRatio: The paired ratio under the alternative
hypothesis.
CV: The coefficient of variation for paired ratio.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
numberOfSubjects: The number of subjects.
efficacyPairedRatio: The efficacy boundaries on the paired
ratio scale.
futilityPairedRatio: The futility boundaries on the paired
ratio scale.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
# Example 1: group sequential trial power calculation (design1 <- getDesignPairedMeanRatio( beta = 0.1, n = NA, pairedRatio = 1.2, CV = 0.35, kMax = 5, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for one-sample t-test (design2 <- getDesignPairedMeanRatio( beta = 0.1, n = NA, pairedRatio = 1.2, CV = 0.35, normalApproximation = FALSE, alpha = 0.05))# Example 1: group sequential trial power calculation (design1 <- getDesignPairedMeanRatio( beta = 0.1, n = NA, pairedRatio = 1.2, CV = 0.35, kMax = 5, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for one-sample t-test (design2 <- getDesignPairedMeanRatio( beta = 0.1, n = NA, pairedRatio = 1.2, CV = 0.35, normalApproximation = FALSE, alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for equivalence in paired mean ratio.
getDesignPairedMeanRatioEquiv( beta = NA_real_, n = NA_real_, pairedRatioLower = NA_real_, pairedRatioUpper = NA_real_, pairedRatio = 1, CV = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )getDesignPairedMeanRatioEquiv( beta = NA_real_, n = NA_real_, pairedRatioLower = NA_real_, pairedRatioUpper = NA_real_, pairedRatio = 1, CV = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
pairedRatioLower |
The lower equivalence limit of paired ratio. |
pairedRatioUpper |
The upper equivalence limit of paired ratio. |
pairedRatio |
The paired ratio under the alternative hypothesis. |
CV |
The coefficient of variation for paired ratio. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designPairedMeanRatioEquiv object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The significance level for each of the two one-sided
tests. Defaults to 0.05.
attainedAlpha: The attained significance level under H0.
kMax: The number of stages.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
pairedRatioLower: The lower equivalence limit of paired
ratio.
pairedRatioUpper: The upper equivalence limit of paired
ratio.
pairedRatio: The paired ratio under the alternative
hypothesis.
CV: The coefficient of variation for paired ratios.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale for
each of the two one-sided tests.
rejectPerStage: The probability for efficacy stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeAlphaSpent: The cumulative alpha for each of
the two one-sided tests.
cumulativeAttainedAlpha: The cumulative alpha attained under
H0.
efficacyP: The efficacy bounds on the p-value scale for
each of the two one-sided tests.
information: The cumulative information.
numberOfSubjects: The number of subjects.
efficacyPairedRatioLower: The efficacy boundaries on the
paired ratio scale for the one-sided null hypothesis on the
lower equivalence limit.
efficacyPairedRatioUpper: The efficacy boundaries on the
paired ratio scale for the one-sided null hypothesis on the
upper equivalence limit.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
spendingTime: The error spending time at each analysis.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution. The exact
calculation using the t distribution is only implemented for the
fixed design.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
# Example 1: group sequential trial power calculation (design1 <- getDesignPairedMeanRatioEquiv( beta = 0.1, n = NA, pairedRatioLower = 0.8, pairedRatioUpper = 1.25, pairedRatio = 1, CV = 0.35, kMax = 4, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for t-test (design2 <- getDesignPairedMeanRatioEquiv( beta = 0.1, n = NA, pairedRatioLower = 0.8, pairedRatioUpper = 1.25, pairedRatio = 1, CV = 0.35, normalApproximation = FALSE, alpha = 0.05))# Example 1: group sequential trial power calculation (design1 <- getDesignPairedMeanRatioEquiv( beta = 0.1, n = NA, pairedRatioLower = 0.8, pairedRatioUpper = 1.25, pairedRatio = 1, CV = 0.35, kMax = 4, alpha = 0.05, typeAlphaSpending = "sfOF")) # Example 2: sample size calculation for t-test (design2 <- getDesignPairedMeanRatioEquiv( beta = 0.1, n = NA, pairedRatioLower = 0.8, pairedRatioUpper = 1.25, pairedRatio = 1, CV = 0.35, normalApproximation = FALSE, alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for McNemar's test for paired proportions.
getDesignPairedPropMcNemar( beta = NA_real_, n = NA_real_, pDiscordant = NA_real_, riskDiff = NA_real_, nullVariance = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityRiskDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignPairedPropMcNemar( beta = NA_real_, n = NA_real_, pDiscordant = NA_real_, riskDiff = NA_real_, nullVariance = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityRiskDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
pDiscordant |
The proportion of discordant pairs (xi = pi01 + pi10). |
riskDiff |
The risk difference between the active and control treatments (delta = pi_t - pi_c = pi01 - pi10) |
nullVariance |
Whether to use the variance under the null or the variance under the alternative. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility bounds on the conditional power scale. |
futilityRiskDiff |
The futility bounds on the risk difference scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
Consider a group sequential design for McNemar's test for paired
proportions. The table below shows joint probabilities for
each cell ( where is for control group and
is for experimental group), with marginal totals.
| Experimental: No Response | Experimental: Response | Row Total | |
| Control: No Response | |
|
|
| Control: Response | |
|
|
| Column Total | |
|
1 |
The parameters and are the discordant pairs
(i.e., ) and the risk difference
is . The parameter is the
proportion of experimental group response, and is the
proportion of control group response. The parameter of interest
is
The variance of can be obtained from the multinomial
distribution as follows:
which can be simplified to
Here, is the total number of treatment pairs.
This is the unconditional variance, which is used for the
overall design.
An S3 class designPairedPropMcNemar object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
pDiscordant: The proportion of discordant pairs
(xi = pi01 + pi10).
riskDiff: The risk difference between the active and control
treatments (delta = pi_t - pi_c = pi01 - pi10)
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
efficacyRiskDiff: The efficacy boundaries on the risk
difference scale.
futilityRiskDiff: The futility boundaries on the risk
difference scale.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
varianceRatio: The ratio of the variance under H0 to the
variance under H1.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
# Example 1: fixed design (design1 <- getDesignPairedPropMcNemar( beta = 0.1, n = NA, pDiscordant = 0.16, riskDiff = 0.1, alpha = 0.025)) # Example 2: group sequential design (design2 <- getDesignPairedPropMcNemar( beta = 0.1, n = NA, pDiscordant = 0.16, riskDiff = 0.1, alpha = 0.025, kMax = 3, typeAlphaSpending = "sfOF"))# Example 1: fixed design (design1 <- getDesignPairedPropMcNemar( beta = 0.1, n = NA, pDiscordant = 0.16, riskDiff = 0.1, alpha = 0.025)) # Example 2: group sequential design (design2 <- getDesignPairedPropMcNemar( beta = 0.1, n = NA, pDiscordant = 0.16, riskDiff = 0.1, alpha = 0.025, kMax = 3, typeAlphaSpending = "sfOF"))
Obtains the power and sample size for one-way repeated measures analysis of variance. Each subject takes all treatments in the longitudinal study.
getDesignRepeatedANOVA( beta = NA_real_, n = NA_real_, ngroups = 2, means = NA_real_, stDev = 1, corr = 0, rounding = TRUE, alpha = 0.05 )getDesignRepeatedANOVA( beta = NA_real_, n = NA_real_, ngroups = 2, means = NA_real_, stDev = 1, corr = 0, rounding = TRUE, alpha = 0.05 )
beta |
The type II error. |
n |
The total sample size. |
ngroups |
The number of treatment groups. |
means |
The treatment group means. |
stDev |
The total standard deviation. |
corr |
The correlation among the repeated measures. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
alpha |
The two-sided significance level. Defaults to 0.05. |
Let denote the measurement under treatment condition
for subject . Then
where
denotes the subject random effect,
and denotes the within-subject
residual. If we set , then is the
mean of the last treatment (control), and is the
difference in means between the th treatment and the control
for .
The repeated measures have a compound symmetry covariance structure.
Let , and
. Then
.
Let denote the design matrix for subject .
Let .
It follows that
It can be shown that
It follows that
where the noncentrality parameter for
the distribution is
An S3 class designRepeatedANOVA object with the
following components:
power: The power to reject the null hypothesis that
there is no difference among the treatment groups.
alpha: The two-sided significance level.
n: The number of subjects.
ngroups: The number of treatment groups.
means: The treatment group means.
stDev: The total standard deviation.
corr: The correlation among the repeated measures.
effectsize: The effect size.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignRepeatedANOVA( beta = 0.1, ngroups = 4, means = c(1.5, 2.5, 2, 0), stDev = 5, corr = 0.2, alpha = 0.05))(design1 <- getDesignRepeatedANOVA( beta = 0.1, ngroups = 4, means = c(1.5, 2.5, 2, 0), stDev = 5, corr = 0.2, alpha = 0.05))
Obtains the power and sample size for a single contrast in one-way repeated measures analysis of variance.
getDesignRepeatedANOVAContrast( beta = NA_real_, n = NA_real_, ngroups = 2, means = NA_real_, stDev = 1, corr = 0, contrast = NA_real_, meanContrastH0 = 0, rounding = TRUE, alpha = 0.025 )getDesignRepeatedANOVAContrast( beta = NA_real_, n = NA_real_, ngroups = 2, means = NA_real_, stDev = 1, corr = 0, contrast = NA_real_, meanContrastH0 = 0, rounding = TRUE, alpha = 0.025 )
beta |
The type II error. |
n |
The total sample size. |
ngroups |
The number of treatment groups. |
means |
The treatment group means. |
stDev |
The total standard deviation. |
corr |
The correlation among the repeated measures. |
contrast |
The coefficients for the single contrast. |
meanContrastH0 |
The mean of the contrast under the null hypothesis. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
alpha |
The one-sided significance level. Defaults to 0.025. |
An S3 class designRepeatedANOVAContrast object with
the following components:
power: The power to reject the null hypothesis for the
treatment contrast.
alpha: The one-sided significance level.
n: The number of subjects.
ngroups: The number of treatment groups.
means: The treatment group means.
stDev: The total standard deviation.
corr: The correlation among the repeated measures.
contrast: The coefficients for the single contrast.
meanContrastH0: The mean of the contrast under the null
hypothesis.
meanContrast: The mean of the contrast under the alternative
hypothesis.
effectsize: The effect size.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignRepeatedANOVAContrast( beta = 0.1, ngroups = 4, means = c(1.5, 2.5, 2, 0), stDev = 5, corr = 0.2, contrast = c(1, 1, 1, -3)/3, alpha = 0.025))(design1 <- getDesignRepeatedANOVAContrast( beta = 0.1, ngroups = 4, means = c(1.5, 2.5, 2, 0), stDev = 5, corr = 0.2, contrast = c(1, 1, 1, -3)/3, alpha = 0.025))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for two-sample risk difference.
getDesignRiskDiff( beta = NA_real_, n = NA_real_, riskDiffH0 = 0, pi1 = NA_real_, pi2 = NA_real_, nullVariance = TRUE, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityRiskDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignRiskDiff( beta = NA_real_, n = NA_real_, riskDiffH0 = 0, pi1 = NA_real_, pi2 = NA_real_, nullVariance = TRUE, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityRiskDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
riskDiffH0 |
The risk difference under the null hypothesis. Defaults to 0. |
pi1 |
The assumed probability for the active treatment group. |
pi2 |
The assumed probability for the control group. |
nullVariance |
Whether to use the variance under the null or the empirical variance under the alternative. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility bounds on the conditional power scale. |
futilityRiskDiff |
The futility bounds on the risk difference scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
Consider a group sequential design for two-sample risk difference. The parameter of interest is
where is the response probability for the active
treatment group and is the response probability
for the control group. The variance of
can be obtained from the binomial distributions as follows:
where is the total number of subjects and is the
randomization probability for the active treatment group.
When nullVariance = TRUE, the variance is computed
under the null hypothesis. In this case, the values of
and in the variance formula are
replaced with their restricted maximum likelihood
counterparts, subject to the constraint
An S3 class designRiskDiff object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
riskDiffH0: The risk difference under the null hypothesis.
pi1: The assumed probability for the active treatment group.
pi2: The assumed probability for the control group.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyRiskDiff: The efficacy boundaries on the risk
difference scale.
futilityRiskDiff: The futility boundaries on the risk
difference scale.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
varianceRatio: The ratio of the variance under H0 to
the variance under H1.
nullVariance: Whether to use the variance under the null or
the empirical variance under the alternative.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignRiskDiff( beta = 0.2, n = NA, pi1 = 0.1, pi2 = 0.15, kMax = 3, alpha = 0.025, typeAlphaSpending = "sfOF", nullVariance = FALSE))(design1 <- getDesignRiskDiff( beta = 0.2, n = NA, pi1 = 0.1, pi2 = 0.15, kMax = 3, alpha = 0.025, typeAlphaSpending = "sfOF", nullVariance = FALSE))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for equivalence in two-sample risk difference.
getDesignRiskDiffEquiv( beta = NA_real_, n = NA_real_, riskDiffLower = NA_real_, riskDiffUpper = NA_real_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, criticalValues = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )getDesignRiskDiffEquiv( beta = NA_real_, n = NA_real_, riskDiffLower = NA_real_, riskDiffUpper = NA_real_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, criticalValues = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
riskDiffLower |
The lower equivalence limit of risk difference. |
riskDiffUpper |
The upper equivalence limit of risk difference. |
pi1 |
The assumed probability for the active treatment group. |
pi2 |
The assumed probability for the control group. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designRiskDiffEquiv object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The significance level for each of the two one-sided
tests. Defaults to 0.05.
attainedAlphaH10: The attained significance level under H10.
attainedAlphaH20: The attained significance level under H20.
kMax: The number of stages.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH10: The expected information under H10.
expectedInformationH20: The expected information under H20.
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH10: The expected number of subjects
under H10.
expectedNumberOfSubjectsH20: The expected number of subjects
under H20.
riskDiffLower: The lower equivalence limit of risk
difference.
riskDiffUpper: The upper equivalence limit of risk
difference.
pi1: The assumed probability for the active treatment group.
pi2: The assumed probability for the control group.
riskDiff: The risk difference.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale for
each of the two one-sided tests.
rejectPerStage: The probability for efficacy stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeAlphaSpent: The cumulative alpha for each of
the two one-sided tests.
cumulativeAttainedAlphaH10: The cumulative alpha attained
under H10.
cumulativeAttainedAlphaH20: The cumulative alpha attained
under H20.
efficacyP: The efficacy bounds on the p-value scale for
each of the two one-sided tests.
information: The cumulative information.
efficacyRiskDiffLower: The efficacy boundaries on the
risk difference scale for the one-sided null hypothesis on the
lower equivalence limit.
efficacyRiskDiffUpper: The efficacy boundaries on the
risk difference scale for the one-sided null hypothesis on the
upper equivalence limit.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
spendingTime: The error spending time at each analysis.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignRiskDiffEquiv( beta = 0.2, n = NA, riskDiffLower = -0.1, riskDiffUpper = 0.1, pi1 = 0.12, pi2 = 0.12, kMax = 3, alpha = 0.05, typeAlphaSpending = "sfOF"))(design1 <- getDesignRiskDiffEquiv( beta = 0.2, n = NA, riskDiffLower = -0.1, riskDiffUpper = 0.1, pi1 = 0.12, pi2 = 0.12, kMax = 3, alpha = 0.05, typeAlphaSpending = "sfOF"))
Obtains the power given sample size or obtains the sample size given power for exact unconditional test of risk difference.
getDesignRiskDiffExact( beta = NA_real_, n = NA_real_, riskDiffH0 = 0, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, alpha = 0.025 )getDesignRiskDiffExact( beta = NA_real_, n = NA_real_, riskDiffH0 = 0, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, alpha = 0.025 )
beta |
The type II error. |
n |
The total sample size. |
riskDiffH0 |
The risk difference under the null hypothesis. Defaults to 0. |
pi1 |
The assumed probability for the active treatment group. |
pi2 |
The assumed probability for the control group. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
alpha |
The one-sided significance level. Defaults to 0.025. |
A data frame with the following variables:
alpha: The specified one-sided significance level.
attainedAlpha: The attained one-sided significance level.
power: The power.
n: The sample size.
riskDiffH0: The risk difference under the null hypothesis.
pi1: The assumed probability for the active treatment group.
pi2: The assumed probability for the control group.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
zstatRiskDiffBound: The critical value on the scale of
score test statistic for risk difference.
pi2star: The response probability in the control group
at which the critical value of the test statistic is attained.
Kaifeng Lu, [email protected]
# Superiority test getDesignRiskDiffExact(n = 50, pi1 = 0.6, pi2 = 0.25, alpha = 0.025) # Non-inferiority test getDesignRiskDiffExact(beta = 0.2, riskDiffH0 = -0.3, pi1 = 0.9, pi2 = 0.9, alpha = 0.025)# Superiority test getDesignRiskDiffExact(n = 50, pi1 = 0.6, pi2 = 0.25, alpha = 0.025) # Non-inferiority test getDesignRiskDiffExact(beta = 0.2, riskDiffH0 = -0.3, pi1 = 0.9, pi2 = 0.9, alpha = 0.025)
Obtains the power given sample size or obtains the sample size given power for exact unconditional test of equivalence in risk difference.
getDesignRiskDiffExactEquiv( beta = NA_real_, n = NA_real_, riskDiffLower = NA_real_, riskDiffUpper = NA_real_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, alpha = 0.05 )getDesignRiskDiffExactEquiv( beta = NA_real_, n = NA_real_, riskDiffLower = NA_real_, riskDiffUpper = NA_real_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, alpha = 0.05 )
beta |
The type II error. |
n |
The total sample size. |
riskDiffLower |
The lower equivalence limit of risk difference. |
riskDiffUpper |
The upper equivalence limit of risk difference. |
pi1 |
The assumed probability for the active treatment group. |
pi2 |
The assumed probability for the control group. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
A data frame with the following variables:
alpha: The specified significance level for each of the two
one-sided tests.
attainedAlpha: The attained significance level.
power: The power.
n: The sample size.
riskDiffLower: The lower equivalence limit of risk difference.
riskDiffUpper: The upper equivalence limit of risk difference.
pi1: The assumed probability for the active treatment group.
pi2: The assumed probability for the control group.
riskDiff: The risk difference.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
zstatRiskDiffLower: The efficacy boundaries on the
z-test statistic scale for the one-sided null hypothesis on the
lower equivalence limit.
zstatRiskDiffUpper: The efficacy boundaries on the
z-test statistic scale for the one-sided null hypothesis on the
upper equivalence limit.
Kaifeng Lu, [email protected]
getDesignRiskDiffExactEquiv( n = 200, riskDiffLower = -0.2, riskDiffUpper = 0.2, pi1 = 0.775, pi2 = 0.775, alpha = 0.05)getDesignRiskDiffExactEquiv( n = 200, riskDiffLower = -0.2, riskDiffUpper = 0.2, pi1 = 0.775, pi2 = 0.775, alpha = 0.05)
Obtains the power given sample size or obtains the sample size given power for a group sequential design for two-sample risk ratio.
getDesignRiskRatio( beta = NA_real_, n = NA_real_, riskRatioH0 = 1, pi1 = NA_real_, pi2 = NA_real_, nullVariance = TRUE, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityRiskRatio = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignRiskRatio( beta = NA_real_, n = NA_real_, riskRatioH0 = 1, pi1 = NA_real_, pi2 = NA_real_, nullVariance = TRUE, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityRiskRatio = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
riskRatioH0 |
The risk ratio under the null hypothesis. Defaults to 1. |
pi1 |
The assumed probability for the active treatment group. |
pi2 |
The assumed probability for the control group. |
nullVariance |
Whether to use the variance under the null or the empirical variance under the alternative. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility bounds on the conditional power scale. |
futilityRiskRatio |
The futility bounds on the risk ratio scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
Consider a group sequential design for two-sample risk ratio. The parameter of interest is
where is the response probability for the active
treatment group and is the response probability
for the control group. For statistical inference,
the parameter is often transformed to
the log scale:
The variance of the estimator
can be derived from the binomial distributions as follows:
where is the total number of subjects and is the
randomization probability for the active treatment group.
When nullVariance = TRUE, the variance is computed
under the null hypothesis. In this case, the values of
and in the variance formula are
replaced with their restricted maximum likelihood
counterparts, subject to the constraint
An S3 class designRiskRatio object with three components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
riskRatioH0: The risk ratio under the null hypothesis.
pi1: The assumed probability for the active treatment group.
pi2: The assumed probability for the control group.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
efficacyRiskRatio: The efficacy boundaries on the risk
ratio scale.
futilityRiskRatio: The futility boundaries on the risk
ratio scale.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
varianceRatio: The ratio of the variance under H0 to
the variance under H1.
nullVariance: Whether to use the variance under the null or
the empirical variance under the alternative.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignRiskRatio( beta = 0.1, n = NA, pi1 = 0.5, pi2 = 0.3, alpha = 0.05))(design1 <- getDesignRiskRatio( beta = 0.1, n = NA, pi1 = 0.5, pi2 = 0.3, alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for equivalence in two-sample risk ratio.
getDesignRiskRatioEquiv( beta = NA_real_, n = NA_real_, riskRatioLower = NA_real_, riskRatioUpper = NA_real_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, criticalValues = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )getDesignRiskRatioEquiv( beta = NA_real_, n = NA_real_, riskRatioLower = NA_real_, riskRatioUpper = NA_real_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, criticalValues = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
riskRatioLower |
The lower equivalence limit of risk ratio. |
riskRatioUpper |
The upper equivalence limit of risk ratio. |
pi1 |
The assumed probability for the active treatment group. |
pi2 |
The assumed probability for the control group. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
spendingTime |
A vector of length |
An S3 class designRiskRatioEquiv object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The significance level for each of the two one-sided
tests. Defaults to 0.05.
attainedAlphaH10: The attained significance level under H10.
attainedAlphaH20: The attained significance level under H20.
kMax: The number of stages.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH10: The expected information under H10.
expectedInformationH20: The expected information under H20.
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH10: The expected number of subjects
under H10.
expectedNumberOfSubjectsH20: The expected number of subjects
under H20.
riskRatioLower: The lower equivalence limit of risk ratio.
riskRatioUpper: The upper equivalence limit of risk ratio.
pi1: The assumed probability for the active treatment group.
pi2: The assumed probability for the control group.
riskRatio: The risk ratio.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale for
each of the two one-sided tests.
rejectPerStage: The probability for efficacy stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeAlphaSpent: The cumulative alpha for each of
the two one-sided tests.
cumulativeAttainedAlphaH10: The cumulative alpha attained
under H10.
cumulativeAttainedAlphaH20: The cumulative alpha attained
under H20.
efficacyRiskRatioLower: The efficacy boundaries on the
risk ratio scale for the one-sided null hypothesis on the
lower equivalence limit.
efficacyRiskRatioUpper: The efficacy boundaries on the
risk ratio scale for the one-sided null hypothesis on the
upper equivalence limit.
efficacyP: The efficacy bounds on the p-value scale for
each of the two one-sided tests.
information: The cumulative information.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
spendingTime: The error spending time at each analysis.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignRiskRatioEquiv( beta = 0.2, n = NA, riskRatioLower = 0.8, riskRatioUpper = 1.25, pi1 = 0.12, pi2 = 0.12, kMax = 3, alpha = 0.05, typeAlphaSpending = "sfOF"))(design1 <- getDesignRiskRatioEquiv( beta = 0.2, n = NA, riskRatioLower = 0.8, riskRatioUpper = 1.25, pi1 = 0.12, pi2 = 0.12, kMax = 3, alpha = 0.05, typeAlphaSpending = "sfOF"))
Obtains the power given sample size or obtains the sample size given power for exact unconditional test of risk ratio.
getDesignRiskRatioExact( beta = NA_real_, n = NA_real_, riskRatioH0 = 1, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, alpha = 0.025 )getDesignRiskRatioExact( beta = NA_real_, n = NA_real_, riskRatioH0 = 1, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, alpha = 0.025 )
beta |
The type II error. |
n |
The total sample size. |
riskRatioH0 |
The risk ratio under the null hypothesis. Defaults to 0. |
pi1 |
The assumed probability for the active treatment group. |
pi2 |
The assumed probability for the control group. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
alpha |
The one-sided significance level. Defaults to 0.025. |
A data frame with the following variables:
alpha: The specified one-sided significance level.
attainedAlpha: The attained one-sided significance level.
power: The power.
n: The sample size.
riskRatioH0: The risk ratio under the null hypothesis.
pi1: The assumed probability for the active treatment group.
pi2: The assumed probability for the control group.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
zstatRiskRatioBound: The critical value on the scale of
score test statistic for risk ratio.
pi2star: The response probability in the control group
at which the critical value of the test statistic is attained.
Kaifeng Lu, [email protected]
# Non-inferiority test getDesignRiskRatioExact(beta = 0.2, riskRatioH0 = 0.7, pi1 = 0.95, pi2 = 0.95, alpha = 0.025)# Non-inferiority test getDesignRiskRatioExact(beta = 0.2, riskRatioH0 = 0.7, pi1 = 0.95, pi2 = 0.95, alpha = 0.025)
Obtains the power given sample size or obtains the sample size given power for exact unconditional test of equivalence in risk ratio.
getDesignRiskRatioExactEquiv( beta = NA_real_, n = NA_real_, riskRatioLower = NA_real_, riskRatioUpper = NA_real_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, alpha = 0.05 )getDesignRiskRatioExactEquiv( beta = NA_real_, n = NA_real_, riskRatioLower = NA_real_, riskRatioUpper = NA_real_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, alpha = 0.05 )
beta |
The type II error. |
n |
The total sample size. |
riskRatioLower |
The lower equivalence limit of risk ratio. |
riskRatioUpper |
The upper equivalence limit of risk ratio. |
pi1 |
The assumed probability for the active treatment group. |
pi2 |
The assumed probability for the control group. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
A data frame with the following variables:
alpha: The specified significance level for each of the two
one-sided tests.
attainedAlpha: The attained significance level.
power: The power.
n: The sample size.
riskRatioLower: The lower equivalence limit of risk ratio.
riskRatioUpper: The upper equivalence limit of risk ratio.
pi1: The assumed probability for the active treatment group.
pi2: The assumed probability for the control group.
riskRatio: The risk ratio.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
zstatRiskRatioLower: The efficacy boundaries on the
z-test statistic scale for the one-sided null hypothesis on the
lower equivalence limit.
zstatRiskRatioUpper: The efficacy boundaries on the
z-test statistic scale for the one-sided null hypothesis on the
upper equivalence limit.
Kaifeng Lu, [email protected]
getDesignRiskRatioExactEquiv( n = 200, riskRatioLower = 0.8, riskRatioUpper = 1.25, pi1 = 0.775, pi2 = 0.775, alpha = 0.05)getDesignRiskRatioExactEquiv( n = 200, riskRatioLower = 0.8, riskRatioUpper = 1.25, pi1 = 0.775, pi2 = 0.775, alpha = 0.05)
Obtains the power given sample size or obtains the sample size given power for a group sequential design for two-sample risk ratio based on the Farrington-Manning score test
getDesignRiskRatioFM( beta = NA_real_, n = NA_real_, riskRatioH0 = 1, pi1 = NA_real_, pi2 = NA_real_, nullVariance = TRUE, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityRiskRatio = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignRiskRatioFM( beta = NA_real_, n = NA_real_, riskRatioH0 = 1, pi1 = NA_real_, pi2 = NA_real_, nullVariance = TRUE, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityRiskRatio = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
riskRatioH0 |
The risk ratio under the null hypothesis. Defaults to 1. |
pi1 |
The assumed probability for the active treatment group. |
pi2 |
The assumed probability for the control group. |
nullVariance |
Whether to use the variance under the null or the empirical variance under the alternative. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility bounds on the conditional power scale. |
futilityRiskRatio |
The futility bounds on the risk ratio scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
Consider a group sequential design for two-sample risk ratio. The parameter of interest is
where is the response probability for the active
treatment group and is the response probability
for the control group. Let denote the risk ratio
under the null hypothesis. The Farrington-Manning score test
statistic is constructed as
The variance can be derived from the binomial distributions as follows:
where is the total number of subjects and is the
randomization probability for the active treatment group.
When nullVariance = TRUE, the variance is computed
under the null hypothesis. In this case, the values of
and in the variance formula are
replaced with their restricted maximum likelihood
counterparts, subject to the constraint
An S3 class designRiskRatioFM object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
riskRatioH0: The risk ratio under the null hypothesis.
pi1: The assumed probability for the active treatment group.
pi2: The assumed probability for the control group.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
efficacyRiskRatioScore: The efficacy boundaries on the
score test pi1 - riskRatioH0*pi2 score.
futilityRiskRatioScore: The futility boundaries on the
score test pi1 - riskRatioH0*pi2 scale.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
varianceRatio: The ratio of the variance under H0 to
the variance under H1.
nullVariance: Whether to use the variance under the null or
the empirical variance under the alternative.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignRiskRatioFM( beta = 0.2, riskRatioH0 = 1.3, pi1 = 0.125, pi2 = 0.125, alpha = 0.05))(design1 <- getDesignRiskRatioFM( beta = 0.2, riskRatioH0 = 1.3, pi1 = 0.125, pi2 = 0.125, alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for two-sample slope difference.
getDesignSlopeDiff( beta = NA_real_, n = NA_real_, slopeDiffH0 = 0, slopeDiff = 0.5, stDev = 1, stDevCovariate = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilitySlopeDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignSlopeDiff( beta = NA_real_, n = NA_real_, slopeDiffH0 = 0, slopeDiff = 0.5, stDev = 1, stDevCovariate = 1, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilitySlopeDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
slopeDiffH0 |
The slope difference under the null hypothesis. Defaults to 0. |
slopeDiff |
The slope difference under the alternative hypothesis. |
stDev |
The standard deviation of the residual. |
stDevCovariate |
The standard deviation of the covariate. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility bounds on the conditional power scale. |
futilitySlopeDiff |
The futility bounds on the slope difference scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
We assume a simple linear regression of the form
for treatment group , where
is the residual error for subject in group ,
which is assumed to be normally distributed with mean 0 and
standard deviation .
The covariate is assumed to
be normally distributed with mean 0 and standard deviation
. Since
where is the sample size for group ,
it follows that
The slope difference is defined as
where and
are the estimated slopes for treatment groups 1 and 2, respectively.
Since the variance of is
we have
which can be used to calculate the power and sample size for the group sequential design.
An S3 class designSlopeDiff object with three components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
slopeDiffH0: The slope difference under the null hypothesis.
slopeDiff: The slope difference under the alternative
hypothesis.
stDev: The standard deviation of the residual.
stDevCovariate: The standard deviation of the covariate.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
efficacySlopeDiff: The efficacy boundaries on the slope
difference scale.
futilitySlopeDiff: The futility boundaries on the slope
difference scale.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignSlopeDiff( beta = 0.1, n = NA, slopeDiff = -0.5, stDev = 10, stDevCovariate = 6, normalApproximation = FALSE, alpha = 0.025))(design1 <- getDesignSlopeDiff( beta = 0.1, n = NA, slopeDiff = -0.5, stDev = 10, stDevCovariate = 6, normalApproximation = FALSE, alpha = 0.025))
Obtains the power given sample size or obtains the sample size given power for two-sample slope difference from the growth curve MMRM model.
getDesignSlopeDiffMMRM( beta = NA_real_, slopeDiffH0 = 0, slopeDiff = 0.5, stDev = 1, stDevIntercept = 1, stDevSlope = 1, corrInterceptSlope = 0.5, w = NA_real_, N = NA_real_, accrualTime = 0, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0, gamma1 = 0, gamma2 = 0, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilitySlopeDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignSlopeDiffMMRM( beta = NA_real_, slopeDiffH0 = 0, slopeDiff = 0.5, stDev = 1, stDevIntercept = 1, stDevSlope = 1, corrInterceptSlope = 0.5, w = NA_real_, N = NA_real_, accrualTime = 0, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0, gamma1 = 0, gamma2 = 0, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, allocationRatioPlanned = 1, normalApproximation = TRUE, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilitySlopeDiff = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
slopeDiffH0 |
The slope difference under the null hypothesis. Defaults to 0. |
slopeDiff |
The slope difference under the alternative hypothesis. |
stDev |
The standard deviation of the residual. |
stDevIntercept |
The standard deviation of the random intercept. |
stDevSlope |
The standard deviation of the random slope. |
corrInterceptSlope |
The correlation between the random intercept and random slope. |
w |
The number of time units (e.g. weeks) per measurement visit in a period. In general, visits are more frequent in the beginning of the study and less frequent towards the end. |
N |
The number of measurement visits in a period. For example,
|
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
gamma1 |
The hazard rate for exponential dropout, or a vector of hazard rates for piecewise exponential dropout for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, or a vector of hazard rates for piecewise exponential dropout for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Defaults to
|
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility bounds on the conditional power scale. |
futilitySlopeDiff |
The futility bounds on the slope difference scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
We use the following random-effects model to compare two slopes:
where
: overall intercept common across treatment groups
due to randomization
: slope for the control group
: difference in slopes between the active treatment and
control groups
: treatment indicator for subject ,
1 for the active treatment and 0 for the control
: time point for repeated measurements,
: random intercept and random slope
for subject , ,
,
: within-subject residual with variance
By accounting for randomization, we improve the efficiency for
estimating the difference in slopes. The model also accommodates
unequally spaced time points and missing data.
Specifically, given a calendar time for an interim or
final analysis, let be the number of scheduled time points
up to and including , subject to the follow-up duration for
fixed follow-up designs. Let the observed time points be
, where denotes baseline.
For a subject in treatment group with observed data
pattern , the design matrix for the fixed effects
is given by
where is a -vector of ones, and
is the column vector of
observed time points. The design matrix for the
random effects is
The variance-covariance matrix of the random effects is
Therefore, the variance-covariance matrix for the observed data for the subject is
where is the identity matrix.
Let denote the proportion of subjects in group .
The information matrix for the fixed effects is
where
and is the proportion of subjects in group
with observed data pattern .
The variance of the estimator for the slope difference
is given by
which can be used to calculate the power and sample size for the group sequential design to detect a slope difference.
An S3 class designSlopeDiffMMRM object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping.
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
studyDuration: The maximum study duration.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
expectedStudyDurationH1: The expected study duration
under H1.
expectedStudyDurationH0: The expected study duration
under H0.
accrualDuration: The accrual duration.
followupTime: The follow-up time.
fixedFollowup: Whether a fixed follow-up design is used.
slopeDiffH0: The slope difference under H0.
slopeDiff: The slope difference under H1.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
efficacySlopeDiff: The efficacy boundaries on the slope
difference scale.
futilitySlopeDiff: The futility boundaries on the slope
difference scale.
numberOfSubjects: The number of subjects.
analysisTime: The average time since trial start.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
allocationRatioPlanned: The allocation ratio for the active
treatment versus control.
accrualTime: A vector that specifies the starting time of
piecewise Poisson enrollment time intervals.
accrualIntensity: A vector of accrual intensities.
One for each accrual time interval.
piecewiseSurvivalTime: A vector that specifies the
starting time of piecewise exponential survival time intervals.
gamma1: The hazard rate for exponential dropout or
a vector of hazard rates for piecewise exponential dropout
for the active treatment group.
gamma2: The hazard rate for exponential dropout or
a vector of hazard rates for piecewise exponential dropout
for the control group.
w: The number of time units per measurement visit in a
period.
N: The number of measurement visits in a period.
stdDev: The standard deviation of the residual.
G: The covariance matrix for the random intercept and
random slope.
normalApproximation: The type of computation of the p-values.
If TRUE, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
Daniel O. Scharfstein, Anastasios A. Tsiatis, and James M. Robins. Semiparametric efficiency and its implication on the design and analysis of group-sequential studies. Journal of the American Statistical Association 1997; 92:1342-1350.
(design1 <- getDesignSlopeDiffMMRM( beta = 0.2, slopeDiff = log(1.15)/52, stDev = sqrt(.182), stDevIntercept = sqrt(.238960), stDevSlope = sqrt(.000057), corrInterceptSlope = .003688/sqrt(.238960*.000057), w = 8, N = 10000, accrualIntensity = 15, gamma1 = 1/(4.48*52), gamma2 = 1/(4.48*52), accrualDuration = NA, followupTime = 8, alpha = 0.025))(design1 <- getDesignSlopeDiffMMRM( beta = 0.2, slopeDiff = log(1.15)/52, stDev = sqrt(.182), stDevIntercept = sqrt(.238960), stDevSlope = sqrt(.000057), corrInterceptSlope = .003688/sqrt(.238960*.000057), w = 8, N = 10000, accrualIntensity = 15, gamma1 = 1/(4.48*52), gamma2 = 1/(4.48*52), accrualDuration = NA, followupTime = 8, alpha = 0.025))
Obtains the power given sample size or obtains the sample size given power for difference in two-sample multinomial responses.
getDesignTwoMultinom( beta = NA_real_, n = NA_real_, ncats = NA_integer_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, rounding = TRUE, alpha = 0.05 )getDesignTwoMultinom( beta = NA_real_, n = NA_real_, ncats = NA_integer_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, rounding = TRUE, alpha = 0.05 )
beta |
The type II error. |
n |
The total sample size. |
ncats |
The number of categories of the multinomial response. |
pi1 |
The prevalence of each category for the treatment group.
Only need to specify the valued for the first |
pi2 |
The prevalence of each category for the control group.
Only need to specify the valued for the first |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
alpha |
The two-sided significance level. Defaults to 0.05. |
A two-arm multinomial response design is used to test whether the
prevalence of each category differs between two treatment arms.
Let denote the prevalence of category
in group , where for the treatment group and
for the control group.
The chi-square test statistic is given by
where is the number of subjects in category
for group , is the total number of subjects
in group , and is the total number of subjects
in category across both groups, and
is the total sample size.
Under the null hypothesis, follows a chi-square distribution
with degrees of freedom.
Under the alternative hypothesis, follows a non-central
chi-square distribution with non-centrality parameter
where is the randomization probability for the active treatment.
The sample size is chosen such that the power to reject the null
hypothesis is at least for a given
significance level .
An S3 class designTwoMultinom object with the following
components:
power: The power to reject the null hypothesis.
alpha: The two-sided significance level.
n: The maximum number of subjects.
ncats: The number of categories of the multinomial response.
pi1: The prevalence of each category for the treatment group.
pi2: The prevalence of each category for the control group.
effectsize: The effect size for the chi-square test.
allocationRatioPlanned: Allocation ratio for the active treatment
versus control.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignTwoMultinom( beta = 0.1, ncats = 3, pi1 = c(0.3, 0.35), pi2 = c(0.2, 0.3), alpha = 0.05))(design1 <- getDesignTwoMultinom( beta = 0.1, ncats = 3, pi1 = c(0.3, 0.35), pi2 = c(0.2, 0.3), alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for the Wilcoxon test for two-sample ordinal response.
getDesignTwoOrdinal( beta = NA_real_, n = NA_real_, ncats = NA_integer_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, rounding = TRUE, alpha = 0.05 )getDesignTwoOrdinal( beta = NA_real_, n = NA_real_, ncats = NA_integer_, pi1 = NA_real_, pi2 = NA_real_, allocationRatioPlanned = 1, rounding = TRUE, alpha = 0.05 )
beta |
The type II error. |
n |
The total sample size. |
ncats |
The number of categories of the ordinal response. |
pi1 |
The prevalence of each category for the treatment group.
Only need to specify the valued for the first |
pi2 |
The prevalence of each category for the control group.
Only need to specify the valued for the first |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
alpha |
The significance level. Defaults to 0.025. |
A two-sample ordinal response design is used to test whether the
ordinal response distributions differ between two treatment arms.
Let denote the prevalence of category
in group , where represents the treatment group and
represents the control group.
The parameter of interest is
where is the midrank score for category .
The Z-test statistic is given by
where is the estimate of .
The midrank score for category is calculated as:
where denotes the average
prevalence of category across both groups,
and is the randomization probability for the active treatment.
To understand the midrank score, consider subjects
in category . The midrank score is the average rank of
these subjects:
This simplifies to
By dividing by and ignoring , we obtain
the midrank score .
The variance of can be derived from the multinomial
distributions and is given by
where is the randomization probability for group .
The sample size is chosen such that the power to reject the null
hypothesis is at least for a given
significance level .
An S3 class designTwoOrdinal object with the following
components:
power: The power to reject the null hypothesis.
alpha: The two-sided significance level.
n: The maximum number of subjects.
ncats: The number of categories of the ordinal response.
pi1: The prevalence of each category for the treatment group.
pi2: The prevalence of each category for the control group.
meanscore1: The mean midrank score for the treatment group.
meanscore2: The mean midrank score for the control group.
allocationRatioPlanned: Allocation ratio for the active treatment
versus control.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignTwoOrdinal( beta = 0.1, ncats = 4, pi1 = c(0.55, 0.3, 0.1), pi2 = c(0.214, 0.344, 0.251), alpha = 0.025))(design1 <- getDesignTwoOrdinal( beta = 0.1, ncats = 4, pi1 = c(0.55, 0.3, 0.1), pi2 = c(0.214, 0.344, 0.251), alpha = 0.025))
Obtains the power and sample size for two-way analysis of variance.
getDesignTwoWayANOVA( beta = NA_real_, n = NA_real_, nlevelsA = 2, nlevelsB = 2, means = NA_real_, stDev = 1, rounding = TRUE, alpha = 0.05 )getDesignTwoWayANOVA( beta = NA_real_, n = NA_real_, nlevelsA = 2, nlevelsB = 2, means = NA_real_, stDev = 1, rounding = TRUE, alpha = 0.05 )
beta |
The type II error. |
n |
The total sample size. |
nlevelsA |
The number of groups for Factor A. |
nlevelsB |
The number of levels for Factor B. |
means |
The matrix of treatment means for Factors A and B combination. |
stDev |
The common standard deviation. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
alpha |
The two-sided significance level. Defaults to 0.05. |
An S3 class designTwoWayANOVA object with the following
components:
alpha: The two-sided significance level.
nlevelsA: The number of levels for Factor A.
nlevelsB: The number of levels for Factor B.
means: The matrix of treatment group means.
stDev: The common standard deviation.
effectsizeA: The effect size for Factor A.
effectsizeB: The effect size for Factor B.
effectsizeAB: The effect size for Factor A and Factor B
interaction.
rounding: Whether to round up sample size.
powerdf: The data frame containing the power and sample size
results. It has the following variables:
n: The sample size.
powerA: The power to reject the null hypothesis that
there is no difference among Factor A levels.
powerB: The power to reject the null hypothesis that
there is no difference among Factor B levels.
powerAB: The power to reject the null hypothesis that
there is no interaction between Factor A and Factor B.
Kaifeng Lu, [email protected]
(design1 <- getDesignTwoWayANOVA( beta = 0.1, nlevelsA = 2, nlevelsB = 2, means = matrix(c(0.5, 4.7, 0.4, 6.9), 2, 2, byrow = TRUE), stDev = 2, alpha = 0.05))(design1 <- getDesignTwoWayANOVA( beta = 0.1, nlevelsA = 2, nlevelsB = 2, means = matrix(c(0.5, 4.7, 0.4, 6.9), 2, 2, byrow = TRUE), stDev = 2, alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for the chi-square test for unordered multi-sample binomial response.
getDesignUnorderedBinom( beta = NA_real_, n = NA_real_, ngroups = NA_integer_, pi = NA_real_, allocationRatioPlanned = NA_integer_, rounding = TRUE, alpha = 0.05 )getDesignUnorderedBinom( beta = NA_real_, n = NA_real_, ngroups = NA_integer_, pi = NA_real_, allocationRatioPlanned = NA_integer_, rounding = TRUE, alpha = 0.05 )
beta |
The type II error. |
n |
The total sample size. |
ngroups |
The number of treatment groups. |
pi |
The response probabilities for the treatment groups. |
allocationRatioPlanned |
Allocation ratio for the treatment groups. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
alpha |
The two-sided significance level. Defaults to 0.05. |
A multi-sample binomial response design is used to test whether the
response probabilities differ among multiple treatment arms.
Let denote the response probability in group
, where is the total number of
treatment groups.
The chi-square test statistic is given by
where is the number of subjects in category
for group , is the total number of subjects
in group , and is the total number of subjects
in category across all groups, and
is the total sample size.
Let denote the randomization probability for group , and
define the weighted average response probability across all groups as
Under the null hypothesis, follows a chi-square distribution
with degrees of freedom.
Under the alternative hypothesis, follows a non-central
chi-square distribution with non-centrality parameter
The sample size is chosen such that the power to reject the null
hypothesis is at least for a given
significance level .
An S3 class designUnorderedBinom object with the following
components:
power: The power to reject the null hypothesis.
alpha: The two-sided significance level.
n: The maximum number of subjects.
ngroups: The number of treatment groups.
pi: The response probabilities for the treatment groups.
effectsize: The effect size for the chi-square test.
allocationRatioPlanned: Allocation ratio for the treatment
groups.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignUnorderedBinom( beta = 0.1, ngroups = 3, pi = c(0.1, 0.25, 0.5), alpha = 0.05))(design1 <- getDesignUnorderedBinom( beta = 0.1, ngroups = 3, pi = c(0.1, 0.25, 0.5), alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for the chi-square test for unordered multi-sample multinomial response.
getDesignUnorderedMultinom( beta = NA_real_, n = NA_real_, ngroups = NA_integer_, ncats = NA_integer_, pi = NA_real_, allocationRatioPlanned = NA_integer_, rounding = TRUE, alpha = 0.05 )getDesignUnorderedMultinom( beta = NA_real_, n = NA_real_, ngroups = NA_integer_, ncats = NA_integer_, pi = NA_real_, allocationRatioPlanned = NA_integer_, rounding = TRUE, alpha = 0.05 )
beta |
The type II error. |
n |
The total sample size. |
ngroups |
The number of treatment groups. |
ncats |
The number of categories of the multinomial response. |
pi |
The matrix of response probabilities for the treatment groups.
It should have |
allocationRatioPlanned |
Allocation ratio for the treatment groups. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
alpha |
The two-sided significance level. Defaults to 0.05. |
A multi-sample multinomial response design is used to test whether the
response probabilities differ among multiple treatment arms.
Let denote the response probability for
category in group
, where is the total number of
treatment groups, and is the total number of categories
for the response variable.
The chi-square test statistic is given by
where is the number of subjects in category
for group , is the total number of subjects
in group , and is the total number of subjects
in category across all groups, and
is the total sample size.
Let denote the randomization probability for group , and
define the weighted average response probability
for category across all groups as
Under the null hypothesis, follows a chi-square distribution
with degrees of freedom.
Under the alternative hypothesis, follows a non-central
chi-square distribution with non-centrality parameter
The sample size is chosen such that the power to reject the null
hypothesis is at least for a given
significance level .
An S3 class designUnorderedMultinom object with the
following components:
power: The power to reject the null hypothesis.
alpha: The two-sided significance level.
n: The maximum number of subjects.
ngroups: The number of treatment groups.
ncats: The number of categories of the multinomial response.
pi: The response probabilities for the treatment groups.
effectsize: The effect size for the chi-square test.
allocationRatioPlanned: Allocation ratio for the treatment
groups.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
(design1 <- getDesignUnorderedMultinom( beta = 0.1, ngroups = 3, ncats = 4, pi = matrix(c(0.230, 0.320, 0.272, 0.358, 0.442, 0.154, 0.142, 0.036, 0.039), 3, 3, byrow = TRUE), allocationRatioPlanned = c(2, 2, 1), alpha = 0.05))(design1 <- getDesignUnorderedMultinom( beta = 0.1, ngroups = 3, ncats = 4, pi = matrix(c(0.230, 0.320, 0.272, 0.358, 0.442, 0.154, 0.142, 0.036, 0.039), 3, 3, byrow = TRUE), allocationRatioPlanned = c(2, 2, 1), alpha = 0.05))
Obtains the power given sample size or obtains the sample size given power for a group sequential design for two-sample Wilcoxon test.
getDesignWilcoxon( beta = NA_real_, n = NA_real_, pLarger = 0.6, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilitypLarger = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )getDesignWilcoxon( beta = NA_real_, n = NA_real_, pLarger = 0.6, allocationRatioPlanned = 1, rounding = TRUE, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilitypLarger = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_ )
beta |
The type II error. |
n |
The total sample size. |
pLarger |
The probability that a randomly chosen sample from the treatment group is larger than a randomly chosen sample from the control group under the alternative hypothesis. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
kMax |
The maximum number of stages. |
informationRates |
The information rates. Fixed prior to the trial.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
The futility bounds on the conditional power scale. |
futilitypLarger |
The futility bounds on the pLarger scale. |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
The Mann-Whitney U test is a non-parametric test for the difference in location between two independent groups. It is also known as the Wilcoxon rank-sum test. The test is based on the ranks of the data rather than the actual values, making it robust to outliers and non-normal distributions. The test statistic is the number of times a randomly chosen sample from the treatment group is larger than a randomly chosen sample from the control group, i.e.,
where and are the samples from the
treatment and control groups, respectively.
The test is often used when the data
do not meet the assumptions of the t-test, such as
non-normality or unequal variances.
The test is also applicable to ordinal data.
The test is one-sided, meaning that it only tests
whether the treatment group is larger than the control group.
Asymptotically,
where and are the sample sizes of the treatment
and control groups, respectively, and .
Let , and
. It follows that
where is the randomization probability
for the active treatment group.
This formulation allows for group sequential testing with
futility stopping and efficacy stopping.
An S3 class designWilcoxon object with three
components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
attainedAlpha: The attained significance level, which is
different from the overall significance level in the presence of
futility stopping..
kMax: The number of stages.
theta: The parameter value.
information: The maximum information.
expectedInformationH1: The expected information under H1.
expectedInformationH0: The expected information under H0.
drift: The drift parameter, equal to
theta*sqrt(information).
inflationFactor: The inflation factor (relative to the
fixed design).
numberOfSubjects: The maximum number of subjects.
expectedNumberOfSubjectsH1: The expected number of subjects
under H1.
expectedNumberOfSubjectsH0: The expected number of subjects
under H0.
pLarger: The probability that a randomly chosen sample from
the treatment group is larger than a randomly chosen sample from the
control group under the alternative hypothesis.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
rejectPerStageH0: The probability for efficacy stopping
under H0.
futilityPerStageH0: The probability for futility stopping
under H0.
cumulativeRejectionH0: The cumulative probability for
efficacy stopping under H0.
cumulativeFutilityH0: The cumulative probability for futility
stopping under H0.
efficacyPLarger: The efficacy boundaries on the proportion
of pairs of samples from the two treatment groups with the sample
from the treatment group greater than that from the control group.
futilityPLarger: The futility boundaries on the proportion
of pairs of samples from the two treatment groups with the sample
from the treatment group greater than that from the control group.
numberOfSubjects: The number of subjects.
settings: A list containing the following input parameters:
typeAlphaSpending: The type of alpha spending.
parameterAlphaSpending: The parameter value for alpha
spending.
userAlphaSpending: The user defined alpha spending.
typeBetaSpending: The type of beta spending.
parameterBetaSpending: The parameter value for beta spending.
userBetaSpending: The user defined beta spending.
spendingTime: The error spending time at each analysis.
allocationRatioPlanned: Allocation ratio for the active
treatment versus control.
rounding: Whether to round up sample size.
Kaifeng Lu, [email protected]
# Example 1: fixed design (design1 <- getDesignWilcoxon( beta = 0.1, n = NA, pLarger = pnorm((8 - 2)/sqrt(2*25^2)), alpha = 0.025)) # Example 2: group sequential design (design2 <- getDesignWilcoxon( beta = 0.1, n = NA, pLarger = pnorm((8 - 2)/sqrt(2*25^2)), alpha = 0.025, kMax = 3, typeAlphaSpending = "sfOF"))# Example 1: fixed design (design1 <- getDesignWilcoxon( beta = 0.1, n = NA, pLarger = pnorm((8 - 2)/sqrt(2*25^2)), alpha = 0.025)) # Example 2: group sequential design (design2 <- getDesignWilcoxon( beta = 0.1, n = NA, pLarger = pnorm((8 - 2)/sqrt(2*25^2)), alpha = 0.025, kMax = 3, typeAlphaSpending = "sfOF"))
Obtains a range of accrual duration to reach the target number of events.
getDurationFromNevents( nevents = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, followupTime = NA_real_, fixedFollowup = FALSE, npoints = 23L )getDurationFromNevents( nevents = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, followupTime = NA_real_, fixedFollowup = FALSE, npoints = 23L )
nevents |
The target number of events. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
followupTime |
Follow-up time for the last enrolled subjects. Must be provided for fixed follow-up design. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
npoints |
The number of accrual duration time points. Defaults to 23. |
A data frame of the following variables:
nevents: The target number of events.
fixedFollowup: Whether a fixed follow-up design is used.
accrualDuration: The accrual duration.
subjects: The total number of subjects.
followupTime: The follow-up time for the last enrolled subject.
studyDuration: The study duration.
Kaifeng Lu, [email protected]
# Piecewise accrual, piecewise exponential survivals, and 5% dropout by # the end of 1 year. getDurationFromNevents( nevents = 80, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, fixedFollowup = FALSE)# Piecewise accrual, piecewise exponential survivals, and 5% dropout by # the end of 1 year. getDurationFromNevents( nevents = 80, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, fixedFollowup = FALSE)
Obtains the required number of events given the hazard ratios under the null and alternative hypotheses for a group sequential design.
getNeventsFromHazardRatio( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityHR = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_, hazardRatioH0 = 1, hazardRatio = NA_real_, allocationRatioPlanned = 1, rounding = TRUE )getNeventsFromHazardRatio( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityHR = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, spendingTime = NA_real_, hazardRatioH0 = 1, hazardRatio = NA_real_, allocationRatioPlanned = 1, rounding = TRUE )
beta |
Type II error. Defaults to 0.2. |
kMax |
The maximum number of stages. |
informationRates |
The information rates in terms of number of
events. Fixed prior to the trial. Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilityHR |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
spendingTime |
A vector of length |
hazardRatioH0 |
Hazard ratio under the null hypothesis for the active treatment versus control. Defaults to 1 for superiority test. |
hazardRatio |
Hazard ratio under the alternative hypothesis for the active treatment versus control. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
rounding |
Whether to round up the number of events. Defaults to 1 for rounding. |
The required number of events.
Kaifeng Lu, [email protected]
getNeventsFromHazardRatio( beta = 0.2, kMax = 2, informationRates = c(0.5,1), alpha = 0.025, typeAlphaSpending = "sfOF", typeBetaSpending = "sfP", hazardRatio = 0.673)getNeventsFromHazardRatio( beta = 0.2, kMax = 2, informationRates = c(0.5,1), alpha = 0.025, typeAlphaSpending = "sfOF", typeBetaSpending = "sfP", hazardRatio = 0.673)
Obtains the repeated confidence interval for a group sequential trial.
getRCI( L = NA_integer_, zL = NA_real_, IMax = NA_real_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_ )getRCI( L = NA_integer_, zL = NA_real_, IMax = NA_real_, informationRates = NA_real_, efficacyStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, spendingTime = NA_real_ )
L |
The look of interest. |
zL |
The z-test statistic at the look. |
IMax |
The maximum information of the trial. |
informationRates |
The information rates up to look |
efficacyStopping |
Indicators of whether efficacy stopping is
allowed at each stage up to look |
criticalValues |
The upper boundaries on the z-test statistic scale
for efficacy stopping up to look |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending for the trial.
One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
spendingTime |
The error spending time up to look |
A data frame with the following components:
pvalue: Repeated p-value for rejecting the null hypothesis.
thetahat: Point estimate of the parameter.
cilevel: Confidence interval level.
lower: Lower bound of repeated confidence interval.
upper: Upper bound of repeated confidence interval.
If typeAlphaSpending is "OF", "P", "WT", or
"none", then informationRates, efficacyStopping,
and spendingTime must be of full length kMax, and
informationRates and spendingTime must end with 1.
Kaifeng Lu, [email protected]
Christopher Jennison and Bruce W. Turnbull. Interim analyses: the repeated confidence interval approach (with discussion). J R Stat Soc Series B. 1989;51:305-361.
# group sequential design with 90% power to detect delta = 6 delta <- 6 sigma <- 17 n <- 282 (des1 <- getDesign(IMax = n/(4*sigma^2), theta = delta, kMax = 3, alpha = 0.05, typeAlphaSpending = "sfHSD", parameterAlphaSpending = -4)) # results at the second look L <- 2 n1 <- n*2/3 delta1 <- 7 sigma1 <- 20 zL <- delta1/sqrt(4/n1*sigma1^2) # repeated confidence interval getRCI(L = L, zL = zL, IMax = n/(4*sigma1^2), informationRates = c(1/3, 2/3), alpha = 0.05, typeAlphaSpending = "sfHSD", parameterAlphaSpending = -4)# group sequential design with 90% power to detect delta = 6 delta <- 6 sigma <- 17 n <- 282 (des1 <- getDesign(IMax = n/(4*sigma^2), theta = delta, kMax = 3, alpha = 0.05, typeAlphaSpending = "sfHSD", parameterAlphaSpending = -4)) # results at the second look L <- 2 n1 <- n*2/3 delta1 <- 7 sigma1 <- 20 zL <- delta1/sqrt(4/n1*sigma1^2) # repeated confidence interval getRCI(L = L, zL = zL, IMax = n/(4*sigma1^2), informationRates = c(1/3, 2/3), alpha = 0.05, typeAlphaSpending = "sfHSD", parameterAlphaSpending = -4)
Computes the hazard function of a piecewise exponential distribution for progressive disease (PD), such that the resulting hazard function for progression-free survival (PFS) closely matches a given piecewise hazard for PFS.
hazard_pd( piecewiseSurvivalTime = 0L, hazard_pfs = NA_real_, hazard_os = NA_real_, rho_pd_os = 0.5 )hazard_pd( piecewiseSurvivalTime = 0L, hazard_pfs = NA_real_, hazard_os = NA_real_, rho_pd_os = 0.5 )
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
hazard_pfs |
A scalar or numeric vector specifying the hazard(s) for PFS based on a piecewise exponential distribution. |
hazard_os |
A scalar or numeric vector specifying the hazard(s) for overall survival (OS) based on a piecewise exponential distribution. |
rho_pd_os |
A numeric value specifying the correlation between PD and OS times. |
This function determines the hazard vector
for the piecewise exponential distribution of PD, so that the
implied survival function for PFS time,
, closely
matches the specified piecewise exponential distribution for PFS
with hazard vector .
To achieve this, we simulate
from
a standard bivariate normal distribution with correlation
. Then,
and are generated, where
denotes the standard normal CDF.
The times to PD and OS are obtained via the inverse transform method using quantile functions of the piecewise exponential distribution:
where u = piecewiseSurvivalTime.
The function solves for such that
the survival function of closely matches that
of a piecewise exponential distribution with hazard
:
Since
and
we have
while
Matching is performed sequentially at the internal cut points
and at the point
for the final interval,
as well as the percentile points at 10%, 20%, ..., 90%, and 95%
to solve for , where is the total number of
unique cut points.
A list with the following components:
piecewiseSurvivalTime: A vector that specifies the starting time
points of the intervals for the piecewise exponential distribution
for PD.
hazard_pd: A numeric vector representing the calculated hazard
rates for the piecewise exponential distribution of PD.
hazard_os: A numeric vector representing the hazard rates for
the piecewise exponential distribution of OS at the same time points
as PD.
rho_pd_os: The correlation between PD and OS times (as input).
Kaifeng Lu ([email protected])
u <- c(0, 1, 3, 4) lambda1 <- c(0.0151, 0.0403, 0.0501, 0.0558) lambda2 <- 0.0145 rho_pd_os <- 0.5 hazard_pd(u, lambda1, lambda2, rho_pd_os)u <- c(0, 1, 3, 4) lambda1 <- c(0.0151, 0.0403, 0.0501, 0.0558) lambda2 <- 0.0145 rho_pd_os <- 0.5 hazard_pd(u, lambda1, lambda2, rho_pd_os)
Computes the hazard function of a piecewise exponential distribution for the biomarker negative sub population, such that the resulting survival function for the ITT population closely matches a given piecewise survival function.
hazard_sub( piecewiseSurvivalTime = 0L, hazard_itt = NA_real_, hazard_pos = NA_real_, p_pos = NA_real_ )hazard_sub( piecewiseSurvivalTime = 0L, hazard_itt = NA_real_, hazard_pos = NA_real_, p_pos = NA_real_ )
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
hazard_itt |
A scalar or numeric vector specifying the hazard(s) for the ITT population based on a piecewise exponential distribution. |
hazard_pos |
A scalar or numeric vector specifying the hazard(s) for the biomarker positive sub population based on a piecewise exponential distribution. |
p_pos |
A numeric value specifying the prevalence of the biomarker positive sub population. |
This function determines the hazard vector
for the piecewise exponential distribution of the biomarker negative
sub population, so that the implied survival function for the ITT
population closely matches the specified piecewise exponential
distribution with hazard vector .
Let be the
prevalence of the biomarker positive sub population,
then the survival function for the ITT population is given by
where and are
the survival functions for the biomarker positive and
biomarker negative sub populations, respectively.
Matching is performed sequentially at the internal cutpoints
and at the point
for the final interval,
as well as the percentile points at 10%, 20%, ..., 90%, and 95%,
to solve for , where is the total number of
unique cut points.
A list with the following components:
piecewiseSurvivalTime: A vector that specifies the starting time
points of the intervals for the piecewise exponential distribution
for the biomarker negative sub population.
hazard_pos: A numeric vector representing the hazard rates for
the piecewise exponential distribution of the biomarker positive
sub population at the same time points as the biomarker negative
sub population.
hazard_neg: A numeric vector representing the estimated hazard
rates for the piecewise exponential distribution of the biomarker
negative sub population.
p_pos: The prevalence of the biomarker positive sub population
(as input).
Kaifeng Lu ([email protected])
u <- c(0, 1, 3, 4) lambda_itt <- c(0.0151, 0.0403, 0.0501, 0.0558) lambda_pos <- c(0.0115, 0.0302, 0.0351, 0.0404) p_pos <- 0.3 hazard_sub(u, lambda_itt, lambda_pos, p_pos)u <- c(0, 1, 3, 4) lambda_itt <- c(0.0151, 0.0403, 0.0501, 0.0558) lambda_pos <- c(0.0115, 0.0302, 0.0351, 0.0404) p_pos <- 0.3 hazard_sub(u, lambda_itt, lambda_pos, p_pos)
Survival of patients on the waiting list for the Stanford heart transplant program.
start, stop, evententry and exit time and status for the time interval
ageage-48 years
yearyear of acceptance (in years after Nov 1, 1967)
surgeryprior bypass surgery 1=yes, 0=no
transplantreceived transplant 1=yes, 0=no
idpatient id
heartheart
An object of class data.frame with 172 rows and 8 columns.
Obtains Hedges' g estimate and confidence interval of effect size.
hedgesg(tstat, m, ntilde, cilevel = 0.95)hedgesg(tstat, m, ntilde, cilevel = 0.95)
tstat |
The value of the t-test statistic for comparing two treatment conditions. |
m |
The degrees of freedom for the t-test. |
ntilde |
The normalizing sample size to convert the
standardized treatment difference to the t-test statistic, i.e.,
|
cilevel |
The confidence interval level. Defaults to 0.95. |
Hedges' is an effect size measure commonly used in meta-analysis
to quantify the difference between two groups. It's an improvement
over Cohen's , particularly when dealing with small sample sizes.
The formula for Hedges' is
where
is Cohen's effect size estimate, and is the bias
correction factor,
Since , Cohen's overestimates the true effect size,
Since
we have
where
has a noncentral distribution with degrees of freedom
and noncentrality parameter .
The asymptotic variance of can be approximated by
The confidence interval for
can be constructed using normal approximation.
For two-sample mean difference with sample size for the
treatment group and for the control group, we have
and
for pooled variance estimate.
A data frame with the following variables:
tstat: The value of the t test statistic.
m: The degrees of freedom for the t-test.
ntilde: The normalizing sample size to convert the
standardized treatment difference to the t-test statistic.
g: Hedges' g effect size estimate.
varg: Variance of g.
lower: The lower confidence limit for effect size.
upper: The upper confidence limit for effect size.
cilevel: The confidence interval level.
Kaifeng Lu, [email protected]
Larry V. Hedges. Distribution theory for Glass's estimator of effect size and related estimators. Journal of Educational Statistics 1981; 6:107-128.
n1 = 7 n2 = 8 meanDiff = 0.444 stDev = 1.201 m = n1+n2-2 ntilde = n1*n2/(n1+n2) tstat = sqrt(ntilde)*meanDiff/stDev hedgesg(tstat, m, ntilde)n1 = 7 n2 = 8 meanDiff = 0.444 stDev = 1.201 m = n1+n2-2 ntilde = n1*n2/(n1+n2) tstat = sqrt(ntilde)*meanDiff/stDev hedgesg(tstat, m, ntilde)
Patients were randomly assigned to receive treatment immediately or deferred, and those in the deferred arm could cross over and receive treatment. The primary endpoint was time to disease progression.
idPatient identification number
defIndicator that the participant was assigned to the deferred treatment arm
immIndicator that the participant was assigned to the immediate treatment arm
censyrsThe censoring time, in years, corresponding to the close of study minus the time of entry for each patient
xoIndicator that crossover occurred
xoyrsThe time, in years, from entry to switching, or 0 for patients in the immediate arm
progIndicator of disease progression (1), or censoring (0)
progyrsTime, in years, from entry to disease progression or censoring
entryThe time of entry into the study, measured in years from the date of randomisation
immdefimmdef
An object of class data.frame with 1000 rows and 9 columns.
The dataset consits of the number of ingots not ready for rolling and the number of ingots ready for rolling for a number of combinations of heating time and soaking time.
ingotsingots
An object of class tbl_df (inherits from tbl, data.frame) with 25 rows and 4 columns.
HeatThe heating time
SoakThe soaking time
NotReadyResponse indicator, with a value 1 for units not ready for rolling (event) and a value of 0 for units ready for rolling (nonevent)
FreqThe frequency of occurrence of each combination of
Heat, Soak, and NotReady
Obtains the estimate of milestone survival difference between two treatment groups.
kmdiff( data, stratum = "", treat = "treat", time = "time", time2 = "", event = "event", weight = "", milestone = 0, survDiffH0 = 0, conflev = 0.95 )kmdiff( data, stratum = "", treat = "treat", time = "time", time2 = "", event = "event", weight = "", milestone = 0, survDiffH0 = 0, conflev = 0.95 )
data |
The input data frame that contains the following variables:
|
stratum |
The name of the stratum variable in the input data. |
treat |
The name of the treatment variable in the input data. |
time |
The name of the time variable or the left end of each interval for counting process data in the input data. |
time2 |
The name of the right end of each interval for counting process data in the input data. |
event |
The name of the event variable in the input data. |
weight |
The name of the weight variable in the input data. |
milestone |
The milestone time at which to calculate the survival probability. |
survDiffH0 |
The difference in milestone survival probabilities under the null hypothesis. Defaults to 0 for superiority test. |
conflev |
The level of the two-sided confidence interval for the difference in milestone survival probabilities. Defaults to 0.95. |
A data frame with the following variables:
milestone: The milestone time relative to randomization.
survDiffH0: The difference in milestone survival probabilities
under the null hypothesis.
surv1: The estimated milestone survival probability for
the treatment group.
surv2: The estimated milestone survival probability for
the control group.
survDiff: The estimated difference in milestone survival
probabilities.
vsurv1: The variance for surv1.
vsurv2: The variance for surv2.
sesurvDiff: The standard error for survDiff.
survDiffZ: The Z-statistic value.
survDiffPValue: The two-sided p-value.
lower: The lower bound of confidence interval.
upper: The upper bound of confidence interval.
conflev: The level of confidence interval.
Kaifeng Lu, [email protected]
kmdiff(data = rawdata[rawdata$iterationNumber == 1, ], stratum = "stratum", treat = "treatmentGroup", time = "timeUnderObservation", event = "event", milestone = 12)kmdiff(data = rawdata[rawdata$iterationNumber == 1, ], stratum = "stratum", treat = "treatmentGroup", time = "timeUnderObservation", event = "event", milestone = 12)
Obtains the Kaplan-Meier estimates of the survival curve.
kmest( data, stratum = "", time = "time", time2 = "", event = "event", weight = "", conftype = "log-log", conflev = 0.95, keep_censor = FALSE )kmest( data, stratum = "", time = "time", time2 = "", event = "event", weight = "", conftype = "log-log", conflev = 0.95, keep_censor = FALSE )
data |
The input data frame that contains the following variables:
|
stratum |
The name(s) of the stratum variable(s) in the input data. |
time |
The name of the time variable or the left end of each interval for counting process data in the input data. |
time2 |
The name of the right end of each interval for counting process data in the input data. |
event |
The name of the event variable in the input data. |
weight |
The name of the weight variable in the input data. |
conftype |
The type of the confidence interval. One of "none", "plain", "log", "log-log" (the default), or "arcsin". The arcsin option bases the intervals on asin(sqrt(survival)). |
conflev |
The level of the two-sided confidence interval for the survival probabilities. Defaults to 0.95. |
keep_censor |
Whether to retain the censoring time in the output data frame. |
A data frame with the following variables:
size: The number of subjects in the stratum.
time: The event time.
nrisk: The number of subjects at risk.
nevent: The number of subjects having the event.
ncensor: The number of censored subjects.
surv: The Kaplan-Meier estimate of the survival probability.
sesurv: The standard error of the estimated survival
probability based on the Greendwood formula.
lower: The lower bound of confidence interval if requested.
upper: The upper bound of confidence interval if requested.
conflev: The level of confidence interval if requested.
conftype: The type of confidence interval if requested.
stratum: The stratum.
Kaifeng Lu, [email protected]
kmest(data = aml, stratum = "x", time = "time", event = "status")kmest(data = aml, stratum = "x", time = "time", event = "status")
Estimates the power for testing the difference in milestone survival probabilities in a two-sample survival design.
kmpower( kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilitySurvDiff = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, milestone = NA_real_, survDiffH0 = 0, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )kmpower( kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilitySurvDiff = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, milestone = NA_real_, survDiffH0 = 0, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilitySurvDiff |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
milestone |
The milestone time at which to calculate the survival probability. |
survDiffH0 |
The difference in milestone survival probabilities under the null hypothesis. Defaults to 0 for superiority test. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
studyDuration |
Study duration for fixed follow-up design.
Defaults to missing, which is to be replaced with the sum of
|
An S3 class kmpower object with 4 components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
numberOfEvents: The total number of events.
numberOfDropouts: The total number of dropouts.
numbeOfSubjects: The total number of subjects.
numberOfMilestone: The total number of subjects reaching
milestone.
studyDuration: The total study duration.
information: The maximum information.
expectedNumberOfEvents: The expected number of events.
expectedNumberOfDropouts: The expected number of dropouts.
expectedNumberOfSubjects: The expected number of subjects.
expectedNumberOfMilestone: The expected number of subjects
reaching milestone.
expectedStudyDuration: The expected study duration.
expectedInformation: The expected information.
accrualDuration: The accrual duration.
followupTime: The follow-up duration.
fixedFollowup: Whether a fixed follow-up design is used.
kMax: The number of stages.
milestone: The milestone time relative to randomization.
survDiffH0: The difference in milestone survival
probabilities under the null hypothesis.
surv1: The milestone survival probability for the
treatment group.
surv2: The milestone survival probability for the
control group.
survDiff: The difference in milestone survival
probabilities, equal to surv1 - surv2.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
numberOfEvents: The number of events.
numberOfDropouts: The number of dropouts.
numberOfSubjects: The number of subjects.
numberOfMilestone: The number of subjects reaching
milestone.
analysisTime: The average time since trial start.
efficacySurvDiff: The efficacy boundaries on the survival
difference scale.
futilitySurvDiff: The futility boundaries on the survival
difference scale.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
settings: A list containing the following input parameters:
typeAlphaSpending, parameterAlphaSpending,
userAlphaSpending, typeBetaSpending,
parameterBetaSpending, allocationRatioPlanned,
accrualTime, accuralIntensity,
piecewiseSurvivalTime, stratumFraction,
lambda1, lambda2, gamma1, gamma2,
and spendingTime.
byTreatmentCounts: A list containing the following counts by
treatment group:
numberOfEvents1: The number of events by stage for
the treatment group.
numberOfDropouts1: The number of dropouts by stage for
the treatment group.
numberOfSubjects1: The number of subjects by stage for
the treatment group.
numberOfMilestone1: The number of subjects reaching
milestone by stage for the active treatment group.
numberOfEvents2: The number of events by stage for
the control group.
numberOfDropouts2: The number of dropouts by stage for
the control group.
numberOfSubjects2: The number of subjects by stage for
the control group.
numberOfMilestone2: The number of subjects reaching
milestone by stage for the control group.
expectedNumberOfEvents1: The expected number of events for
the treatment group.
expectedNumberOfDropouts1: The expected number of dropouts
for the active treatment group.
expectedNumberOfSubjects1: The expected number of subjects
for the active treatment group.
expectedNumberOfMilestone1: The expected number of subjects
reaching milestone for the active treatment group.
expectedNumberOfEvents2: The expected number of events for
control group.
expectedNumberOfDropouts2: The expected number of dropouts
for the control group.
expectedNumberOfSubjects2: The expected number of subjects
for the control group.
expectedNumberOfMilestone2: The expected number of subjects
reaching milestone for the control group.
Kaifeng Lu, [email protected]
# Piecewise accrual, piecewise exponential survival, and 5% dropout by # the end of 1 year. kmpower(kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)# Piecewise accrual, piecewise exponential survival, and 5% dropout by # the end of 1 year. kmpower(kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)
Estimates the power, stopping probabilities, and expected sample size in a one-group survival design.
kmpower1s( kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilitySurv = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, milestone = NA_real_, survH0 = NA_real_, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda = NA_real_, gamma = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )kmpower1s( kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilitySurv = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, milestone = NA_real_, survH0 = NA_real_, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda = NA_real_, gamma = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilitySurv |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
milestone |
The milestone time at which to calculate the survival probability. |
survH0 |
The milestone survival probability under the null hypothesis. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda |
A vector of hazard rates for the event in each analysis time interval by stratum under the alternative hypothesis. |
gamma |
The hazard rate for exponential dropout or a vector of hazard rates for piecewise exponential dropout. Defaults to 0 for no dropout. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
studyDuration |
Study duration for fixed follow-up design.
Defaults to missing, which is to be replaced with the sum of
|
An S3 class kmpower1s object with 3 components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
numberOfEvents: The total number of events.
numbeOfSubjects: The total number of subjects.
numberOfMilestone: The total number of subjects reaching
milestone.
studyDuration: The total study duration.
information: The maximum information.
expectedNumberOfEvents: The expected number of events.
expectedNumberOfSubjects: The expected number of subjects.
expectedNumberOfMilestone: The expected number of subjects
reaching milestone.
expectedStudyDuration: The expected study duration.
expectedInformation: The expected information.
accrualDuration: The accrual duration.
followupTime: The follow-up duration.
fixedFollowup: Whether a fixed follow-up design is used.
kMax: The number of stages.
milestone: The milestone time to calculate the survival
probability.
survH0: The milestone survival probability under the null
hypothesis.
surv: The milestone survival probability under the
alternative hypothesis.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
numberOfEvents: The number of events.
numberOfDropouts: The number of dropouts.
numberOfSubjects: The number of subjects.
numberOfMilestone: The number of subjects reaching
milestone.
analysisTime: The average time since trial start.
efficacySurv: The efficacy boundaries on the milestone
survival probability scale.
futilitySurv: The futility boundaries on the milestone
survival probability scale.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
settings: A list containing the following input parameters:
typeAlphaSpending, parameterAlphaSpending,
userAlphaSpending, typeBetaSpending,
parameterBetaSpending, accrualTime,
accuralIntensity, piecewiseSurvivalTime,
stratumFraction, lambda, gamma,
and spendingTime.
Kaifeng Lu, [email protected]
kmpower1s(kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, survH0 = 0.30, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)kmpower1s(kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, survH0 = 0.30, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)
Obtains the power for equivalence in milestone survival probability difference.
kmpowerequiv( kMax = 1L, informationRates = NA_real_, criticalValues = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, milestone = NA_real_, survDiffLower = NA_real_, survDiffUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )kmpowerequiv( kMax = 1L, informationRates = NA_real_, criticalValues = NA_real_, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, milestone = NA_real_, survDiffLower = NA_real_, survDiffUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
milestone |
The milestone time at which to calculate the survival probability. |
survDiffLower |
The lower equivalence limit of milestone survival probability difference. |
survDiffUpper |
The upper equivalence limit of milestone survival probability difference. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
studyDuration |
Study duration for fixed follow-up design.
Defaults to missing, which is to be replaced with the sum of
|
An S3 class kmpowerequiv object with 4 components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
numberOfEvents: The total number of events.
numberOfSubjects: The total number of subjects.
studyDuration: The total study duration.
information: The maximum information.
expectedNumberOfEvents: The expected number of events.
expectedNumberOfSubjects: The expected number of subjects.
expectedStudyDuration: The expected study duration.
expectedInformation: The expected information.
kMax: The number of stages.
milestone: The milestone time relative to randomization.
survDiffLower: The lower equivalence limit of milestone
survival probability difference.
survDiffUpper: The upper equivalence limit of milestone
survival probability difference.
surv1: The milestone survival probability for the
treatment group.
surv2: The milestone survival probability for the
control group.
survDiff: The milestone survival probability difference.
accrualDuration: The accrual duration.
followupTime: The follow-up duration.
fixedFollowup: Whether a fixed follow-up design is used.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale for
each of the two one-sided tests.
rejectPerStage: The probability for efficacy stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeAlphaSpent: The cumulative alpha for each of
the two one-sided tests.
cumulativeAttainedAlphaH10: The cumulative alpha attained
under H10.
cumulativeAttainedAlphaH20: The cumulative alpha attained
under H20.
numberOfEvents: The number of events.
numberOfDropouts: The number of dropouts.
numberOfSubjects: The number of subjects.
numberOfMilestone: The number of subjects reaching
milestone.
analysisTime: The average time since trial start.
efficacySurvDiffLower: The efficacy boundaries on the
milestone survival probability difference scale for the one-sided
null hypothesis at the lower equivalence limit.
efficacySurvDiffUpper: The efficacy boundaries on the
milestone survival probability difference scale for the one-sided
null hypothesis at the upper equivalence limit.
efficacyP: The efficacy bounds on the p-value scale for
each of the two one-sided tests.
information: The cumulative information.
settings: A list containing the following input parameters:
typeAlphaSpending, parameterAlphaSpending,
userAlphaSpending, allocationRatioPlanned,
accrualTime, accuralIntensity,
piecewiseSurvivalTime, stratumFraction,
lambda1, lambda2, gamma1, gamma2,
and spendingTime.
byTreatmentCounts: A list containing the following counts by
treatment group:
numberOfEvents1: The number of events by stage for
the treatment group.
numberOfDropouts1: The number of dropouts by stage for
the treatment group.
numberOfSubjects1: The number of subjects by stage for
the treatment group.
numberOfMilestone1: The number of subjects reaching
milestone by stage for the active treatment group.
numberOfEvents2: The number of events by stage for
the control group.
numberOfDropouts2: The number of dropouts by stage for
the control group.
numberOfSubjects2: The number of subjects by stage for
the control group.
numberOfMilestone2: The number of subjects reaching
milestone by stage for the control group.
expectedNumberOfEvents1: The expected number of events for
the treatment group.
expectedNumberOfDropouts1: The expected number of dropouts
for the active treatment group.
expectedNumberOfSubjects1: The expected number of subjects
for the active treatment group.
expectedNumberOfMilestone1: The expected number of subjects
reaching milestone for the active treatment group.
expectedNumberOfEvents2: The expected number of events for
control group.
expectedNumberOfDropouts2: The expected number of dropouts
for the control group.
expectedNumberOfSubjects2: The expected number of subjects
for the control group.
expectedNumberOfMilestone2: The expected number of subjects
reaching milestone for the control group.
Kaifeng Lu, [email protected]
kmpowerequiv(kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", milestone = 18, survDiffLower = -0.13, survDiffUpper = 0.13, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)kmpowerequiv(kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", milestone = 18, survDiffLower = -0.13, survDiffUpper = 0.13, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)
Obtains the needed accrual duration given power, accrual intensity, and follow-up time, the needed follow-up time given power, accrual intensity, and accrual duration, or the needed absolute accrual intensity given power, relative accrual intensity, accrual duration, and follow-up time in a two-group survival design.
kmsamplesize( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilitySurvDiff = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, milestone = NA_real_, survDiffH0 = 0, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, rounding = TRUE )kmsamplesize( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilitySurvDiff = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, milestone = NA_real_, survDiffH0 = 0, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, rounding = TRUE )
beta |
Type II error. Defaults to 0.2. |
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilitySurvDiff |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
milestone |
The milestone time at which to calculate the survival probability. |
survDiffH0 |
The difference in milestone survival probabilities under the null hypothesis. Defaults to 0 for superiority test. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
A list of two components:
resultsUnderH1: An S3 class kmpower object under the
alternative hypothesis.
resultsUnderH0: An S3 class kmpower object under the
null hypothesis.
Kaifeng Lu, [email protected]
# Example 1: Obtains follow-up time given power, accrual intensity, # and accrual duration for variable follow-up. Of note, the power # reaches the maximum when the follow-up time equals milestone. kmsamplesize(beta = 0.25, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = NA, fixedFollowup = FALSE) # Example 2: Obtains accrual intensity given power, accrual duration, and # follow-up time for variable follow-up kmsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE) # Example 3: Obtains accrual duration given power, accrual intensity, and # follow-up time for fixed follow-up kmsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = TRUE)# Example 1: Obtains follow-up time given power, accrual intensity, # and accrual duration for variable follow-up. Of note, the power # reaches the maximum when the follow-up time equals milestone. kmsamplesize(beta = 0.25, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = NA, fixedFollowup = FALSE) # Example 2: Obtains accrual intensity given power, accrual duration, and # follow-up time for variable follow-up kmsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE) # Example 3: Obtains accrual duration given power, accrual intensity, and # follow-up time for fixed follow-up kmsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = TRUE)
Obtains the needed accrual duration given power and follow-up time, the needed follow-up time given power and accrual duration, or the needed absolute accrual rates given power, accrual duration, follow-up duration, and relative accrual rates in a one-group survival design.
kmsamplesize1s( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilitySurv = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, milestone = NA_real_, survH0 = NA_real_, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda = NA_real_, gamma = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, rounding = TRUE )kmsamplesize1s( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilitySurv = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, milestone = NA_real_, survH0 = NA_real_, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda = NA_real_, gamma = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, rounding = TRUE )
beta |
Type II error. Defaults to 0.2. |
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilitySurv |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
milestone |
The milestone time at which to calculate the survival probability. |
survH0 |
The milestone survival probability under the null hypothesis. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda |
A vector of hazard rates for the event in each analysis time interval by stratum under the alternative hypothesis. |
gamma |
The hazard rate for exponential dropout or a vector of hazard rates for piecewise exponential dropout. Defaults to 0 for no dropout. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
A list of two components:
resultsUnderH1: An S3 class kmpower1s object under the
alternative hypothesis.
resultsUnderH0: An S3 class kmpower1s object under the
null hypothesis.
Kaifeng Lu, [email protected]
# Example 1: Obtains follow-up duration given power, accrual intensity, # and accrual duration for variable follow-up kmsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, survH0 = 0.30, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = 22, followupTime = NA, fixedFollowup = FALSE) # Example 2: Obtains accrual intensity given power, accrual duration, and # follow-up duration for variable follow-up kmsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, survH0 = 0.30, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE) # Example 3: Obtains accrual duration given power, accrual intensity, and # follow-up duration for fixed follow-up kmsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, survH0 = 0.30, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = TRUE)# Example 1: Obtains follow-up duration given power, accrual intensity, # and accrual duration for variable follow-up kmsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, survH0 = 0.30, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = 22, followupTime = NA, fixedFollowup = FALSE) # Example 2: Obtains accrual intensity given power, accrual duration, and # follow-up duration for variable follow-up kmsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, survH0 = 0.30, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE) # Example 3: Obtains accrual duration given power, accrual intensity, and # follow-up duration for fixed follow-up kmsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, survH0 = 0.30, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = TRUE)
Obtains the sample size for equivalence in milestone survival probability difference.
kmsamplesizeequiv( beta = 0.2, kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, milestone = NA_real_, survDiffLower = NA_real_, survDiffUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = 0L, spendingTime = NA_real_, rounding = 1L )kmsamplesizeequiv( beta = 0.2, kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, milestone = NA_real_, survDiffLower = NA_real_, survDiffUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = 0L, spendingTime = NA_real_, rounding = 1L )
beta |
The type II error. |
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
milestone |
The milestone time at which to calculate the survival probability. |
survDiffLower |
The lower equivalence limit of milestone survival probability difference. |
survDiffUpper |
The upper equivalence limit of milestone survival probability difference. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
An S3 class kmpowerequiv object
Kaifeng Lu, [email protected]
kmsamplesizeequiv(beta = 0.1, kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", milestone = 18, survDiffLower = -0.13, survDiffUpper = 0.13, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = FALSE)kmsamplesizeequiv(beta = 0.1, kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", milestone = 18, survDiffLower = -0.13, survDiffUpper = 0.13, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = FALSE)
Obtains the stratified milestone survival probabilities and difference in milestone survival probabilities at given calendar times.
kmstat( time = NA_real_, milestone = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE )kmstat( time = NA_real_, milestone = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE )
time |
A vector of calendar times for data cut. |
milestone |
The milestone time at which to calculate the survival probability. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
A data frame containing the following variables:
time: The calendar time since trial start.
subjects: The number of enrolled subjects.
nevents: The total number of events.
nevents1: The number of events in the active treatment group.
nevents2: The number of events in the control group.
ndropouts: The total number of dropouts.
ndropouts1: The number of dropouts in the active treatment
group.
ndropouts2: The number of dropouts in the control group.
milestone: The milestone time relative to randomization.
nmilestone: The total number of subjects reaching milestone.
nmilestone1: The number of subjects reaching milestone
in the active treatment group.
nmiletone2: The number of subjects reaching milestone
in the control group.
surv1: The milestone survival probability for the treatment
group.
surv2: The milestone survival probability for the control group.
survDiff: The difference in milestone survival probabilities,
i.e., surv1 - surv2.
vsurv1: The variance for surv1.
vsurv2: The variance for surv2.
vsurvDiff: The variance for survDiff.
information: The information for survDiff, equal to
1/vsurvDiff.
survDiffZ: The Z-statistic value, i.e.,
survDiff/sqrt(vsurvDiff).
Kaifeng Lu, [email protected]
# Piecewise accrual, piecewise exponential survivals, and 5% dropout by # the end of 1 year. kmstat(time = c(22, 40), milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)# Piecewise accrual, piecewise exponential survivals, and 5% dropout by # the end of 1 year. kmstat(time = c(22, 40), milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)
Obtains the parameter estimates from parametric regression models with uncensored, right censored, left censored, or interval censored data.
liferegr( data, stratum = "", time = "time", time2 = "", event = "event", covariates = "", weight = "", offset = "", id = "", dist = "weibull", init = NA_real_, robust = FALSE, plci = FALSE, alpha = 0.05, maxiter = 50, eps = 1e-09 )liferegr( data, stratum = "", time = "time", time2 = "", event = "event", covariates = "", weight = "", offset = "", id = "", dist = "weibull", init = NA_real_, robust = FALSE, plci = FALSE, alpha = 0.05, maxiter = 50, eps = 1e-09 )
data |
The input data frame that contains the following variables:
|
stratum |
The name(s) of the stratum variable(s) in the input data. |
time |
The name of the time variable or the left end of each interval for interval censored data in the input data. |
time2 |
The name of the right end of each interval for interval censored data in the input data. |
event |
The name of the event variable in the input data for right censored data. |
covariates |
The vector of names of baseline covariates in the input data. |
weight |
The name of the weight variable in the input data. |
offset |
The name of the offset variable in the input data. |
id |
The name of the id variable in the input data. |
dist |
The assumed distribution for time to event. Options include "exponential", "weibull", "lognormal", and "loglogistic" to be modeled on the log-scale, and "normal" and "logistic" to be modeled on the original scale. |
init |
A vector of initial values for the model parameters, including regression coefficients and the log scale parameter. By default, initial values are derived from an intercept-only model. If this approach fails, ordinary least squares (OLS) estimates, ignoring censoring, are used instead. |
robust |
Whether a robust sandwich variance estimate should be computed. In the presence of the id variable, the score residuals will be aggregated for each id when computing the robust sandwich variance estimate. |
plci |
Whether to obtain profile likelihood confidence interval. |
alpha |
The two-sided significance level. |
maxiter |
The maximum number of iterations. |
eps |
The tolerance to declare convergence. |
There are two ways to specify the model, one for right censored data through the time and event variables, and the other for interval censored data through the time (lower) and time2 (upper) variables. For the second form, we follow the convention used in SAS PROC LIFEREG:
If lower is not missing, upper is not missing, and lower is equal to upper, then there is no censoring and the event occurred at time lower.
If lower is not missing, upper is not missing, and lower < upper, then the event time is censored within the interval (lower, upper).
If lower is missing, but upper is not missing, then upper will be used as the left censoring value.
If lower is not missing, but upper is missing, then lower will be used as the right censoring value.
If lower is not missing, upper is not missing, but lower > upper, or if both lower and upper are missing, then the observation will not be used.
A list with the following components:
sumstat: The data frame of summary statistics of model fit
with the following variables:
n: The number of observations.
nevents: The number of events.
loglik0: The log-likelihood under null.
loglik1: The maximum log-likelihood.
niter: The number of Newton-Raphson iterations.
dist: The assumed distribution.
p: The number of parameters, including the intercept,
regression coefficients associated with the covariates, and
the log scale parameters for the strata.
nvar: The number of regression coefficients associated
with the covariates (excluding the intercept).
robust: Whether the robust sandwich variance estimate
is requested.
fail: Whether the model fails to converge.
parest: The data frame of parameter estimates with the
following variables:
param: The name of the covariate for the parameter estimate.
beta: The parameter estimate.
sebeta: The standard error of parameter estimate.
z: The Wald test statistic for the parameter.
expbeta: The exponentiated parameter estimate.
lower: The lower limit of confidence interval.
upper: The upper limit of confidence interval.
p: The p-value from the chi-square test.
method: The method to compute the confidence interval and
p-value.
sebeta_naive: The naive standard error of parameter estimate
if robust variance is requested.
linear_predictors: The vector of linear predictors.
p: The number of parameters.
nvar: The number of columns of the design matrix excluding
the intercept.
param: The parameter names.
beta: The parameter estimate.
vbeta: The covariance matrix for parameter estimates.
vbeta_naive: The naive covariance matrix for parameter estimates.
terms: The terms object.
xlevels: A record of the levels of the factors used in fitting.
settings: A list containing the input parameter values.
Kaifeng Lu, [email protected]
John D. Kalbfleisch and Ross L. Prentice. The Statistical Analysis of Failure Time Data. Wiley: New York, 1980.
library(dplyr) # right censored data (fit1 <- liferegr( data = rawdata %>% filter(iterationNumber == 1) %>% mutate(treat = (treatmentGroup == 1)), stratum = "stratum", time = "timeUnderObservation", event = "event", covariates = "treat", dist = "weibull")) # tobit regression for left censored data (fit2 <- liferegr( data = tobin %>% mutate(time = ifelse(durable>0, durable, NA)), time = "time", time2 = "durable", covariates = c("age", "quant"), dist = "normal"))library(dplyr) # right censored data (fit1 <- liferegr( data = rawdata %>% filter(iterationNumber == 1) %>% mutate(treat = (treatmentGroup == 1)), stratum = "stratum", time = "timeUnderObservation", event = "event", covariates = "treat", dist = "weibull")) # tobit regression for left censored data (fit2 <- liferegr( data = tobin %>% mutate(time = ifelse(durable>0, durable, NA)), time = "time", time2 = "durable", covariates = c("age", "quant"), dist = "normal"))
This data set contains information on 418 patients with primary biliary cirrhosis.
liverliver
An object of class tbl_df (inherits from tbl, data.frame) with 418 rows and 7 columns.
TimeThe follow-up time in years from the time of registration. The event could be liver transplantation, death, or the end of the study, whichever came first
StatusA censoring indicator, where a value of 1 indicating a death event, and 0 indicating a censored observation (the patient survived past the observation time)
AgeThe patient's age in years
AlbuminSerum albumin level in g/dl
BilirubinSerum bilirubin level in mg/dl
EdemaEdema status, where a value of 0 indicates no edema, 0.5 indicates edema successfully treated with diuretics, and 1 indicates edema despite diuretic therapy
ProtimeProthrombin time in seconds
Obtains the parameter estimates from logistic regression models with binary data.
logisregr( data, event = "event", covariates = "", freq = "", weight = "", offset = "", id = "", link = "logit", init = NA_real_, robust = FALSE, firth = FALSE, flic = FALSE, plci = FALSE, alpha = 0.05, maxiter = 50, eps = 1e-09 )logisregr( data, event = "event", covariates = "", freq = "", weight = "", offset = "", id = "", link = "logit", init = NA_real_, robust = FALSE, firth = FALSE, flic = FALSE, plci = FALSE, alpha = 0.05, maxiter = 50, eps = 1e-09 )
data |
The input data frame that contains the following variables:
|
event |
The name of the event variable in the input data. |
covariates |
The vector of names of baseline covariates in the input data. |
freq |
The name of the frequency variable in the input data. The frequencies must be the same for all observations within each cluster as indicated by the id. Thus freq is the cluster frequency. |
weight |
The name of the weight variable in the input data. |
offset |
The name of the offset variable in the input data. |
id |
The name of the id variable in the input data. |
link |
The link function linking the response probabilities to the linear predictors. Options include "logit" (default), "probit", and "cloglog" (complementary log-log). |
init |
A vector of initial values for the model parameters. By default, initial values are derived from an intercept-only model. |
robust |
Whether a robust sandwich variance estimate should be computed. In the presence of the id variable, the score residuals will be aggregated for each id when computing the robust sandwich variance estimate. |
firth |
Whether the firth's bias reducing penalized likelihood
should be used. The default is |
flic |
Whether to apply intercept correction to obtain more
accurate predicted probabilities. The default is |
plci |
Whether to obtain profile likelihood confidence interval. |
alpha |
The two-sided significance level. |
maxiter |
The maximum number of iterations. |
eps |
The tolerance to declare convergence. |
Fitting a logistic regression model using Firth's bias reduction method is equivalent to penalization of the log-likelihood by the Jeffreys prior. Firth's penalized log-likelihood is given by
and the components of the gradient are computed as
The Hessian matrix is not modified by this penalty.
Firth's method reduces bias in maximum likelihood estimates of coefficients, but it introduces a bias toward one-half in the predicted probabilities.
A straightforward modification to Firth’s logistic regression to achieve unbiased average predicted probabilities involves a post hoc adjustment of the intercept. This approach, known as Firth’s logistic regression with intercept correction (FLIC), preserves the bias-corrected effect estimates. By excluding the intercept from penalization, it ensures that we don't sacrifice the accuracy of effect estimates to improve the predictions.
A list with the following components:
sumstat: The data frame of summary statistics of model fit
with the following variables:
n: The number of subjects.
nevents: The number of events.
loglik0: The (penalized) log-likelihood under null.
loglik1: The maximum (penalized) log-likelihood.
niter: The number of Newton-Raphson iterations.
p: The number of parameters, including the intercept,
and regression coefficients associated with the covariates.
link: The link function.
robust: Whether a robust sandwich variance estimate should
be computed.
firth: Whether the firth's penalized likelihood is used.
flic: Whether to apply intercept correction.
fail: Whether the model fails to converge.
loglik0_unpenalized: The unpenalized log-likelihood under null.
loglik1_unpenalized: The maximum unpenalized log-likelihood.
parest: The data frame of parameter estimates with the
following variables:
param: The name of the covariate for the parameter estimate.
beta: The parameter estimate.
sebeta: The standard error of parameter estimate.
z: The Wald test statistic for the parameter.
expbeta: The exponentiated parameter estimate.
lower: The lower limit of confidence interval.
upper: The upper limit of confidence interval.
p: The p-value from the chi-square test.
method: The method to compute the confidence interval and
p-value.
sebeta_naive: The naive standard error of parameter estimate.
fitted: The data frame with the following variables:
linear_predictors: The linear fit on the link function scale.
fitted_values: The fitted probabilities of having an event,
obtained by transforming the linear predictors by the inverse of
the link function.
p: The number of parameters.
link: The link function.
param: The parameter names.
beta: The parameter estimate.
vbeta: The covariance matrix for parameter estimates.
vbeta_naive: The naive covariance matrix for parameter estimates.
linear_predictors: The linear fit on the link function scale.
fitted_values: The fitted probabilities of having an event.
terms: The terms object.
xlevels: A record of the levels of the factors used in fitting.
settings: A list containing the input parameter values.
Kaifeng Lu, [email protected]
David Firth. Bias Reduction of Maximum Likelihood Estimates. Biometrika 1993; 80:27–38.
Georg Heinze and Michael Schemper. A solution to the problem of separation in logistic regression. Statistics in Medicine 2002;21:2409–2419.
Rainer Puhr, Georg Heinze, Mariana Nold, Lara Lusa, and Angelika Geroldinger. Firth's logistic regression with rare events: accurate effect estimates and predictions? Statistics in Medicine 2017; 36:2302-2317.
(fit1 <- logisregr( ingots, event = "NotReady", covariates = "Heat*Soak", freq = "Freq"))(fit1 <- logisregr( ingots, event = "NotReady", covariates = "Heat*Soak", freq = "Freq"))
Estimates the power, stopping probabilities, and expected sample size in a two-group survival design.
lrpower( kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityHR = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, hazardRatioH0 = 1, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, typeOfComputation = "", spendingTime = NA_real_, studyDuration = NA_real_ )lrpower( kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityHR = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, hazardRatioH0 = 1, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, typeOfComputation = "", spendingTime = NA_real_, studyDuration = NA_real_ )
kMax |
The maximum number of stages. |
informationRates |
The information rates in terms of number
of events for the conventional log-rank test and in terms of
the actual information for weighted log-rank tests.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilityHR |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
hazardRatioH0 |
Hazard ratio under the null hypothesis for the active treatment versus control. Defaults to 1 for superiority test. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
rho1 |
The first parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
rho2 |
The second parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
typeOfComputation |
The type of computation,
either |
spendingTime |
A vector of length |
studyDuration |
Study duration for fixed follow-up design.
Defaults to missing, which is to be replaced with the sum of
|
An S3 class lrpower object with 4 components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
numberOfEvents: The total number of events.
numberOfDropouts: The total number of dropouts.
numbeOfSubjects: The total number of subjects.
studyDuration: The total study duration.
information: The maximum information.
expectedNumberOfEvents: The expected number of events.
expectedNumberOfDropouts: The expected number of dropouts.
expectedNumberOfSubjects: The expected number of subjects.
expectedStudyDuration: The expected study duration.
expectedInformation: The expected information.
accrualDuration: The accrual duration.
followupTime: The follow-up time.
fixedFollowup: Whether a fixed follow-up design is used.
rho1: The first parameter of the Fleming-Harrington family
of weighted log-rank test.
rho2: The second parameter of the Fleming-Harrington family
of weighted log-rank test.
kMax: The number of stages.
hazardRatioH0: The hazard ratio under the null hypothesis.
typeOfComputation: The type of computation,
either "direct" for the direct approximation method,
or "schoenfeld" for the Schoenfeld method.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
numberOfEvents: The number of events.
numberOfDropouts: The number of dropouts.
numberOfSubjects: The number of subjects.
analysisTime: The average time since trial start.
efficacyHR: The efficacy boundaries on the hazard ratio
scale.
futilityHR: The futility boundaries on the hazard ratio
scale.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
HR: The average hazard ratio.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
settings: A list containing the following input parameters:
typeAlphaSpending, parameterAlphaSpending,
userAlphaSpending, typeBetaSpending,
parameterBetaSpending, allocationRatioPlanned,
accrualTime, accuralIntensity,
piecewiseSurvivalTime, stratumFraction,
lambda1, lambda2, gamma1, gamma2,
and spendingTime.
byTreatmentCounts: A list containing the following counts by
treatment group:
numberOfEvents1: The number of events by stage for
the treatment group.
numberOfDropouts1: The number of dropouts by stage for
the treatment group.
numberOfSubjects1: The number of subjects by stage for
the treatment group.
numberOfEvents2: The number of events by stage for
the control group.
numberOfDropouts2: The number of dropouts by stage for
the control group.
numberOfSubjects2: The number of subjects by stage for
the control group.
expectedNumberOfEvents1: The expected number of events for
the treatment group.
expectedNumberOfDropouts1: The expected number of dropouts
for the treatment group.
expectedNumberOfSubjects1: The expected number of subjects
for the treatment group.
expectedNumberOfEvents2: The expected number of events for
control group.
expectedNumberOfDropouts2: The expected number of dropouts
for the control group.
expectedNumberOfSubjects2: The expected number of subjects
for the control group.
Kaifeng Lu, [email protected]
# Piecewise accrual, piecewise exponential survival, and 5% dropout by # the end of 1 year. lrpower(kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)# Piecewise accrual, piecewise exponential survival, and 5% dropout by # the end of 1 year. lrpower(kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)
Obtains the power for equivalence in hazard ratio.
lrpowerequiv( kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, hazardRatioLower = NA_real_, hazardRatioUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, typeOfComputation = "direct", spendingTime = NA_real_, studyDuration = NA_real_ )lrpowerequiv( kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, hazardRatioLower = NA_real_, hazardRatioUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, typeOfComputation = "direct", spendingTime = NA_real_, studyDuration = NA_real_ )
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
hazardRatioLower |
The lower equivalence limit of hazard ratio. |
hazardRatioUpper |
The upper equivalence limit of hazard ratio. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
typeOfComputation |
The type of computation,
either |
spendingTime |
A vector of length |
studyDuration |
Study duration for fixed follow-up design.
Defaults to missing, which is to be replaced with the sum of
|
An S3 class lrpowerequiv object with 4 components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
numberOfEvents: The total number of events.
numberOfDropouts: The total number of dropouts.
numbeOfSubjects: The total number of subjects.
studyDuration: The total study duration.
information: The maximum information.
expectedNumberOfEvents: The expected number of events.
expectedNumberOfDropouts: The expected number of dropouts.
expectedNumberOfSubjects: The expected number of subjects.
expectedStudyDuration: The expected study duration.
expectedInformation: The expected information.
kMax: The number of stages.
hazardRatioLower: The lower equivalence limit of hazard
ratio.
hazardRatioUpper: The upper equivalence limit of hazard
ratio.
accrualDuration: The accrual duration.
followupTime: The follow-up time.
fixedFollowup: Whether a fixed follow-up design is used.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale for
each of the two one-sided tests.
rejectPerStage: The probability for efficacy stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeAlphaSpent: The cumulative alpha for each of
the two one-sided tests.
cumulativeAttainedAlphaH10: The cumulative alpha attained
under H10.
cumulativeAttainedAlphaH20: The cumulative alpha attained
under H20.
numberOfEvents: The number of events.
numberOfDropouts: The number of dropouts.
numberOfSubjects: The number of subjects.
analysisTime: The average time since trial start.
efficacyHRLower: The efficacy boundaries on the
hazard ratio scale for the one-sided null hypothesis
at the lower equivalence limit.
efficacyHRUpper: The efficacy boundaries on the
hazard ratio scale for the one-sided null hypothesis
at the upper equivalence limit.
efficacyP: The efficacy bounds on the p-value scale for
each of the two one-sided tests.
information: The cumulative information.
HR: The average hazard ratio.
settings: A list containing the following input parameters:
typeAlphaSpending, parameterAlphaSpending,
userAlphaSpending, allocationRatioPlanned,
accrualTime, accuralIntensity,
piecewiseSurvivalTime, stratumFraction,
lambda1, lambda2, gamma1, gamma2,
typeOfComputation, and spendingTime.
byTreatmentCounts: A list containing the following counts by
treatment group:
numberOfEvents1: The number of events by stage for
the treatment group.
numberOfDropouts1: The number of dropouts by stage for
the treatment group.
numberOfSubjects1: The number of subjects by stage for
the treatment group.
numberOfEvents2: The number of events by stage for
the control group.
numberOfDropouts2: The number of dropouts by stage for
the control group.
numberOfSubjects2: The number of subjects by stage for
the control group.
expectedNumberOfEvents1: The expected number of events for
the treatment group.
expectedNumberOfDropouts1: The expected number of dropouts
for the treatment group.
expectedNumberOfSubjects1: The expected number of subjects
for the treatment group.
expectedNumberOfEvents2: The expected number of events for
control group.
expectedNumberOfDropouts2: The expected number of dropouts
for the control group.
expectedNumberOfSubjects2: The expected number of subjects
for the control group.
Kaifeng Lu, [email protected]
lrpowerequiv(kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", hazardRatioLower = 0.71, hazardRatioUpper = 1.4, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 100/9*seq(1, 9), lambda1 = 0.0533, lambda2 = 0.0533, gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)lrpowerequiv(kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", hazardRatioLower = 0.71, hazardRatioUpper = 1.4, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 100/9*seq(1, 9), lambda1 = 0.0533, lambda2 = 0.0533, gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)
Obtains the needed accrual duration given power and follow-up time, the needed follow-up time given power and accrual duration, or the needed absolute accrual rates given power, accrual duration, follow-up time, and relative accrual rates in a two-group survival design.
lrsamplesize( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityHR = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, hazardRatioH0 = 1, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, typeOfComputation = "", spendingTime = NA_real_, rounding = TRUE )lrsamplesize( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityHR = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, hazardRatioH0 = 1, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, typeOfComputation = "", spendingTime = NA_real_, rounding = TRUE )
beta |
Type II error. Defaults to 0.2. |
kMax |
The maximum number of stages. |
informationRates |
The information rates in terms of number
of events for the conventional log-rank test and in terms of
the actual information for weighted log-rank tests.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilityHR |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
hazardRatioH0 |
Hazard ratio under the null hypothesis for the active treatment versus control. Defaults to 1 for superiority test. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
rho1 |
The first parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
rho2 |
The second parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
typeOfComputation |
The type of computation,
either |
spendingTime |
A vector of length |
rounding |
Whether to round up sample size and events. Defaults to 1 for sample size rounding. |
A list of two components:
resultsUnderH1: An S3 class lrpower object under the
alternative hypothesis.
resultsUnderH0: An S3 class lrpower object under the
null hypothesis.
Kaifeng Lu, [email protected]
# Piecewise accrual, piecewise exponential survival, and 5% dropout by # the end of 1 year. # Example 1: Obtains accrual duration given power and follow-up time lrsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = FALSE) # Example 2: Obtains follow-up time given power and accrual duration lrsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = NA, fixedFollowup = FALSE) # Example 3: Obtains absolute accrual intensity given power, # accrual duration, follow-up time, and relative accrual intensity lrsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)# Piecewise accrual, piecewise exponential survival, and 5% dropout by # the end of 1 year. # Example 1: Obtains accrual duration given power and follow-up time lrsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = FALSE) # Example 2: Obtains follow-up time given power and accrual duration lrsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = NA, fixedFollowup = FALSE) # Example 3: Obtains absolute accrual intensity given power, # accrual duration, follow-up time, and relative accrual intensity lrsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)
Obtains the sample size for equivalence in hazard ratio.
lrsamplesizeequiv( beta = 0.2, kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, hazardRatioLower = NA_real_, hazardRatioUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, typeOfComputation = "direct", spendingTime = NA_real_, rounding = TRUE )lrsamplesizeequiv( beta = 0.2, kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, hazardRatioLower = NA_real_, hazardRatioUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, typeOfComputation = "direct", spendingTime = NA_real_, rounding = TRUE )
beta |
The type II error. |
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
hazardRatioLower |
The lower equivalence limit of hazard ratio. |
hazardRatioUpper |
The upper equivalence limit of hazard ratio. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
typeOfComputation |
The type of computation,
either |
spendingTime |
A vector of length |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
An S3 class lrpowerequiv object
Kaifeng Lu, [email protected]
lrsamplesizeequiv(kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", hazardRatioLower = 0.71, hazardRatioUpper = 1.4, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0533), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = FALSE)lrsamplesizeequiv(kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", hazardRatioLower = 0.71, hazardRatioUpper = 1.4, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0533), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = FALSE)
Obtains the sample size and study duration by calibrating the number of events calculated using the Schoenfeld formula under the proportional hazards assumption.
lrschoenfeld( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityHR = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, hazardRatioH0 = 1, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, hazardRatio = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, followupTime = NA_real_, fixedFollowup = 0L, spendingTime = NA_real_, rounding = 1L, calibrate = 1L, maxNumberOfIterations = 10000L, maxNumberOfRawDatasetsPerStage = 0L, seed = NA_integer_ )lrschoenfeld( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NA_real_, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NA_real_, futilityCP = NA_real_, futilityHR = NA_real_, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, hazardRatioH0 = 1, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, hazardRatio = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, followupTime = NA_real_, fixedFollowup = 0L, spendingTime = NA_real_, rounding = 1L, calibrate = 1L, maxNumberOfIterations = 10000L, maxNumberOfRawDatasetsPerStage = 0L, seed = NA_integer_ )
beta |
Type II error. Defaults to 0.2. |
kMax |
The maximum number of stages. |
informationRates |
The information rates in terms of number
of events for the conventional log-rank test and in terms of
the actual information for weighted log-rank tests.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilityHR |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
hazardRatioH0 |
Hazard ratio under the null hypothesis for the active treatment versus control. Defaults to 1 for superiority test. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
hazardRatio |
Hazard ratio under the alternative hypothesis for the active treatment versus control. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
rounding |
Whether to round up sample size and events. Defaults to 1 for sample size rounding. |
calibrate |
Whether to use simulations to calibrate the number of events calculated using the Schoenfeld formula. |
maxNumberOfIterations |
The number of simulation iterations. Defaults to 10000. |
maxNumberOfRawDatasetsPerStage |
The number of raw datasets per stage to extract. |
seed |
The seed to reproduce the simulation results. The seed from the environment will be used if left unspecified. |
This function calculates the sample size and study duration by calibrating the number of events estimated using the Schoenfeld formula under the proportional hazards assumption, particularly when the hazard ratio is far away from one and/or the allocation between groups is unequal.
For a fixed design, the Schoenfeld formula for the required number of events is
where is the total number of events required,
is the type I error rate,
is the type II error rate,
is the randomization probability for the active treatment group,
and are the log hazard ratios under
the null and alternative hypotheses, respectively.
The function first computes the number of events using the
Schoenfeld formula. If calibrate is set to 1, the
function uses simulations to calibrate the number of
events, accounting for scenarios where the Schoenfeld formula
may be inaccurate (e.g., when allocation is unequal or the hazard
ratio is extreme).
Let be the number of events calculated
by the Schoenfeld formula, and
be the calibrated number of events. The calibrated number of
events is calculated as
#'
where is the empirical type II error
estimated via simulation.
A second round of simulation is performed to obtain the empirical power using the calibrated number of events.
A list of two components:
analyticalResults: An S3 class lrpower object for
the asymptotic power.
simulationResults: An S3 class lrsim object for
the empirical power.
Kaifeng Lu, [email protected]
(lr1 <- lrschoenfeld( beta = 0.1, kMax = 2, alpha = 0.025, hazardRatioH0 = 1, allocationRatioPlanned = 1, accrualIntensity = 20, hazardRatio = 0.3, lambda2 = 1.9/12, gamma1 = -log(1-0.1)/24, gamma2 = -log(1-0.1)/24, fixedFollowup = 0, rounding = 1, calibrate = 0, maxNumberOfIterations = 1000, seed = 12345)) (lr2 <- lrschoenfeld( beta = 0.1, kMax = 2, alpha = 0.025, hazardRatioH0 = 1, allocationRatioPlanned = 1, accrualIntensity = 20, hazardRatio = 0.3, lambda2 = 1.9/12, gamma1 = -log(1-0.1)/24, gamma2 = -log(1-0.1)/24, fixedFollowup = 0, rounding = 1, calibrate = 1, maxNumberOfIterations = 1000, seed = 12345))(lr1 <- lrschoenfeld( beta = 0.1, kMax = 2, alpha = 0.025, hazardRatioH0 = 1, allocationRatioPlanned = 1, accrualIntensity = 20, hazardRatio = 0.3, lambda2 = 1.9/12, gamma1 = -log(1-0.1)/24, gamma2 = -log(1-0.1)/24, fixedFollowup = 0, rounding = 1, calibrate = 0, maxNumberOfIterations = 1000, seed = 12345)) (lr2 <- lrschoenfeld( beta = 0.1, kMax = 2, alpha = 0.025, hazardRatioH0 = 1, allocationRatioPlanned = 1, accrualIntensity = 20, hazardRatio = 0.3, lambda2 = 1.9/12, gamma1 = -log(1-0.1)/24, gamma2 = -log(1-0.1)/24, fixedFollowup = 0, rounding = 1, calibrate = 1, maxNumberOfIterations = 1000, seed = 12345))
Performs simulation for two-arm group sequential trials based on weighted log-rank test.
lrsim( kMax = 1, informationRates = NA, criticalValues = NA, futilityBounds = NA, hazardRatioH0 = 1, allocation1 = 1, allocation2 = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, lambda1 = NA, lambda2 = NA, gamma1 = 0, gamma2 = 0, n = NA, followupTime = NA, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, plannedEvents = NA, plannedTime = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )lrsim( kMax = 1, informationRates = NA, criticalValues = NA, futilityBounds = NA, hazardRatioH0 = 1, allocation1 = 1, allocation2 = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, lambda1 = NA, lambda2 = NA, gamma1 = 0, gamma2 = 0, n = NA, followupTime = NA, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, plannedEvents = NA, plannedTime = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )
kMax |
The maximum number of stages. |
informationRates |
The information rates in terms of number
of events for the conventional log-rank test and in terms of
the actual information for weighted log-rank tests.
Fixed prior to the trial. If left unspecified, it defaults to
|
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
hazardRatioH0 |
Hazard ratio under the null hypothesis for the active treatment versus control. Defaults to 1 for superiority test. |
allocation1 |
Number of subjects in the active treatment group in a randomization block. Defaults to 1 for equal randomization. |
allocation2 |
Number of subjects in the control group in a randomization block. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
n |
Sample size. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
rho1 |
The first parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
rho2 |
The second parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
plannedEvents |
The planned cumulative total number of events at each stage. |
plannedTime |
The calendar times for the analyses. To use calendar
time to plan the analyses, |
maxNumberOfIterations |
The number of simulation iterations. Defaults to 1000. |
maxNumberOfRawDatasetsPerStage |
The number of raw datasets per stage to extract. |
seed |
The seed to reproduce the simulation results. |
nthreads |
The number of threads to use in simulations (0 means the default RcppParallel behavior). |
An S3 class lrsim object with 3 components:
overview: A list containing the following information:
rejectPerStage: The efficacy stopping probability by stage.
futilityPerStage: The futility stopping probability by
stage.
cumulativeRejection: Cumulative efficacy stopping
probability by stage.
cumulativeFutility: The cumulative futility stopping
probability by stage.
numberOfEvents: The average number of events by stage.
numberOfDropouts: The average number of dropouts by stage.
numberOfSubjects: The average number of subjects by stage.
analysisTime: The average analysis time by stage.
overallReject: The overall rejection probability.
expectedNumberOfEvents: The expected number of events for
the overall study.
expectedNumberOfDropouts: The expected number of dropouts
for the overall study.
expectedNumberOfSubjects: The expected number of subjects
for the overall study.
expectedStudyDuration: The expected study duration.
hazardRatioH0: Hazard ratio under the null hypothesis for
the active treatment versus control.
useEvents: whether the analyses are planned
based on the number of events or calendar time.
numberOfIterations: The number of simulation iterations.
n: Sample size.
fixedFollowup: Whether a fixed follow-up design is used.
rho1: The first parameter of the Fleming-Harrington family
of weighted log-rank test. Defaults to 0 for conventional log-rank
test.
rho2: The second parameter of the Fleming-Harrington family
of weighted log-rank test. Defaults to 0 for conventional log-rank
test.
kMax: The maximum number of stages.
sumdata: A data frame of summary data by iteration and stage:
iterationNumber: The iteration number.
eventsNotAchieved: Whether the final target number of events
is not achieved for the iteration.
stopStage: The stage at which the trial stops.
stageNumber: The stage number, covering all stages even if
the trial stops at an interim look.
analysisTime: The time for the stage since trial start.
accruals1: The number of subjects enrolled at the stage for
the treatment group.
accruals2: The number of subjects enrolled at the stage for
the control group.
totalAccruals: The total number of subjects enrolled at
the stage.
events1: The number of events at the stage for
the treatment group.
events2: The number of events at the stage for
the control group.
totalEvents: The total number of events at the stage.
dropouts1: The number of dropouts at the stage for
the treatment group.
dropouts2: The number of dropouts at the stage for
the control group.
totalDropouts: The total number of dropouts at the stage.
uscore: The numerator of the log-rank test statistic.
vscore: The variance of the log-rank test statistic.
logRankStatistic: The log-rank test Z-statistic.
rejectPerStage: Whether to reject the null hypothesis
at the stage.
futilityPerStage: Whether to stop the trial for futility
at the stage.
rawdata (exists if maxNumberOfRawDatasetsPerStage is a
positive integer): A data frame for subject-level data for selected
replications, containing the following variables:
iterationNumber: The iteration number.
stopStage: The stage at which the trial stops.
stageNumber: The stage number, covering all stages even if
the trial stops at an interim look.
analysisTime: The time for the stage since trial start.
subjectId: The subject ID.
arrivalTime: The enrollment time for the subject.
stratum: The stratum for the subject.
treatmentGroup: The treatment group (1 or 2) for the
subject.
survivalTime: The underlying survival time for the subject.
dropoutTime: The underlying dropout time for the subject.
timeUnderObservation: The time under observation
since randomization.
event: Whether the subject experienced the event.
dropoutEvent: Whether the subject dropped out.
Kaifeng Lu, [email protected]
# Example 1: analyses based on number of events sim1 <- lrsim( kMax = 2, informationRates = c(0.5, 1), criticalValues = c(2.797, 1.977), accrualIntensity = 11, lambda1 = 0.018, lambda2 = 0.030, n = 132, plannedEvents = c(60, 120), maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 1) # summary statistics sim1 # summary for each simulated data set head(sim1$sumdata) # raw data for selected replication head(sim1$rawdata) # Example 2: analyses based on calendar time have similar power sim2 <- lrsim( kMax = 2, informationRates = c(0.5, 1), criticalValues = c(2.797, 1.977), accrualIntensity = 11, lambda1 = 0.018, lambda2 = 0.030, n = 132, plannedTime = c(31.9, 113.2), maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 1) # summary statistics sim2 # summary for each simulated data set head(sim2$sumdata)# Example 1: analyses based on number of events sim1 <- lrsim( kMax = 2, informationRates = c(0.5, 1), criticalValues = c(2.797, 1.977), accrualIntensity = 11, lambda1 = 0.018, lambda2 = 0.030, n = 132, plannedEvents = c(60, 120), maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 1) # summary statistics sim1 # summary for each simulated data set head(sim1$sumdata) # raw data for selected replication head(sim1$rawdata) # Example 2: analyses based on calendar time have similar power sim2 <- lrsim( kMax = 2, informationRates = c(0.5, 1), criticalValues = c(2.797, 1.977), accrualIntensity = 11, lambda1 = 0.018, lambda2 = 0.030, n = 132, plannedTime = c(31.9, 113.2), maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 1) # summary statistics sim2 # summary for each simulated data set head(sim2$sumdata)
Simulate a multi-arm multi-stage design using a weighted log-rank test. Analyses can be triggered either by the cumulative number of events (combined for an active arm and the common control) or by pre-specified calendar times.
lrsim_mams( M = 2, kMax = 1, criticalValues = NULL, futilityBounds = NULL, hazardRatioH0s = 1, allocations = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, lambdas = NULL, gammas = NULL, n = NA, followupTime = NA, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, plannedEvents = NA, plannedTime = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )lrsim_mams( M = 2, kMax = 1, criticalValues = NULL, futilityBounds = NULL, hazardRatioH0s = 1, allocations = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, lambdas = NULL, gammas = NULL, n = NA, followupTime = NA, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, plannedEvents = NA, plannedTime = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )
M |
Number of active treatment arms. |
kMax |
Number of sequential looks. |
criticalValues |
The matrix of by-level upper boundaries on the
max z-test statistic scale for efficacy stopping.
The first column is for level
|
futilityBounds |
Numeric vector of length |
hazardRatioH0s |
Numeric vector of length |
allocations |
Integer or integer vector of length |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambdas |
List of length |
gammas |
List of length |
n |
Planned total sample size across all active arms and control. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
rho1 |
The first parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
rho2 |
The second parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
plannedEvents |
Numeric vector of length |
plannedTime |
Numeric vector of calendar times for the analyses.
If |
maxNumberOfIterations |
Number of Monte Carlo replications. Defaults to 1000. |
maxNumberOfRawDatasetsPerStage |
Number of subject-level raw datasets to retain per stage (for selected replications). |
seed |
Random seed for reproducibility. |
nthreads |
Number of threads for parallel simulation. Use 0 to accept the default RcppParallel behavior. |
An S3 object of class "lrsim_seamless" with these components:
overview: A list summarizing trial-level results and settings:
overallReject: Overall probability of rejecting the null
by trial end.
overallFutility: Overall probability of stopping for futility
by trial end.
rejectPerStage: Probability of rejecting the null for each
active arm at each stage.
futilityPerStage: Probability of futility stopping for each arm
at each stage.
cumulativeRejection: Cumulative probability of rejection
for each active arm by stage.
cumulativeFutility: Cumulative probability of futility
stopping for each active arm by stage.
numberOfEvents: Cumulative event counts by stage and arm.
numberOfDropouts: Cumulative dropouts by stage and arm.
numberOfSubjects: Cumulative enrollments by stage and arm.
analysisTime: Average calendar time for each stage by arm
among replications that reached that stage.
expectedNumberOfEvents: Expected cumulative events at trial end.
expectedNumberOfDropouts: Expected cumulative dropouts at trial end.
expectedNumberOfSubjects: Expected cumulative enrollments
at trial end.
expectedStudyDuration: Expected study duration.
criticalValues: The input matrix of by-level critical boundaries.
futilityBounds: The input vector of futility boundaries.
hazardRatioH0s: The input hazard ratios under .
useEvents: Logical indicating whether analyses were event-driven.
numberOfIterations: Number of simulation iterations performed.
n: Planned total sample size.
fixedFollowup: Logical indicating whether fixed follow-up was used.
rho1, rho2: Fleming–Harrington weighting parameters used.
M: Number of active arms in Phase 2.
K: Number of sequential looks in Phase 3.
sumdata1: Data frame summarizing each iteration, stage, and
treatment group:
iterationNumber, eventsNotAchieved,
stopStage, stageNumber,
analysisTime, treatmentGroup, accruals,
events, dropouts.
For each stage the final row summarizes the overall study (all arms combined).
summdata2: Data frame summarizing log-rank statistics by iteration,
stage, and active arm:
iterationNumber, stopStage, stageNumber,
analysisTime, activeArm,
totalAccruals, totalEvents, totalDropouts,
uscore, vscore, logRankStatistic,
reject, futility.
For each active arm, total accruals, events, and dropouts refer to the combined counts for that arm and the common control at that stage.
rawdata (present when maxNumberOfRawDatasetsPerStage > 0):
Subject-level data for selected replications with variables:
iterationNumber, stopStage, stageNumber,
analysisTime, subjectId, arrivalTime,
stratum, treatmentGroup,
survivalTime, dropoutTime, timeUnderObservation,
event, dropoutEvent.
Kaifeng Lu, [email protected]
(sim1 <- lrsim_mams( M = 2, kMax = 3, criticalValues = matrix(c(3.880, 2.747, 2.275, 3.710, 2.511, 1.993), 3, 2), futilityBounds = c(0.074, 1.207), accrualTime = c(0, 8), accrualIntensity = c(10, 28), piecewiseSurvivalTime = 0, lambdas = list(log(2)/12*0.5, log(2)/12*0.75, log(2)/12), n = 700, plannedEvents = c(36, 72, 108), maxNumberOfIterations = 10000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 0))(sim1 <- lrsim_mams( M = 2, kMax = 3, criticalValues = matrix(c(3.880, 2.747, 2.275, 3.710, 2.511, 1.993), 3, 2), futilityBounds = c(0.074, 1.207), accrualTime = c(0, 8), accrualIntensity = c(10, 28), piecewiseSurvivalTime = 0, lambdas = list(log(2)/12*0.5, log(2)/12*0.75, log(2)/12), n = 700, plannedEvents = c(36, 72, 108), maxNumberOfIterations = 10000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 0))
Simulate phase 2/3 seamless design using a weighted log-rank test. Analyses can be triggered either by the cumulative number of events (combined for an active arm and the common control) or by pre-specified calendar times.
lrsim_seamless( M = 2, K = 1, criticalValues = NA, futilityBounds = NULL, hazardRatioH0s = 1, allocations = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, lambdas = NULL, gammas = NULL, n = NA, followupTime = NA, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, plannedEvents = NA, plannedTime = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )lrsim_seamless( M = 2, K = 1, criticalValues = NA, futilityBounds = NULL, hazardRatioH0s = 1, allocations = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, lambdas = NULL, gammas = NULL, n = NA, followupTime = NA, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, plannedEvents = NA, plannedTime = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )
M |
Number of active treatment arms in Phase 2. |
K |
Number of sequential looks in Phase 3. |
criticalValues |
Numeric vector of length
|
futilityBounds |
Numeric vector of length
|
hazardRatioH0s |
Numeric vector of length |
allocations |
Integer or integer vector of length |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambdas |
List of length |
gammas |
List of length |
n |
Planned total sample size across all active arms and control. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
rho1 |
The first parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
rho2 |
The second parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
plannedEvents |
Numeric vector of length |
plannedTime |
Numeric vector of calendar times for the analyses.
If |
maxNumberOfIterations |
Number of Monte Carlo replications. Defaults to 1000. |
maxNumberOfRawDatasetsPerStage |
Number of subject-level raw datasets to retain per stage (for selected replications). |
seed |
Random seed for reproducibility. |
nthreads |
Number of threads for parallel simulation. Use 0 to accept the default RcppParallel behavior. |
An S3 object of class "lrsim_seamless" with these components:
overview: A list summarizing trial-level results and settings:
selectAsBest: Probability of selecting each active arm as
the best arm at the end of phase 2.
rejectPerStage: Probability of rejecting the null for each
active arm at each stage.
futilityPerStage: Probability of futility stopping for each
active arm at each stage.
cumulativeRejection: Cumulative probability of rejection by stage.
cumulativeFutility: Cumulative futility stopping probabilities
by stage.
numberOfEvents: Cumulative event counts by stage, including
events from all arms in stage 1 and events from the selected arm
and control in later stages.
numberOfDropouts: Cumulative dropouts by stage.
numberOfSubjects: Cumulative enrollments by stage.
analysisTime: Average calendar time for each stage among
replications that reached that stage.
overallReject: Overall probability of rejecting the null
by trial end.
overallFutility: Overall probability of stopping for futility
by trial end.
expectedNumberOfEvents: Expected cumulative events at trial end.
expectedNumberOfDropouts: Expected cumulative dropouts at trial end.
expectedNumberOfSubjects: Expected cumulative enrollments
at trial end.
expectedStudyDuration: Expected study duration.
criticalValues: The input critical values for each stage.
futilityBounds: The input futility boundaries for each stage.
hazardRatioH0s: The input hazard ratios under .
useEvents: Logical indicating whether analyses were event-driven.
numberOfIterations: Number of simulation iterations performed.
n: Planned total sample size.
fixedFollowup: Logical indicating whether fixed follow-up was used.
rho1, rho2: Fleming–Harrington weighting parameters used.
M: Number of active arms in Phase 2.
K: Number of sequential looks in Phase 3.
sumdata1: Data frame summarizing each iteration, stage, and
treatment group:
iterationNumber, eventsNotAchieved,
stopStage, stageNumber,
analysisTime, treatmentGroup, accruals,
events, dropouts.
For each stage the final row summarizes the overall study (all arms combined).
summdata2: Data frame summarizing log-rank statistics by iteration,
stage, and active arm:
iterationNumber, bestArm, stopStage,
stageNumber, analysisTime, activeArm,
totalAccruals, totalEvents, totalDropouts,
uscore, vscore, logRankStatistic,
reject, futility.
For each active arm, total accruals, events, and dropouts refer to the combined counts for that arm and the common control at that stage.
rawdata (present when maxNumberOfRawDatasetsPerStage > 0):
Subject-level data for selected replications with variables:
iterationNumber, stopStage, stageNumber,
analysisTime, subjectId, arrivalTime,
stratum, treatmentGroup,
survivalTime, dropoutTime, timeUnderObservation,
event, dropoutEvent.
Kaifeng Lu, [email protected]
(sim1 <- lrsim_seamless( M = 2, K = 2, criticalValues = c(3.882, 2.733, 2.222), futilityBounds = c(0.259, 1.201), accrualTime = c(0, 8), accrualIntensity = c(10, 28), piecewiseSurvivalTime = 0, lambdas = list(log(2)/12*0.5, log(2)/12*0.7, log(2)/12), n = 700, plannedEvents = c(42, 84, 126), maxNumberOfIterations = 10000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 0))(sim1 <- lrsim_seamless( M = 2, K = 2, criticalValues = c(3.882, 2.733, 2.222), futilityBounds = c(0.259, 1.201), accrualTime = c(0, 8), accrualIntensity = c(10, 28), piecewiseSurvivalTime = 0, lambdas = list(log(2)/12*0.5, log(2)/12*0.7, log(2)/12), n = 700, plannedEvents = c(42, 84, 126), maxNumberOfIterations = 10000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 0))
Performs simulation for two-endpoint (PFS and OS) two-arm
group sequential trials based on weighted log-rank test. The first
kMaxpfs looks are driven by the total number of PFS events in
two arms combined, and the subsequent looks are driven by the total
number of OS events in two arms combined. Alternatively,
the analyses can be planned to occur at specified calendar times.
lrsim2e( kMax = 1, kMaxpfs = 1, hazardRatioH0pfs = 1, hazardRatioH0os = 1, allocation1 = 1, allocation2 = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, rho_pd_os = 0, lambda1pfs = NA, lambda2pfs = NA, lambda1os = NA, lambda2os = NA, gamma1pfs = 0, gamma2pfs = 0, gamma1os = 0, gamma2os = 0, n = NA, followupTime = NA, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, plannedEvents = NA, plannedTime = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )lrsim2e( kMax = 1, kMaxpfs = 1, hazardRatioH0pfs = 1, hazardRatioH0os = 1, allocation1 = 1, allocation2 = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, rho_pd_os = 0, lambda1pfs = NA, lambda2pfs = NA, lambda1os = NA, lambda2os = NA, gamma1pfs = 0, gamma2pfs = 0, gamma1os = 0, gamma2os = 0, n = NA, followupTime = NA, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, plannedEvents = NA, plannedTime = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )
kMax |
The maximum number of stages. |
kMaxpfs |
Number of stages with timing determined by PFS events.
Ranges from 0 (none) to |
hazardRatioH0pfs |
Hazard ratio under the null hypothesis for the active treatment vs control for PFS. Defaults to 1 for superiority test. |
hazardRatioH0os |
Hazard ratio under the null hypothesis for the active treatment vs control for OS. Defaults to 1 for superiority test. |
allocation1 |
Number of subjects in the treatment group in a randomization block. Defaults to 1 for equal randomization. |
allocation2 |
Number of subjects in the control group in a randomization block. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
rho_pd_os |
The correlation coefficient for the standard bivariate normal random variables used to generate time to disease progression (PD) and time to death using the inverse CDF method. |
lambda1pfs |
A vector of hazard rates for the event in each analysis time interval by stratum for the treatment group and PFS. |
lambda2pfs |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group and PFS. |
lambda1os |
A vector of hazard rates for the event in each analysis time interval by stratum for the treatment group and OS. |
lambda2os |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group and OS. |
gamma1pfs |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the treatment group and PFS. |
gamma2pfs |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group and PFS. |
gamma1os |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the treatment group and OS. |
gamma2os |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group and OS. |
n |
Sample size. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
rho1 |
The first parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
rho2 |
The second parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
plannedEvents |
The planned cumulative total number of PFS events at
Look 1 to Look |
plannedTime |
The calendar times for the analyses. To use calendar
time to plan the analyses, |
maxNumberOfIterations |
The number of simulation iterations. Defaults to 1000. |
maxNumberOfRawDatasetsPerStage |
The number of raw datasets per stage to extract. |
seed |
The seed to reproduce the simulation results. |
nthreads |
The number of threads to use in simulations (0 means the default RcppParallel behavior). |
A list with 2 components:
sumdata: A data frame of summary data by iteration and stage:
iterationNumber: The iteration number.
eventsNotAchieved: Whether the target number of events
is not achieved for the iteration.
stageNumber: The stage number, covering all stages even if
the trial stops at an interim look.
analysisTime: The time for the stage since trial start.
accruals1: The number of subjects enrolled at the stage for
the treatment group.
accruals2: The number of subjects enrolled at the stage for
the control group.
totalAccruals: The total number of subjects enrolled at
the stage.
endpoint: The endpoint (1 for PFS or 2 for OS) under
consideration.
events1: The number of events at the stage for
the treatment group.
events2: The number of events at the stage for
the control group.
totalEvents: The total number of events at the stage.
dropouts1: The number of dropouts at the stage for
the treatment group.
dropouts2: The number of dropouts at the stage for
the control group.
totalDropouts: The total number of dropouts at the stage.
uscore: The numerator of the log-rank test statistic for
the endpoint.
vscore: The variance of the log-rank test statistic for
the endpoint.
logRankStatistic: The log-rank test Z-statistic for
the endpoint.
rawdata (exists if maxNumberOfRawDatasetsPerStage is a
positive integer): A data frame for subject-level data for selected
replications, containing the following variables:
iterationNumber: The iteration number.
stageNumber: The stage under consideration.
analysisTime: The time for the stage since trial start.
subjectId: The subject ID.
arrivalTime: The enrollment time for the subject.
stratum: The stratum for the subject.
treatmentGroup: The treatment group (1 or 2) for the
subject.
endpoint: The endpoint (1 for PFS or 2 for OS) under
consideration for the row. Each subject will have two rows, one
for each endpoint.
survivalTime: The underlying survival time for the
event endpoint for the subject.
dropoutTime: The underlying dropout time for the
event endpoint for the subject.
timeUnderObservation: The time under observation
since randomization for the event endpoint for the subject.
event: Whether the subject experienced the event
endpoint.
dropoutEvent: Whether the subject dropped out for the
endpoint.
Kaifeng Lu, [email protected]
sim1 <- lrsim2e( kMax = 3, kMaxpfs = 2, allocation1 = 2, allocation2 = 1, accrualTime = c(0, 8), accrualIntensity = c(10, 28), piecewiseSurvivalTime = 0, rho_pd_os = 0, lambda1pfs = log(2)/12*0.60, lambda2pfs = log(2)/12, lambda1os = log(2)/30*0.65, lambda2os = log(2)/30, n = 420, plannedEvents = c(186, 259, 183), maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 1) head(sim1$sumdata) head(sim1$rawdata)sim1 <- lrsim2e( kMax = 3, kMaxpfs = 2, allocation1 = 2, allocation2 = 1, accrualTime = c(0, 8), accrualIntensity = c(10, 28), piecewiseSurvivalTime = 0, rho_pd_os = 0, lambda1pfs = log(2)/12*0.60, lambda2pfs = log(2)/12, lambda1os = log(2)/30*0.65, lambda2os = log(2)/30, n = 420, plannedEvents = c(186, 259, 183), maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 1) head(sim1$sumdata) head(sim1$rawdata)
Performs simulation for two-endpoint (PFS and OS)
three-arm group sequential trials based on weighted log-rank test.
The first kMaxpfs looks are driven by the total number of
PFS events in Arm A and Arm C combined, and the subsequent looks
are driven by the total number of OS events in Arm A and Arm C
combined. Alternatively, the analyses can be planned to occur at
specified calendar times.
lrsim2e3a( kMax = 1, kMaxpfs = 1, hazardRatioH013pfs = 1, hazardRatioH023pfs = 1, hazardRatioH012pfs = 1, hazardRatioH013os = 1, hazardRatioH023os = 1, hazardRatioH012os = 1, allocation1 = 1, allocation2 = 1, allocation3 = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, rho_pd_os = 0, lambda1pfs = NA, lambda2pfs = NA, lambda3pfs = NA, lambda1os = NA, lambda2os = NA, lambda3os = NA, gamma1pfs = 0, gamma2pfs = 0, gamma3pfs = 0, gamma1os = 0, gamma2os = 0, gamma3os = 0, n = NA, followupTime = NA, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, plannedEvents = NA, plannedTime = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )lrsim2e3a( kMax = 1, kMaxpfs = 1, hazardRatioH013pfs = 1, hazardRatioH023pfs = 1, hazardRatioH012pfs = 1, hazardRatioH013os = 1, hazardRatioH023os = 1, hazardRatioH012os = 1, allocation1 = 1, allocation2 = 1, allocation3 = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, rho_pd_os = 0, lambda1pfs = NA, lambda2pfs = NA, lambda3pfs = NA, lambda1os = NA, lambda2os = NA, lambda3os = NA, gamma1pfs = 0, gamma2pfs = 0, gamma3pfs = 0, gamma1os = 0, gamma2os = 0, gamma3os = 0, n = NA, followupTime = NA, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, plannedEvents = NA, plannedTime = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )
kMax |
The maximum number of stages. |
kMaxpfs |
Number of stages with timing determined by PFS events.
Ranges from 0 (none) to |
hazardRatioH013pfs |
Hazard ratio under the null hypothesis for arm 1 vs arm 3 for PFS. Defaults to 1 for superiority test. |
hazardRatioH023pfs |
Hazard ratio under the null hypothesis for arm 2 vs arm 3 for PFS. Defaults to 1 for superiority test. |
hazardRatioH012pfs |
Hazard ratio under the null hypothesis for arm 1 vs arm 2 for PFS. Defaults to 1 for superiority test. |
hazardRatioH013os |
Hazard ratio under the null hypothesis for arm 1 vs arm 3 for OS. Defaults to 1 for superiority test. |
hazardRatioH023os |
Hazard ratio under the null hypothesis for arm 2 vs arm 3 for OS. Defaults to 1 for superiority test. |
hazardRatioH012os |
Hazard ratio under the null hypothesis for arm 1 vs arm 2 for OS. Defaults to 1 for superiority test. |
allocation1 |
Number of subjects in Arm A in a randomization block. Defaults to 1 for equal randomization. |
allocation2 |
Number of subjects in Arm B in a randomization block. Defaults to 1 for equal randomization. |
allocation3 |
Number of subjects in Arm C in a randomization block. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
rho_pd_os |
The correlation coefficient for the standard bivariate normal random variables used to generate time to disease progression and time to death using the inverse CDF method. |
lambda1pfs |
A vector of hazard rates for the event in each analysis time interval by stratum for arm 1 and PFS. |
lambda2pfs |
A vector of hazard rates for the event in each analysis time interval by stratum for arm 2 and PFS. |
lambda3pfs |
A vector of hazard rates for the event in each analysis time interval by stratum for arm 3 and PFS. |
lambda1os |
A vector of hazard rates for the event in each analysis time interval by stratum for arm 1 and OS. |
lambda2os |
A vector of hazard rates for the event in each analysis time interval by stratum for arm 2 and OS. |
lambda3os |
A vector of hazard rates for the event in each analysis time interval by stratum for arm 3 and OS. |
gamma1pfs |
The hazard rate for exponential dropout. A vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for arm 1 and PFS. |
gamma2pfs |
The hazard rate for exponential dropout. A vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for arm 2 and PFS. |
gamma3pfs |
The hazard rate for exponential dropout. A vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for arm 3 and PFS. |
gamma1os |
The hazard rate for exponential dropout. A vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for arm 1 and OS. |
gamma2os |
The hazard rate for exponential dropout. A vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for arm 2 and OS. |
gamma3os |
The hazard rate for exponential dropout. A vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for arm 3 and OS. |
n |
Sample size. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
rho1 |
The first parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
rho2 |
The second parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
plannedEvents |
The planned cumulative total number of PFS events at
Look 1 to Look |
plannedTime |
The calendar times for the analyses. To use calendar
time to plan the analyses, |
maxNumberOfIterations |
The number of simulation iterations. Defaults to 1000. |
maxNumberOfRawDatasetsPerStage |
The number of raw datasets per stage to extract. |
seed |
The seed to reproduce the simulation results. |
nthreads |
The number of threads to use in simulations (0 means the default RcppParallel behavior). |
A list with 2 components:
sumdata: A data frame of summary data by iteration and stage:
iterationNumber: The iteration number.
eventsNotAchieved: Whether the target number of events
is not achieved for the iteration.
stageNumber: The stage number, covering all stages even if
the trial stops at an interim look.
analysisTime: The time for the stage since trial start.
accruals1: The number of subjects enrolled at the stage for
the active treatment 1 group.
accruals2: The number of subjects enrolled at the stage for
the active treatment 2 group.
accruals3: The number of subjects enrolled at the stage for
the control group.
totalAccruals: The total number of subjects enrolled at
the stage.
endpoint: The endpoint (1 for PFS or 2 for OS) under
consideration.
events1: The number of events at the stage for
the active treatment 1 group.
events2: The number of events at the stage for
the active treatment 2 group.
events3: The number of events at the stage for
the control group.
totalEvents: The total number of events at the stage.
dropouts1: The number of dropouts at the stage for
the active treatment 1 group.
dropouts2: The number of dropouts at the stage for
the active treatment 2 group.
dropouts3: The number of dropouts at the stage for
the control group.
totalDropouts: The total number of dropouts at the stage.
logRankStatistic13: The log-rank test Z-statistic
comparing the active treatment 1 to the control for the endpoint.
logRankStatistic23: The log-rank test Z-statistic
comparing the active treatment 2 to the control for the endpoint.
logRankStatistic12: The log-rank test Z-statistic
comparing the active treatment 1 to the active treatment 2
for the endpoint.
rawdata (exists if maxNumberOfRawDatasetsPerStage is a
positive integer): A data frame for subject-level data for selected
replications, containing the following variables:
iterationNumber: The iteration number.
stageNumber: The stage under consideration.
analysisTime: The time for the stage since trial start.
subjectId: The subject ID.
arrivalTime: The enrollment time for the subject.
stratum: The stratum for the subject.
treatmentGroup: The treatment group (1, 2, or 3) for
the subject.
endpoint: The endpoint (1 for PFS or 2 for OS) under
consideration.
survivalTime: The underlying survival time for the
event endpoint for the subject.
dropoutTime: The underlying dropout time for the
event endpoint for the subject.
timeUnderObservation: The time under observation
since randomization for the event endpoint for the subject.
event: Whether the subject experienced the event
endpoint.
dropoutEvent: Whether the subject dropped out for
the endpoint.
Kaifeng Lu, [email protected]
sim1 <- lrsim2e3a( kMax = 3, kMaxpfs = 2, allocation1 = 2, allocation2 = 2, allocation3 = 1, accrualTime = c(0, 8), accrualIntensity = c(10, 28), piecewiseSurvivalTime = 0, rho_pd_os = 0, lambda1pfs = log(2)/12*0.60, lambda2pfs = log(2)/12*0.70, lambda3pfs = log(2)/12, lambda1os = log(2)/30*0.65, lambda2os = log(2)/30*0.75, lambda3os = log(2)/30, n = 700, plannedEvents = c(186, 259, 183), maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 1) head(sim1$sumdata) head(sim1$rawdata)sim1 <- lrsim2e3a( kMax = 3, kMaxpfs = 2, allocation1 = 2, allocation2 = 2, allocation3 = 1, accrualTime = c(0, 8), accrualIntensity = c(10, 28), piecewiseSurvivalTime = 0, rho_pd_os = 0, lambda1pfs = log(2)/12*0.60, lambda2pfs = log(2)/12*0.70, lambda3pfs = log(2)/12, lambda1os = log(2)/30*0.65, lambda2os = log(2)/30*0.75, lambda3os = log(2)/30, n = 700, plannedEvents = c(186, 259, 183), maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 1) head(sim1$sumdata) head(sim1$rawdata)
Performs simulation for three-arm group sequential trials based on weighted log-rank test. The looks are driven by the total number of events in Arm A and Arm C combined. Alternatively, the analyses can be planned to occur at specified calendar times.
lrsim3a( kMax = 1, hazardRatioH013 = 1, hazardRatioH023 = 1, hazardRatioH012 = 1, allocation1 = 1, allocation2 = 1, allocation3 = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, lambda1 = NA, lambda2 = NA, lambda3 = NA, gamma1 = 0, gamma2 = 0, gamma3 = 0, n = NA, followupTime = NA, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, plannedEvents = NA, plannedTime = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )lrsim3a( kMax = 1, hazardRatioH013 = 1, hazardRatioH023 = 1, hazardRatioH012 = 1, allocation1 = 1, allocation2 = 1, allocation3 = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, lambda1 = NA, lambda2 = NA, lambda3 = NA, gamma1 = 0, gamma2 = 0, gamma3 = 0, n = NA, followupTime = NA, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, plannedEvents = NA, plannedTime = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )
kMax |
The maximum number of stages. |
hazardRatioH013 |
Hazard ratio under the null hypothesis for arm 1 versus arm 3. Defaults to 1 for superiority test. |
hazardRatioH023 |
Hazard ratio under the null hypothesis for arm 2 versus arm 3. Defaults to 1 for superiority test. |
hazardRatioH012 |
Hazard ratio under the null hypothesis for arm 1 versus arm 2. Defaults to 1 for superiority test. |
allocation1 |
Number of subjects in Arm A in a randomization block. Defaults to 1 for equal randomization. |
allocation2 |
Number of subjects in Arm B in a randomization block. Defaults to 1 for equal randomization. |
allocation3 |
Number of subjects in Arm C in a randomization block. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for arm 1. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for arm 2. |
lambda3 |
A vector of hazard rates for the event in each analysis time interval by stratum for arm 3. |
gamma1 |
The hazard rate for exponential dropout. A vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for arm 1. |
gamma2 |
The hazard rate for exponential dropout. A vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for arm 2. |
gamma3 |
The hazard rate for exponential dropout. A vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for arm 3. |
n |
Sample size. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
rho1 |
The first parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
rho2 |
The second parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
plannedEvents |
The planned cumulative total number of events at
Look 1 to Look |
plannedTime |
The calendar times for the analyses. To use calendar
time to plan the analyses, |
maxNumberOfIterations |
The number of simulation iterations. Defaults to 1000. |
maxNumberOfRawDatasetsPerStage |
The number of raw datasets per stage to extract. |
seed |
The seed to reproduce the simulation results. |
nthreads |
The number of threads to use in simulations (0 means the default RcppParallel behavior). |
A list with 2 components:
sumdata: A data frame of summary data by iteration and stage:
iterationNumber: The iteration number.
eventsNotAchieved: Whether the target number of events
is not achieved for the iteration.
stageNumber: The stage number, covering all stages even if
the trial stops at an interim look.
analysisTime: The time for the stage since trial start.
accruals1: The number of subjects enrolled at the stage for
the active treatment 1 group.
accruals2: The number of subjects enrolled at the stage for
the active treatment 2 group.
accruals3: The number of subjects enrolled at the stage for
the control group.
totalAccruals: The total number of subjects enrolled at
the stage.
events1: The number of events at the stage for
the active treatment 1 group.
events2: The number of events at the stage for
the active treatment 2 group.
events3: The number of events at the stage for
the control group.
totalEvents: The total number of events at the stage.
dropouts1: The number of dropouts at the stage for
the active treatment 1 group.
dropouts2: The number of dropouts at the stage for
the active treatment 2 group.
dropouts3: The number of dropouts at the stage for
the control group.
totalDropouts: The total number of dropouts at the stage.
uscore13: The log-rank test score statistic comparing the
active treatment 1 to the control.
vscore13: The log-rank test variance statistic comparing the
active treatment 1 to the control.
logRankStatistic13: The log-rank test Z-statistic
comparing the active treatment 1 to the control.
uscore23: The log-rank test score statistic comparing the
active treatment 2 to the control.
vscore23: The log-rank test variance statistic comparing the
active treatment 2 to the control.
logRankStatistic23: The log-rank test Z-statistic
comparing the active treatment 2 to the control.
uscore12: The log-rank test score statistic comparing the
active treatment 1 to the active treatment 2.
vscore12: The log-rank test variance statistic comparing the
active treatment 1 to the active treatment 2.
logRankStatistic12: The log-rank test Z-statistic
comparing the active treatment 1 to the active treatment 2.
rawdata (exists if maxNumberOfRawDatasetsPerStage is a
positive integer): A data frame for subject-level data for selected
replications, containing the following variables:
iterationNumber: The iteration number.
stageNumber: The stage under consideration.
analysisTime: The time for the stage since trial start.
subjectId: The subject ID.
arrivalTime: The enrollment time for the subject.
stratum: The stratum for the subject.
treatmentGroup: The treatment group (1, 2, or 3) for
the subject.
survivalTime: The underlying survival time for the subject.
dropoutTime: The underlying dropout time for the subject.
timeUnderObservation: The time under observation
since randomization for the subject.
event: Whether the subject experienced the event.
dropoutEvent: Whether the subject dropped out.
Kaifeng Lu, [email protected]
sim1 <- lrsim3a( kMax = 3, allocation1 = 2, allocation2 = 2, allocation3 = 1, accrualTime = c(0, 8), accrualIntensity = c(10, 28), piecewiseSurvivalTime = 0, lambda1 = log(2)/12*0.60, lambda2 = log(2)/12*0.70, lambda3 = log(2)/12, n = 700, plannedEvents = c(186, 259, 295), maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 1) head(sim1$sumdata) head(sim1$rawdata)sim1 <- lrsim3a( kMax = 3, allocation1 = 2, allocation2 = 2, allocation3 = 1, accrualTime = c(0, 8), accrualIntensity = c(10, 28), piecewiseSurvivalTime = 0, lambda1 = log(2)/12*0.60, lambda2 = log(2)/12*0.70, lambda3 = log(2)/12, n = 700, plannedEvents = c(186, 259, 295), maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 1) head(sim1$sumdata) head(sim1$rawdata)
Performs simulation for two-arm group sequential trials based on weighted log-rank test for a biomarker enrichment design. The looks are either driven by the total number of events in the ITT population or the biomarker positive sub population. Alternatively, the analyses can be planned to occur at specified calendar times.
lrsimsub( kMax = 1, kMaxitt = 1, hazardRatioH0itt = 1, hazardRatioH0pos = 1, hazardRatioH0neg = 1, allocation1 = 1, allocation2 = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, p_pos = NA, lambda1itt = NA, lambda2itt = NA, lambda1pos = NA, lambda2pos = NA, gamma1itt = 0, gamma2itt = 0, gamma1pos = 0, gamma2pos = 0, n = NA, followupTime = NA, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, plannedEvents = NA, plannedTime = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )lrsimsub( kMax = 1, kMaxitt = 1, hazardRatioH0itt = 1, hazardRatioH0pos = 1, hazardRatioH0neg = 1, allocation1 = 1, allocation2 = 1, accrualTime = 0, accrualIntensity = NA, piecewiseSurvivalTime = 0, stratumFraction = 1, p_pos = NA, lambda1itt = NA, lambda2itt = NA, lambda1pos = NA, lambda2pos = NA, gamma1itt = 0, gamma2itt = 0, gamma1pos = 0, gamma2pos = 0, n = NA, followupTime = NA, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, plannedEvents = NA, plannedTime = NA, maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 0, seed = 0, nthreads = 0 )
kMax |
The maximum number of stages. |
kMaxitt |
Number of stages with timing determined by events
in the ITT population. Ranges from 0 (none) to |
hazardRatioH0itt |
Hazard ratio under the null hypothesis for the ITT population. Defaults to 1 for superiority test. |
hazardRatioH0pos |
Hazard ratio under the null hypothesis for the biomarker positive sub population. Defaults to 1 for superiority test. |
hazardRatioH0neg |
Hazard ratio under the null hypothesis for the biomarker negative sub population. Defaults to 1 for superiority test. |
allocation1 |
Number of subjects in the treatment group in a randomization block. Defaults to 1 for equal randomization. |
allocation2 |
Number of subjects in the control group in a randomization block. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
p_pos |
The prevalence of the biomarker positive sub population in each stratum. |
lambda1itt |
A vector of hazard rates for the event in each analysis time interval by stratum for the treatment group in the ITT population. |
lambda2itt |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group in the ITT population. |
lambda1pos |
A vector of hazard rates for the event in each analysis time interval by stratum for the treatment group in the biomarker positive sub population. |
lambda2pos |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group in the biomarker positive sub population. |
gamma1itt |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the treatment group in the ITT population. |
gamma2itt |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group in the ITT population. |
gamma1pos |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the treatment group in the biomarker positive sub population. |
gamma2pos |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group in the biomarker positive sub population. |
n |
Sample size. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
rho1 |
The first parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
rho2 |
The second parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
plannedEvents |
The planned cumulative total number events in the
ITT population at Look 1 to Look |
plannedTime |
The calendar times for the analyses. To use calendar
time to plan the analyses, |
maxNumberOfIterations |
The number of simulation iterations. Defaults to 1000. |
maxNumberOfRawDatasetsPerStage |
The number of raw datasets per stage to extract. |
seed |
The seed to reproduce the simulation results. |
nthreads |
The number of threads to use in simulations (0 means the default RcppParallel behavior). |
A list with 2 components:
sumdata: A data frame of summary data by iteration and stage:
iterationNumber: The iteration number.
eventsNotAchieved: Whether the target number of events
is not achieved for the iteration.
stageNumber: The stage number, covering all stages even if
the trial stops at an interim look.
analysisTime: The time for the stage since trial start.
population: The population ("ITT", "Biomarker Positive",
"Biomarker Negative") under consideration.
accruals1: The number of subjects enrolled at the stage for
the treatment group.
accruals2: The number of subjects enrolled at the stage for
the control group.
totalAccruals: The total number of subjects enrolled at
the stage.
events1: The number of events at the stage for
the treatment group.
events2: The number of events at the stage for
the control group.
totalEvents: The total number of events at the stage.
dropouts1: The number of dropouts at the stage for
the treatment group.
dropouts2: The number of dropouts at the stage for
the control group.
totalDropouts: The total number of dropouts at the stage.
logRankStatistic: The log-rank test Z-statistic for
the population.
rawdata (exists if maxNumberOfRawDatasetsPerStage is a
positive integer): A data frame for subject-level data for selected
replications, containing the following variables:
iterationNumber: The iteration number.
stageNumber: The stage under consideration.
analysisTime: The time for the stage since trial start.
subjectId: The subject ID.
arrivalTime: The enrollment time for the subject.
stratum: The stratum for the subject.
biomarker: The biomarker status for the subject (1 for
positive, 0 for negative).
treatmentGroup: The treatment group (1 or 2) for the
subject.
survivalTime: The underlying survival time for the subject.
dropoutTime: The underlying dropout time for the subject.
timeUnderObservation: The time under observation
since randomization for the subject.
event: Whether the subject experienced an event.
dropoutEvent: Whether the subject dropped out.
Kaifeng Lu, [email protected]
sim1 <- lrsimsub( kMax = 2, kMaxitt = 2, allocation1 = 1, allocation2 = 1, accrualTime = seq(0,9), accrualIntensity = c(seq(10,70,10),rep(70,3)), piecewiseSurvivalTime = c(0,12,24), p_pos = 0.6, lambda1itt = c(0.00256, 0.00383, 0.00700), lambda2itt = c(0.00427, 0.00638, 0.01167), lambda1pos = c(0.00299, 0.00430, 0.01064), lambda2pos = c(0.00516, 0.00741, 0.01835), gamma1itt = -log(1-0.04)/12, gamma2itt = -log(1-0.04)/12, gamma1pos = -log(1-0.04)/12, gamma2pos = -log(1-0.04)/12, n = 500, plannedEvents = c(108,144), maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 1) head(sim1$sumdata) head(sim1$rawdata)sim1 <- lrsimsub( kMax = 2, kMaxitt = 2, allocation1 = 1, allocation2 = 1, accrualTime = seq(0,9), accrualIntensity = c(seq(10,70,10),rep(70,3)), piecewiseSurvivalTime = c(0,12,24), p_pos = 0.6, lambda1itt = c(0.00256, 0.00383, 0.00700), lambda2itt = c(0.00427, 0.00638, 0.01167), lambda1pos = c(0.00299, 0.00430, 0.01064), lambda2pos = c(0.00516, 0.00741, 0.01835), gamma1itt = -log(1-0.04)/12, gamma2itt = -log(1-0.04)/12, gamma1pos = -log(1-0.04)/12, gamma2pos = -log(1-0.04)/12, n = 500, plannedEvents = c(108,144), maxNumberOfIterations = 1000, maxNumberOfRawDatasetsPerStage = 1, seed = 314159, nthreads = 1) head(sim1$sumdata) head(sim1$rawdata)
Obtains the number of subjects accrued, number of events, number of dropouts, and number of subjects reaching the maximum follow-up in each group, mean and variance of weighted log-rank score statistic, estimated hazard ratio from weighted Cox regression and variance of log hazard ratio estimate at given calendar times.
lrstat( time = NA_real_, hazardRatioH0 = 1, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, predictTarget = 2L )lrstat( time = NA_real_, hazardRatioH0 = 1, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, rho1 = 0, rho2 = 0, predictTarget = 2L )
time |
A vector of calendar times at which to calculate the number of events and the mean and variance of log-rank test score statistic. |
hazardRatioH0 |
Hazard ratio under the null hypothesis for the active treatment versus control. Defaults to 1 for superiority test. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
rho1 |
The first parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
rho2 |
The second parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
predictTarget |
The target of prediction.
Set |
A data frame containing the following variables if
predictTarget = 1:
time: The analysis time since trial start.
subjects: The number of enrolled subjects.
nevents: The total number of events.
nevents1: The number of events in the active treatment group.
nevents2: The number of events in the control group.
ndropouts: The total number of dropouts.
ndropouts1: The number of dropouts in the active treatment
group.
ndropouts2: The number of dropouts in the control group.
nfmax: The total number of subjects reaching maximum follow-up.
nfmax1: The number of subjects reaching maximum follow-up in
the active treatment group.
nfmax2: The number of subjects reaching maximum follow-up in
the control group.
If predictTarget = 2, the following variables will also
be included:
uscore: The numerator of the log-rank test statistic.
vscore: The variance of the log-rank score test statistic.
logRankZ: The log-rank test statistic on the Z-scale.
hazardRatioH0: The hazard ratio under the null hypothesis.
Furthermore, if predictTarget = 3, the following additional
variables will also be included:
HR: The average hazard ratio from weighted Cox regression.
vlogHR: The variance of log hazard ratio.
zlogHR: The Z-statistic for log hazard ratio.
Kaifeng Lu, [email protected]
# Piecewise accrual, piecewise exponential survivals, and 5% dropout by # the end of 1 year. lrstat(time = c(22, 40), allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)# Piecewise accrual, piecewise exponential survivals, and 5% dropout by # the end of 1 year. lrstat(time = c(22, 40), allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)
Obtains the log-rank test using the Fleming-Harrington family of weights.
lrtest( data, stratum = "", treat = "treat", time = "time", time2 = "", event = "event", weight = "", weight_readj = FALSE, rho1 = 0, rho2 = 0 )lrtest( data, stratum = "", treat = "treat", time = "time", time2 = "", event = "event", weight = "", weight_readj = FALSE, rho1 = 0, rho2 = 0 )
data |
The input data frame or list of data frames that contains the following variables:
|
stratum |
The name(s) of the stratum variable(s) in the input data. |
treat |
The name of the treatment variable in the input data. |
time |
The name of the time variable or the left end of each interval for counting process data in the input data. |
time2 |
The name of the right end of each interval for counting process data in the input data. |
event |
The name of the event variable in the input data. |
weight |
The name of the weight variable in the input data. |
weight_readj |
Whether the weight variable at each event time
will be readjusted to be proportional to the number at risk by
treatment group. Defaults to |
rho1 |
The first parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
rho2 |
The second parameter of the Fleming-Harrington family of weighted log-rank test. Defaults to 0 for conventional log-rank test. |
A data frame with the following variables:
uscore: The numerator of the log-rank test statistic.
vscore: The variance of the log-rank score test statistic.
logRankZ: The Z-statistic value.
logRankPValue: The two-sided p-value.
weight_readj: Whether the weight variable will be readjusted.
rho1: The first parameter of the Fleming-Harrington weights.
rho2: The second parameter of the Fleming-Harrington weights.
Kaifeng Lu, [email protected]
lrtest(rawdata[rawdata$iterationNumber == 1, ], stratum = "stratum", treat = "treatmentGroup", time = "timeUnderObservation", event = "event", rho1 = 0.5, rho2 = 0)lrtest(rawdata[rawdata$iterationNumber == 1, ], stratum = "stratum", treat = "treatmentGroup", time = "timeUnderObservation", event = "event", rho1 = 0.5, rho2 = 0)
Obtains the Miettinen-Nurminen score confidence interval for two-sample odds ratio possibly with stratification.
mnOddsRatioCI(n1, y1, n2, y2, cilevel = 0.95)mnOddsRatioCI(n1, y1, n2, y2, cilevel = 0.95)
n1 |
The sample size for the active treatment group. |
y1 |
The number of responses for the active treatment group. |
n2 |
The sample size for the control group. |
y2 |
The number of responses for the control group. |
cilevel |
The confidence interval level. |
The Mantel-Haenszel sample size weights are used for stratified samples.
A list with two components:
data A data frame containing the input sample size
and number of responses for each treatment group.
It has the following variables:
n1: The sample size for the active treatment group.
y1: The number of responses for the active treatment group.
n2: The sample size for the control group.
y2: The number of responses for the control group.
estimates: A data frame containing the point estimate
and confidence interval for odds ratio. It has the following
variables:
scale: The scale of treatment effect.
estimate: The point estimate.
lower: The lower limit of the confidence interval.
upper: The upper limit of the confidence interval.
cilevel: The confidence interval level.
Kaifeng Lu, [email protected]
mnOddsRatioCI(n1 = c(10,10), y1 = c(4,3), n2 = c(20,10), y2 = c(2,0))mnOddsRatioCI(n1 = c(10,10), y1 = c(4,3), n2 = c(20,10), y2 = c(2,0))
Obtains the Miettinen-Nurminen score confidence interval for two-sample rate difference possibly with stratification.
mnRateDiffCI(t1, y1, t2, y2, cilevel = 0.95)mnRateDiffCI(t1, y1, t2, y2, cilevel = 0.95)
t1 |
The exposure for the active treatment group. |
y1 |
The number of events for the active treatment group. |
t2 |
The exposure for the control group. |
y2 |
The number of events for the control group. |
cilevel |
The confidence interval level. |
The Mantel-Haenszel weights are used for stratified samples.
A list with two components:
data A data frame containing the input exposure
and number of events for each treatment group.
It has the following variables:
t1: The exposure for the active treatment group.
y1: The number of events for the active treatment group.
t2: The exposure for the control group.
y2: The number of events for the control group.
estimates: A data frame containing the point estimate
and confidence interval for rate difference. It has the following
variables:
scale: The scale of treatment effect.
estimate: The point estimate.
lower: The lower limit of the confidence interval.
upper: The upper limit of the confidence interval.
cilevel: The confidence interval level.
Kaifeng Lu, [email protected]
mnRateDiffCI(t1 = c(10,10), y1 = c(4,3), t2 = c(20,10), y2 = c(2,0))mnRateDiffCI(t1 = c(10,10), y1 = c(4,3), t2 = c(20,10), y2 = c(2,0))
Obtains the Miettinen-Nurminen score confidence interval for two-sample rate ratio possibly with stratification.
mnRateRatioCI(t1, y1, t2, y2, cilevel = 0.95)mnRateRatioCI(t1, y1, t2, y2, cilevel = 0.95)
t1 |
The exposure for the active treatment group. |
y1 |
The number of events for the active treatment group. |
t2 |
The exposure for the control group. |
y2 |
The number of events for the control group. |
cilevel |
The confidence interval level. |
The Mantel-Haenszel weights are used for stratified samples.
A list with two components:
data A data frame containing the input exposure
and number of events for each treatment group.
It has the following variables:
t1: The exposure for the active treatment group.
y1: The number of events for the active treatment group.
t2: The exposure for the control group.
y2: The number of events for the control group.
estimates: A data frame containing the point estimate
and confidence interval for rate ratio. It has the following
variables:
scale: The scale of treatment effect.
estimate: The point estimate.
lower: The lower limit of the confidence interval.
upper: The upper limit of the confidence interval.
cilevel: The confidence interval level.
Kaifeng Lu, [email protected]
mnRateRatioCI(t1 = c(10,10), y1 = c(4,3), t2 = c(20,10), y2 = c(2,0))mnRateRatioCI(t1 = c(10,10), y1 = c(4,3), t2 = c(20,10), y2 = c(2,0))
Obtains the Miettinen-Nurminen score confidence interval for two-sample risk difference possibly with stratification.
mnRiskDiffCI(n1, y1, n2, y2, cilevel = 0.95)mnRiskDiffCI(n1, y1, n2, y2, cilevel = 0.95)
n1 |
The sample size for the active treatment group. |
y1 |
The number of responses for the active treatment group. |
n2 |
The sample size for the control group. |
y2 |
The number of responses for the control group. |
cilevel |
The confidence interval level. |
The Mantel-Haenszel sample size weights are used for stratified samples.
A list with two components:
data A data frame containing the input sample size
and number of responses for each treatment group.
It has the following variables:
n1: The sample size for the active treatment group.
y1: The number of responses for the active treatment group.
n2: The sample size for the control group.
y2: The number of responses for the control group.
estimates: A data frame containing the point estimate
and confidence interval for risk difference. It has the following
variables:
scale: The scale of treatment effect.
estimate: The point estimate.
lower: The lower limit of the confidence interval.
upper: The upper limit of the confidence interval.
cilevel: The confidence interval level.
Kaifeng Lu, [email protected]
mnRiskDiffCI(n1 = c(10, 10), y1 = c(4, 3), n2 = c(20, 10), y2 = c(2, 0))mnRiskDiffCI(n1 = c(10, 10), y1 = c(4, 3), n2 = c(20, 10), y2 = c(2, 0))
Obtains the Miettinen-Nurminen score confidence interval for two-sample risk ratio possibly with stratification.
mnRiskRatioCI(n1, y1, n2, y2, cilevel = 0.95)mnRiskRatioCI(n1, y1, n2, y2, cilevel = 0.95)
n1 |
The sample size for the active treatment group. |
y1 |
The number of responses for the active treatment group. |
n2 |
The sample size for the control group. |
y2 |
The number of responses for the control group. |
cilevel |
The confidence interval level. |
The Mantel-Haenszel sample size weights are used for stratified samples.
A list with two components:
data A data frame containing the input sample size
and number of responses for each treatment group.
It has the following variables:
n1: The sample size for the active treatment group.
y1: The number of responses for the active treatment group.
n2: The sample size for the control group.
y2: The number of responses for the control group.
estimates: A data frame containing the point estimate
and confidence interval for risk ratio. It has the following
variables:
scale: The scale of treatment effect.
estimate: The point estimate.
lower: The lower limit of the confidence interval.
upper: The upper limit of the confidence interval.
cilevel: The confidence interval level.
Kaifeng Lu, [email protected]
mnRiskRatioCI(n1 = c(10, 10), y1 = c(4, 3), n2 = c(20, 10), y2 = c(2, 0))mnRiskRatioCI(n1 = c(10, 10), y1 = c(4, 3), n2 = c(20, 10), y2 = c(2, 0))
Obtains the decision table for the modified toxicity probability interval-2 (mTPI-2) design.
mTPI2Table( nMax = NA_integer_, pT = 0.3, epsilon1 = 0.05, epsilon2 = 0.05, a = 1, b = 1, pExcessTox = 0.95 )mTPI2Table( nMax = NA_integer_, pT = 0.3, epsilon1 = 0.05, epsilon2 = 0.05, a = 1, b = 1, pExcessTox = 0.95 )
nMax |
The maximum number of subjects in a dose cohort. |
pT |
The target toxicity probability. Defaults to 0.3. |
epsilon1 |
The lower equivalence margin from the target. Defaults to 0.05. |
epsilon2 |
The upper equivalence margin from the target. Defaults to 0.05. |
a |
The prior toxicity parameter for the beta prior. |
b |
The prior non-toxicity parameter for the beta prior. |
pExcessTox |
The threshold for excessive toxicity, i.e., if Prob(p > pT | Data) > pExcessTox, then the current and all higher doses will be excluded and never be used again in the remainder of the trial to avoid any other subjects receiving treatment at those doses. Defaults to 0.95. |
An S3 class mTPI2Table object with the following
components:
settings: The input settings data frame with the following
variables:
nMax: The maximum number of subjects in a dose cohort.
pT: The target toxicity probability.
epsilon1: The lower equivalence margin from the target.
epsilon2: The upper equivalence margin from the target.
a: The prior toxicity parameter for the beta prior.
b: The prior non-toxicity parameter for the beta prior.
pExcessTox: The threshold for excessive toxicity.
subintervals: The subintervals of equal length in the mTPI-2
design. It includes the following variables:
lower: The lower bound of the subinterval.
upper: The upper bound of the subinterval.
decision: The dosing decision for the subinterval.
decisionDataFrame: The decision data frame for the mTPI-2 design.
It includes the following variables:
n: The sample size.
y: The number of toxicities.
decision: The dosing decision.
decisionMatrix: The decision matrix corresponding to the
decision data frame.
Kaifeng Lu, [email protected]
Guo, W., Wang, S. J., Yang, S., Lynn, H., & Ji, Y. (2017). A Bayesian interval dose-finding design addressing Ockham's razor: mTPI-2. Contemporary Clinical Trials, 58, 23-33.
mTPI2Table(nMax = 18, pT = 0.3, epsilon1 = 0.05, epsilon2 = 0.05)mTPI2Table(nMax = 18, pT = 0.3, epsilon1 = 0.05, epsilon2 = 0.05)
Obtains the mean and variance from a truncated piecewise exponential distribution.
mtpwexp(piecewiseSurvivalTime = 0L, lambda = NA_real_, lowerBound = 0)mtpwexp(piecewiseSurvivalTime = 0L, lambda = NA_real_, lowerBound = 0)
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
lambda |
A vector of hazard rates for the event. One for each analysis time interval. |
lowerBound |
The left truncation time point for the survival time. Defaults to 0 for no truncation. |
A list with two components, one for the mean, and the other for the variance of the truncated piecewise exponential distribution.
Kaifeng Lu, [email protected]
mtpwexp(piecewiseSurvivalTime = c(0, 6, 9, 15), lambda = c(0.025, 0.04, 0.015, 0.007))mtpwexp(piecewiseSurvivalTime = c(0, 6, 9, 15), lambda = c(0.025, 0.04, 0.015, 0.007))
Obtains the number of subjects at risk at given analysis times for each treatment group.
natrisk( t = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, maxFollowupTime = NA_real_, time = NA_real_ )natrisk( t = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, maxFollowupTime = NA_real_, time = NA_real_ )
t |
A vector of analysis times at which to calculate the number of patients at risk. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
lambda1 |
A vector of hazard rates for the event for the active treatment group. One for each analysis time interval. |
lambda2 |
A vector of hazard rates for the event for the control group. One for each analysis time interval. |
gamma1 |
The hazard rate for exponential dropout, or a vector of hazard rates for piecewise exponential dropout for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, or a vector of hazard rates for piecewise exponential dropout for the control group. |
accrualDuration |
Duration of the enrollment period. |
maxFollowupTime |
Follow-up time for the first enrolled subject.
For fixed follow-up, |
time |
Calendar time for the analysis. |
For a given treatment group and calendar time ,
the number of patients at risk at analysis time is calculated as
where is the
probability of randomization to treatment group ,
is the number of patients enrolled by calendar time
, is the probability of being at risk at
analysis time for a patient in treatment group
after enrollment. Obviously, .
A matrix of the number of patients at risk at the specified analysis times (row) for each treatment group (column).
Kaifeng Lu, [email protected]
# Piecewise accrual, piecewise exponential survivals, and 5% dropout by # the end of 1 year. natrisk(t = c(9, 24), allocationRatioPlanned = 1, accrualTime = c(0, 3), accrualIntensity = c(10, 20), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 12, maxFollowupTime = 30, time = 30)# Piecewise accrual, piecewise exponential survivals, and 5% dropout by # the end of 1 year. natrisk(t = c(9, 24), allocationRatioPlanned = 1, accrualTime = c(0, 3), accrualIntensity = c(10, 20), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 12, maxFollowupTime = 30, time = 30)
Estimates the power for negative binomial rate ratio test.
nbpower( kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRateRatio = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, rateRatioH0 = 1, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, kappa1 = NA_real_, kappa2 = NA_real_, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_, nullVariance = FALSE )nbpower( kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRateRatio = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, rateRatioH0 = 1, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, kappa1 = NA_real_, kappa2 = NA_real_, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_, nullVariance = FALSE )
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilityRateRatio |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
rateRatioH0 |
Rate ratio under the null hypothesis. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
kappa1 |
The dispersion parameter (reciprocal of the shape parameter of the gamma mixing distribution) for the active treatment group by stratum. |
kappa2 |
The dispersion parameter (reciprocal of the shape parameter of the gamma mixing distribution) for the control group by stratum. |
lambda1 |
The rate parameter of the negative binomial distribution for the active treatment group by stratum. |
lambda2 |
The rate parameter of the negative binomial distribution for the control group by stratum. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
studyDuration |
Study duration for fixed follow-up design.
Defaults to missing, which is to be replaced with the sum of
|
nullVariance |
Whether to calculate the variance for log rate ratio under the null hypothesis. |
An S3 class nbpower object with 4 components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
numberOfEvents: The total number of events.
numberOfDropouts: The total number of dropouts.
numbeOfSubjects: The total number of subjects.
exposure: The total exposure.
studyDuration: The total study duration.
information: The maximum information.
expectedNumberOfEvents: The expected number of events.
expectedNumberOfDropouts: The expected number of dropouts.
expectedNumberOfSubjects: The expected number of subjects.
expectedExposure: The expected exposure.
expectedStudyDuration: The expected study duration.
expectedInformation: The expected information.
accrualDuration: The accrual duration.
followupTime: The follow-up duration.
fixedFollowup: Whether a fixed follow-up design is used.
kMax: The number of stages.
rateRatioH0: The rate ratio under the null hypothesis.
rateRatio: The rate ratio.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
numberOfEvents: The number of events.
numberOfDropouts: The number of dropouts.
numberOfSubjects: The number of subjects.
exposure: The exposure.
analysisTime: The average time since trial start.
efficacyRateRatio: The efficacy boundaries on the rate
ratio scale.
futilityRateRatio: The futility boundaries on the rate
ratio scale.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
settings: A list containing the following input parameters:
typeAlphaSpending, parameterAlphaSpending,
userAlphaSpending, typeBetaSpending,
parameterBetaSpending, allocationRatioPlanned,
accrualTime, accuralIntensity,
piecewiseSurvivalTime, kappa1, kappa2,
lambda1, lambda2, gamma1, gamma2,
spendingTime, and nullVariance.
byTreatmentCounts: A list containing the following counts by
treatment group:
numberOfEvents1: The number of events by stage for
the treatment group.
numberOfDropouts1: The number of dropouts by stage for
the treatment group.
numberOfSubjects1: The number of subjects by stage for
the treatment group.
exposure1: The exposure by stage for the treatment group.
numberOfEvents2: The number of events by stage for
the control group.
numberOfDropouts2: The number of dropouts by stage for
the control group.
numberOfSubjects2: The number of subjects by stage for
the control group.
exposure2: The exposure by stage for the control group.
expectedNumberOfEvents1: The expected number of events for
the treatment group.
expectedNumberOfDropouts1: The expected number of dropouts
for the treatment group.
expectedNumberOfSubjects1: The expected number of subjects
for the treatment group.
expectedExposure1: The expected exposure for the treatment
group.
expectedNumberOfEvents2: The expected number of events for
control group.
expectedNumberOfDropouts2: The expected number of dropouts
for the control group.
expectedNumberOfSubjects2: The expected number of subjects
for the control group.
expectedExposure2: The expected exposure for the control
group.
Kaifeng Lu, [email protected]
# Example 1: Variable follow-up design nbpower(kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualIntensity = 1956/1.25, stratumFraction = c(0.2, 0.8), kappa1 = 5, kappa2 = 5, lambda1 = c(0.7*0.125, 0.75*0.25), lambda2 = c(0.125, 0.25), gamma1 = 0, gamma2 = 0, accrualDuration = 1.25, followupTime = 2.75, fixedFollowup = FALSE, nullVariance = 1) # Example 2: Fixed follow-up design nbpower(kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualIntensity = 220/1.5, kappa1 = 3, kappa2 = 3, lambda1 = 0.5*8.4, lambda2 = 8.4, gamma1 = 0, gamma2 = 0, accrualDuration = 1.5, followupTime = 0.5, fixedFollowup = TRUE)# Example 1: Variable follow-up design nbpower(kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualIntensity = 1956/1.25, stratumFraction = c(0.2, 0.8), kappa1 = 5, kappa2 = 5, lambda1 = c(0.7*0.125, 0.75*0.25), lambda2 = c(0.125, 0.25), gamma1 = 0, gamma2 = 0, accrualDuration = 1.25, followupTime = 2.75, fixedFollowup = FALSE, nullVariance = 1) # Example 2: Fixed follow-up design nbpower(kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualIntensity = 220/1.5, kappa1 = 3, kappa2 = 3, lambda1 = 0.5*8.4, lambda2 = 8.4, gamma1 = 0, gamma2 = 0, accrualDuration = 1.5, followupTime = 0.5, fixedFollowup = TRUE)
Estimates the power, stopping probabilities, and expected sample size in a one-group negative binomial design.
nbpower1s( kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRate = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, lambdaH0 = NA_real_, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, kappa = NA_real_, lambda = NA_real_, gamma = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )nbpower1s( kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRate = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, lambdaH0 = NA_real_, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, kappa = NA_real_, lambda = NA_real_, gamma = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilityRate |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
lambdaH0 |
The rate parameter of the negative binomial distribution under the null hypothesis. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
kappa |
The dispersion parameter (reciprocal of the shape parameter of the gamma mixing distribution) of the negative binomial distribution by stratum. |
lambda |
The rate parameter of the negative binomial distribution under the alternative hypothesis by stratum. |
gamma |
The hazard rate for exponential dropout or a vector of hazard rates for piecewise exponential dropout by stratum. Defaults to 0 for no dropout. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
studyDuration |
Study duration for fixed follow-up design.
Defaults to missing, which is to be replaced with the sum of
|
An S3 class nbpower1s object with 3 components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
numberOfEvents: The total number of events.
numberOfDropouts: The total number of dropouts.
numbeOfSubjects: The total number of subjects.
exposure: The total exposure.
studyDuration: The total study duration.
information: The maximum information.
expectedNumberOfEvents: The expected number of events.
expectedNumberOfDropouts: The expected number of dropouts.
expectedNumberOfSubjects: The expected number of subjects.
expectedExposure: The expected exposure.
expectedStudyDuration: The expected study duration.
expectedInformation: The expected information.
accrualDuration: The accrual duration.
followupTime: The follow-up duration.
fixedFollowup: Whether a fixed follow-up design is used.
kMax: The number of stages.
lambdaH0: The rate parameter of the negative binomial
distribution under the null hypothesis.
lambda: The overall rate parameter of the negative binomial
distribution under the alternative hypothesis.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
numberOfEvents: The number of events.
numberOfDropouts: The number of dropouts.
numberOfSubjects: The number of subjects.
exposure: The exposure.
analysisTime: The average time since trial start.
efficacyRate: The efficacy boundaries on the rate scale.
futilityRate: The futility boundaries on the rate scale.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
settings: A list containing the following input parameters:
typeAlphaSpending, parameterAlphaSpending,
userAlphaSpending, typeBetaSpending,
parameterBetaSpending, accrualTime,
accuralIntensity, piecewiseSurvivalTime,
stratumFraction, kappa, lambda, gamma,
and spendingTime.
Kaifeng Lu, [email protected]
# Example 1: Variable follow-up design nbpower1s(kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", lambdaH0 = 0.125, accrualIntensity = 500, stratumFraction = c(0.2, 0.8), kappa = c(3, 5), lambda = c(0.0875, 0.085), gamma = 0, accrualDuration = 1.25, followupTime = 2.75, fixedFollowup = FALSE) # Example 2: Fixed follow-up design nbpower1s(kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", lambdaH0 = 8.4, accrualIntensity = 40, kappa = 3, lambda = 0.5*8.4, gamma = 0, accrualDuration = 1.5, followupTime = 0.5, fixedFollowup = TRUE)# Example 1: Variable follow-up design nbpower1s(kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", lambdaH0 = 0.125, accrualIntensity = 500, stratumFraction = c(0.2, 0.8), kappa = c(3, 5), lambda = c(0.0875, 0.085), gamma = 0, accrualDuration = 1.25, followupTime = 2.75, fixedFollowup = FALSE) # Example 2: Fixed follow-up design nbpower1s(kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", lambdaH0 = 8.4, accrualIntensity = 40, kappa = 3, lambda = 0.5*8.4, gamma = 0, accrualDuration = 1.5, followupTime = 0.5, fixedFollowup = TRUE)
Obtains the power for equivalence in negative binomial rate ratio.
nbpowerequiv( kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, rateRatioLower = NA_real_, rateRatioUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, kappa1 = NA_real_, kappa2 = NA_real_, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )nbpowerequiv( kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, rateRatioLower = NA_real_, rateRatioUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, kappa1 = NA_real_, kappa2 = NA_real_, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
rateRatioLower |
The lower equivalence limit of rate ratio. |
rateRatioUpper |
The upper equivalence limit of rate ratio. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
kappa1 |
The dispersion parameter (reciprocal of the shape parameter of the gamma mixing distribution) for the active treatment group by stratum. |
kappa2 |
The dispersion parameter (reciprocal of the shape parameter of the gamma mixing distribution) for the control group by stratum. |
lambda1 |
The rate parameter of the negative binomial distribution for the active treatment group by stratum. |
lambda2 |
The rate parameter of the negative binomial distribution for the control group by stratum. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
studyDuration |
Study duration for fixed follow-up design.
Defaults to missing, which is to be replaced with the sum of
|
An S3 class nbpowerequiv object with 4 components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
numberOfEvents: The total number of events.
numbeOfSubjects: The total number of subjects.
exposure: The total exposure.
studyDuration: The total study duration.
information: The maximum information.
expectedNumberOfEvents: The expected number of events.
expectedNumberOfSubjects: The expected number of subjects.
expectedExposure: The expected exposure.
expectedStudyDuration: The expected study duration.
expectedInformation: The expected information.
kMax: The number of stages.
rateRatioLower: The lower equivalence limit of rate ratio.
rateRatioUpper: The upper equivalence limit of rate ratio.
rateRatio: The rate ratio.
accrualDuration: The accrual duration.
followupTime: The follow-up duration.
fixedFollowup: Whether a fixed follow-up design is used.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale for
each of the two one-sided tests.
rejectPerStage: The probability for efficacy stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeAlphaSpent: The cumulative alpha for each of
the two one-sided tests.
cumulativeAttainedAlphaH10: The cumulative alpha attained
under H10.
cumulativeAttainedAlphaH20: The cumulative alpha attained
under H20.
numberOfEvents: The number of events.
numberOfDropouts: The number of dropouts.
numberOfSubjects: The number of subjects.
exposure: The exposure.
analysisTime: The average time since trial start.
efficacyRateRatioLower: The efficacy boundaries on the
rate ratio scale for the one-sided null hypothesis at the
lower equivalence limit.
efficacyRateRatioUpper: The efficacy boundaries on the
rate ratio scale for the one-sided null hypothesis at the
upper equivalence limit.
efficacyP: The efficacy bounds on the p-value scale for
each of the two one-sided tests.
information: The cumulative information.
settings: A list containing the following input parameters:
typeAlphaSpending, parameterAlphaSpending,
userAlphaSpending, allocationRatioPlanned,
accrualTime, accuralIntensity,
piecewiseSurvivalTime, stratumFraction,
kappa1, kappa2,
lambda1, lambda2, gamma1, gamma2,
spendingTime.
byTreatmentCounts: A list containing the following counts by
treatment group:
numberOfEvents1: The number of events by stage for
the treatment group.
numberOfDropouts1: The number of dropouts by stage for
the treatment group.
numberOfSubjects1: The number of subjects by stage for
the treatment group.
exposure1: The exposure by stage for the treatment group.
numberOfEvents2: The number of events by stage for
the control group.
numberOfDropouts2: The number of dropouts by stage for
the control group.
numberOfSubjects2: The number of subjects by stage for
the control group.
exposure2: The exposure by stage for the control group.
expectedNumberOfEvents1: The expected number of events for
the treatment group.
expectedNumberOfDropouts1: The expected number of dropouts
for the treatment group.
expectedNumberOfSubjects1: The expected number of subjects
for the treatment group.
expectedExposure1: The expected exposure for the treatment
group.
expectedNumberOfEvents2: The expected number of events for
control group.
expectedNumberOfDropouts2: The expected number of dropouts
for the control group.
expectedNumberOfSubjects2: The expected number of subjects
for the control group.
expectedExposure2: The expected exposure for the control
group.
Kaifeng Lu, [email protected]
# Example 1: Variable follow-up design nbpowerequiv(kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", rateRatioLower = 2/3, rateRatioUpper = 3/2, accrualIntensity = 1956/1.25, kappa1 = 5, kappa2 = 5, lambda1 = 0.125, lambda2 = 0.125, gamma1 = 0, gamma2 = 0, accrualDuration = 1.25, followupTime = 2.75, fixedFollowup = FALSE) # Example 2: Fixed follow-up design nbpowerequiv(kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", rateRatioLower = 0.5, rateRatioUpper = 2, accrualIntensity = 220/1.5, stratumFraction = c(0.2, 0.8), kappa1 = 3, kappa2 = 3, lambda1 = c(8.4, 10.2), lambda2 = c(8.0, 11.5), gamma1 = 0, gamma2 = 0, accrualDuration = 1.5, followupTime = 0.5, fixedFollowup = TRUE)# Example 1: Variable follow-up design nbpowerequiv(kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", rateRatioLower = 2/3, rateRatioUpper = 3/2, accrualIntensity = 1956/1.25, kappa1 = 5, kappa2 = 5, lambda1 = 0.125, lambda2 = 0.125, gamma1 = 0, gamma2 = 0, accrualDuration = 1.25, followupTime = 2.75, fixedFollowup = FALSE) # Example 2: Fixed follow-up design nbpowerequiv(kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", rateRatioLower = 0.5, rateRatioUpper = 2, accrualIntensity = 220/1.5, stratumFraction = c(0.2, 0.8), kappa1 = 3, kappa2 = 3, lambda1 = c(8.4, 10.2), lambda2 = c(8.0, 11.5), gamma1 = 0, gamma2 = 0, accrualDuration = 1.5, followupTime = 0.5, fixedFollowup = TRUE)
Obtains the needed accrual duration given power and follow-up time, the needed follow-up time given power and accrual duration, or the needed absolute accrual rates given power, accrual duration, follow-up duration, and relative accrual rates in a two-group negative binomial design.
nbsamplesize( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRateRatio = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, rateRatioH0 = 1, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, kappa1 = NA_real_, kappa2 = NA_real_, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, rounding = TRUE, nullVariance = FALSE )nbsamplesize( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRateRatio = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, rateRatioH0 = 1, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, kappa1 = NA_real_, kappa2 = NA_real_, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, rounding = TRUE, nullVariance = FALSE )
beta |
Type II error. Defaults to 0.2. |
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilityRateRatio |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
rateRatioH0 |
Rate ratio under the null hypothesis. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
kappa1 |
The dispersion parameter (reciprocal of the shape parameter of the gamma mixing distribution) for the active treatment group by stratum. |
kappa2 |
The dispersion parameter (reciprocal of the shape parameter of the gamma mixing distribution) for the control group by stratum. |
lambda1 |
The rate parameter of the negative binomial distribution for the active treatment group by stratum. |
lambda2 |
The rate parameter of the negative binomial distribution for the control group by stratum. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
nullVariance |
Whether to calculate the variance for log rate ratio under the null hypothesis. |
A list of two components:
resultsUnderH1: An S3 class nbpower object under the
alternative hypothesis.
resultsUnderH0: An S3 class nbpower object under the
null hypothesis.
Kaifeng Lu, [email protected]
# Example 1: Obtains follow-up duration given power, accrual intensity, # and accrual duration for variable follow-up nbsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualIntensity = 1956/1.25, kappa1 = 5, kappa2 = 5, lambda1 = 0.0875, lambda2 = 0.125, gamma1 = 0, gamma2 = 0, accrualDuration = 1.25, followupTime = NA, fixedFollowup = FALSE) # Example 2: Obtains accrual intensity given power, accrual duration, and # follow-up duration for variable follow-up nbsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualIntensity = 100, kappa1 = 5, kappa2 = 5, lambda1 = 0.0875, lambda2 = 0.125, gamma1 = 0, gamma2 = 0, accrualDuration = 1.25, followupTime = 2.25, fixedFollowup = FALSE) # Example 3: Obtains accrual duration given power, accrual intensity, and # follow-up duration for fixed follow-up nbsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualIntensity = 1667, stratumFraction = c(0.2, 0.8), kappa1 = 5, kappa2 = 5, lambda1 = c(0.7*0.125, 0.75*0.25), lambda2 = c(0.125, 0.25), gamma1 = 0, gamma2 = 0, accrualDuration = NA, followupTime = 0.5, fixedFollowup = TRUE)# Example 1: Obtains follow-up duration given power, accrual intensity, # and accrual duration for variable follow-up nbsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualIntensity = 1956/1.25, kappa1 = 5, kappa2 = 5, lambda1 = 0.0875, lambda2 = 0.125, gamma1 = 0, gamma2 = 0, accrualDuration = 1.25, followupTime = NA, fixedFollowup = FALSE) # Example 2: Obtains accrual intensity given power, accrual duration, and # follow-up duration for variable follow-up nbsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualIntensity = 100, kappa1 = 5, kappa2 = 5, lambda1 = 0.0875, lambda2 = 0.125, gamma1 = 0, gamma2 = 0, accrualDuration = 1.25, followupTime = 2.25, fixedFollowup = FALSE) # Example 3: Obtains accrual duration given power, accrual intensity, and # follow-up duration for fixed follow-up nbsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", accrualIntensity = 1667, stratumFraction = c(0.2, 0.8), kappa1 = 5, kappa2 = 5, lambda1 = c(0.7*0.125, 0.75*0.25), lambda2 = c(0.125, 0.25), gamma1 = 0, gamma2 = 0, accrualDuration = NA, followupTime = 0.5, fixedFollowup = TRUE)
Obtains the needed accrual duration given power and follow-up time, the needed follow-up time given power and accrual duration, or the needed absolute accrual rates given power, accrual duration, follow-up duration, and relative accrual rates in a one-group negative binomial design.
nbsamplesize1s( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRate = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, lambdaH0 = NA_real_, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, kappa = NA_real_, lambda = NA_real_, gamma = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, rounding = TRUE )nbsamplesize1s( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRate = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, lambdaH0 = NA_real_, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, kappa = NA_real_, lambda = NA_real_, gamma = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, rounding = TRUE )
beta |
Type II error. Defaults to 0.2. |
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilityRate |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
lambdaH0 |
The rate parameter of the negative binomial distribution under the null hypothesis. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
kappa |
The dispersion parameter (reciprocal of the shape parameter of the gamma mixing distribution) of the negative binomial distribution by stratum. |
lambda |
The rate parameter of the negative binomial distribution under the alternative hypothesis by stratum. |
gamma |
The hazard rate for exponential dropout or a vector of hazard rates for piecewise exponential dropout by stratum. Defaults to 0 for no dropout. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
A list of two components:
resultsUnderH1: An S3 class nbpower1s object under the
alternative hypothesis.
resultsUnderH0: An S3 class nbpower1s object under the
null hypothesis.
Kaifeng Lu, [email protected]
# Example 1: Obtains follow-up duration given power, accrual intensity, # and accrual duration for variable follow-up nbsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", lambdaH0 = 0.125, accrualIntensity = 500, stratumFraction = c(0.2, 0.8), kappa = c(3, 5), lambda = c(0.0875, 0.085), gamma = 0, accrualDuration = 1.25, followupTime = NA, fixedFollowup = FALSE) # Example 2: Obtains accrual intensity given power, accrual duration, and # follow-up duration for variable follow-up nbsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", lambdaH0 = 0.125, accrualIntensity = 100, kappa = 5, lambda = 0.0875, gamma = 0, accrualDuration = 1.25, followupTime = 2.25, fixedFollowup = FALSE) # Example 3: Obtains accrual duration given power, accrual intensity, and # follow-up duration for fixed follow-up nbsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", lambdaH0 = 8.4, accrualIntensity = 40, kappa = 3, lambda = 4.2, gamma = 0, accrualDuration = NA, followupTime = 0.5, fixedFollowup = TRUE)# Example 1: Obtains follow-up duration given power, accrual intensity, # and accrual duration for variable follow-up nbsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", lambdaH0 = 0.125, accrualIntensity = 500, stratumFraction = c(0.2, 0.8), kappa = c(3, 5), lambda = c(0.0875, 0.085), gamma = 0, accrualDuration = 1.25, followupTime = NA, fixedFollowup = FALSE) # Example 2: Obtains accrual intensity given power, accrual duration, and # follow-up duration for variable follow-up nbsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", lambdaH0 = 0.125, accrualIntensity = 100, kappa = 5, lambda = 0.0875, gamma = 0, accrualDuration = 1.25, followupTime = 2.25, fixedFollowup = FALSE) # Example 3: Obtains accrual duration given power, accrual intensity, and # follow-up duration for fixed follow-up nbsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.5, 1), alpha = 0.025, typeAlphaSpending = "sfOF", lambdaH0 = 8.4, accrualIntensity = 40, kappa = 3, lambda = 4.2, gamma = 0, accrualDuration = NA, followupTime = 0.5, fixedFollowup = TRUE)
Obtains the sample size for equivalence in negative binomial rate ratio.
nbsamplesizeequiv( beta = 0.2, kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, rateRatioLower = NA_real_, rateRatioUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, kappa1 = NA_real_, kappa2 = NA_real_, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, rounding = TRUE )nbsamplesizeequiv( beta = 0.2, kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, rateRatioLower = NA_real_, rateRatioUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, kappa1 = NA_real_, kappa2 = NA_real_, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, rounding = TRUE )
beta |
The type II error. |
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
rateRatioLower |
The lower equivalence limit of rate ratio. |
rateRatioUpper |
The upper equivalence limit of rate ratio. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
kappa1 |
The dispersion parameter (reciprocal of the shape parameter of the gamma mixing distribution) for the active treatment group by stratum. |
kappa2 |
The dispersion parameter (reciprocal of the shape parameter of the gamma mixing distribution) for the control group by stratum. |
lambda1 |
The rate parameter of the negative binomial distribution for the active treatment group by stratum. |
lambda2 |
The rate parameter of the negative binomial distribution for the control group by stratum. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
An S3 class nbpowerequiv object
Kaifeng Lu, [email protected]
# Example 1: Variable follow-up design and solve for follow-up time nbsamplesizeequiv(beta = 0.1, kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", rateRatioLower = 2/3, rateRatioUpper = 3/2, accrualIntensity = 1956/1.25, stratumFraction = c(0.2, 0.8), kappa1 = c(3, 5), kappa2 = c(2, 3), lambda1 = c(0.125, 0.165), lambda2 = c(0.135, 0.175), gamma1 = -log(1-0.05), gamma2 = -log(1-0.10), accrualDuration = 1.25, followupTime = NA, fixedFollowup = FALSE) # Example 2: Fixed follow-up design and solve for accrual duration nbsamplesizeequiv(beta = 0.2, kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", rateRatioLower = 0.5, rateRatioUpper = 2, accrualIntensity = 220/1.5, kappa1 = 3, kappa2 = 3, lambda1 = 8.4, lambda2 = 8.4, gamma1 = 0, gamma2 = 0, accrualDuration = NA, followupTime = 0.5, fixedFollowup = TRUE)# Example 1: Variable follow-up design and solve for follow-up time nbsamplesizeequiv(beta = 0.1, kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", rateRatioLower = 2/3, rateRatioUpper = 3/2, accrualIntensity = 1956/1.25, stratumFraction = c(0.2, 0.8), kappa1 = c(3, 5), kappa2 = c(2, 3), lambda1 = c(0.125, 0.165), lambda2 = c(0.135, 0.175), gamma1 = -log(1-0.05), gamma2 = -log(1-0.10), accrualDuration = 1.25, followupTime = NA, fixedFollowup = FALSE) # Example 2: Fixed follow-up design and solve for accrual duration nbsamplesizeequiv(beta = 0.2, kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", rateRatioLower = 0.5, rateRatioUpper = 2, accrualIntensity = 220/1.5, kappa1 = 3, kappa2 = 3, lambda1 = 8.4, lambda2 = 8.4, gamma1 = 0, gamma2 = 0, accrualDuration = NA, followupTime = 0.5, fixedFollowup = TRUE)
Obtains the number of subjects accrued, number of events, number of dropouts, number of subjects reaching the maximum follow-up, total exposure, and variance for log rate in each group, rate ratio, variance, and Wald test statistic of log rate ratio at given calendar times.
nbstat( time = NA_real_, rateRatioH0 = 1, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, kappa1 = NA_real_, kappa2 = NA_real_, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, nullVariance = FALSE )nbstat( time = NA_real_, rateRatioH0 = 1, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, kappa1 = NA_real_, kappa2 = NA_real_, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, nullVariance = FALSE )
time |
A vector of calendar times for data cut. |
rateRatioH0 |
Rate ratio under the null hypothesis. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
kappa1 |
The dispersion parameter (reciprocal of the shape parameter of the gamma mixing distribution) for the active treatment group by stratum. |
kappa2 |
The dispersion parameter (reciprocal of the shape parameter of the gamma mixing distribution) for the control group by stratum. |
lambda1 |
The rate parameter of the negative binomial distribution for the active treatment group by stratum. |
lambda2 |
The rate parameter of the negative binomial distribution for the control group by stratum. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
nullVariance |
Whether to calculate the variance for log rate ratio under the null hypothesis. |
The probability mass function for a negative binomial distribution with
dispersion parameter and rate parameter
is given by
where is the event count for subject in
treatment group , and is the exposure time for
the subject. If , the negative binomial distribution
reduces to the Poisson distribution.
For treatment group , let .
The log-likelihood for
can be written as
It follows that
and
The Fisher information for is
In addition, we can show that
Therefore, the variance of is
To evaluate the integral, we need to obtain the distribution of the exposure time,
where denotes the calendar time since trial start,
denotes the enrollment time for subject
in treatment group , denotes the time to dropout
after enrollment for subject in treatment group , and
denotes the maximum follow-up time for
all subjects. Therefore,
Let denote the distribution function of the enrollment time,
and denote the survival function of the dropout time for
treatment group . By the change of variables, we have
A numerical integration algorithm for a univariate function can be used to evaluate the above integral.
For the restricted maximum likelihood (reml) estimate of
subject to the
constraint that , we express the
log-likelihood in terms of ,
and takes the derivative of the log-likelihood function with respect
to . The resulting score equation has asymptotic limit
where
and
Here is the randomization probability for the active
treatment group. The asymptotic limit of the reml of
is the solution to
A list with two components:
resultsUnderH1: A data frame containing the following variables:
time: The analysis time since trial start.
subjects: The number of enrolled subjects.
nevents: The total number of events.
nevents1: The number of events in the active treatment
group.
nevents2: The number of events in the control group.
ndropouts: The total number of dropouts.
ndropouts1: The number of dropouts in the active treatment
group.
ndropouts2: The number of dropouts in the control group.
nfmax: The total number of subjects reaching maximum
follow-up.
nfmax1: The number of subjects reaching maximum follow-up
in the active treatment group.
nfmax2: The number of subjects reaching maximum follow-up
in the control group.
exposure: The total exposure time.
exposure1: The exposure time for the active treatment group.
exposure2: The exposure time for the control group.
rateRatio: The rate ratio of the active treatment group
versus the control group.
vlogRate1: The variance for the log rate
parameter for the active treatment group.
vlogRate2: The variance for the log rate
parameter for the control group.
vlogRR: The variance of log rate ratio.
information: The information of log rate ratio.
zlogRR: The Z-statistic for log rate ratio.
resultsUnderH0 when nullVariance = TRUE: A data frame
with the following variables:
time: The analysis time since trial start.
lambda1H0: The restricted maximum likelihood estimate
of the event rate for the active treatment group.
lambda2H0: The restricted maximum likelihood estimate
of the event rate for the control group.
rateRatioH0: The rate ratio under H0.
vlogRate1H0: The variance for the log rate
parameter for the active treatment group under H0.
vlogRate2H0: The variance for the log rate
parameter for the control group under H0.
vlogRRH0: The variance of log rate ratio under H0.
informationH0: The information of log rate ratio under H0.
zlogRRH0: The Z-statistic for log rate ratio with variance
evaluated under H0.
varianceRatio: The ratio of the variance under H0 versus
the variance under H1.
lambda1: The true event rate for the active treatment group.
lambda2: The true event rate for the control group.
rateRatio: The true rate ratio.
resultsUnderH0 when nullVariance = FALSE: A data frame
with the following variables:
time: The analysis time since trial start.
rateRatioH0: The rate ratio under H0.
varianceRatio: Equal to 1.
lambda1: The true event rate for the active treatment group.
lambda2: The true event rate for the control group.
rateRatio: The true rate ratio.
Kaifeng Lu, [email protected]
# Example 1: Variable follow-up design nbstat(time = c(1, 1.25, 2, 3, 4), accrualIntensity = 1956/1.25, kappa1 = 5, kappa2 = 5, lambda1 = 0.7*0.125, lambda2 = 0.125, gamma1 = 0, gamma2 = 0, accrualDuration = 1.25, followupTime = 2.75) # Example 2: Fixed follow-up design nbstat(time = c(0.5, 1, 1.5, 2), accrualIntensity = 220/1.5, stratumFraction = c(0.2, 0.8), kappa1 = 3, kappa2 = 3, lambda1 = c(0.5*8.4, 0.6*10.5), lambda2 = c(8.4, 10.5), gamma1 = 0, gamma2 = 0, accrualDuration = 1.5, followupTime = 0.5, fixedFollowup = 1, nullVariance = 1)# Example 1: Variable follow-up design nbstat(time = c(1, 1.25, 2, 3, 4), accrualIntensity = 1956/1.25, kappa1 = 5, kappa2 = 5, lambda1 = 0.7*0.125, lambda2 = 0.125, gamma1 = 0, gamma2 = 0, accrualDuration = 1.25, followupTime = 2.75) # Example 2: Fixed follow-up design nbstat(time = c(0.5, 1, 1.5, 2), accrualIntensity = 220/1.5, stratumFraction = c(0.2, 0.8), kappa1 = 3, kappa2 = 3, lambda1 = c(0.5*8.4, 0.6*10.5), lambda2 = c(8.4, 10.5), gamma1 = 0, gamma2 = 0, accrualDuration = 1.5, followupTime = 0.5, fixedFollowup = 1, nullVariance = 1)
Obtains the number of subjects having an event by given calendar times for each treatment group.
nevent( time = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, maxFollowupTime = NA_real_ )nevent( time = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, maxFollowupTime = NA_real_ )
time |
A vector of calendar times at which to calculate the number of patients having an event. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
lambda1 |
A vector of hazard rates for the event for the active treatment group. One for each analysis time interval. |
lambda2 |
A vector of hazard rates for the event for the control group. One for each analysis time interval. |
gamma1 |
The hazard rate for exponential dropout, or a vector of hazard rates for piecewise exponential dropout for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, or a vector of hazard rates for piecewise exponential dropout for the control group. |
accrualDuration |
Duration of the enrollment period. |
maxFollowupTime |
Follow-up time for the first enrolled subject.
For fixed follow-up, |
For a given treatment group and calendar time ,
the number of patients having an event by calendar time is
calculated as , where
and
where is the probability of randomization to treatment group ,
is the number of patients enrolled by
calendar time ,
is the probability of having an event by
the maximum follow-up time for a patient in
treatment group after enrollment,
is the accrual intensity at calendar time ,
and is the probability of having an event by
calendar time for a patient in treatment group
enrolled at calendar time .
A matrix of the number of patients having an event at the specified calendar times (row) for each treatment group (column).
Kaifeng Lu, [email protected]
# Piecewise accrual, piecewise exponential survivals, and 5% dropout by # the end of 1 year. nevent(time = c(9, 24), allocationRatioPlanned = 1, accrualTime = c(0, 3), accrualIntensity = c(10, 20), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 12, maxFollowupTime = 30)# Piecewise accrual, piecewise exponential survivals, and 5% dropout by # the end of 1 year. nevent(time = c(9, 24), allocationRatioPlanned = 1, accrualTime = c(0, 3), accrualIntensity = c(10, 20), piecewiseSurvivalTime = c(0, 6), lambda1 = c(0.0533, 0.0309), lambda2 = c(0.0533, 0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 12, maxFollowupTime = 30)
Obtains the probability of being at risk at given analysis times.
patrisk(time, piecewiseSurvivalTime, lambda, gamma)patrisk(time, piecewiseSurvivalTime, lambda, gamma)
time |
A vector of analysis times at which to calculate the probability of being at risk. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
lambda |
A vector of hazard rates for the event. One for each analysis time interval. |
gamma |
The hazard rate for exponential dropout, or a vector of hazard rates for piecewise exponential dropout. |
A vector of probabilities of being at risk at the specified analysis times after enrollment for a patient in a treatment group with specified piecewise exponential survival and dropout distributions.
Kaifeng Lu, [email protected]
# Piecewise exponential survival with hazard 0.0533 in the first 6 # months, and hazard 0.0309 thereafter, and 5% dropout by the end of # 1 year. patrisk(time = c(3, 9), piecewiseSurvivalTime = c(0, 6), lambda = c(0.0533, 0.0309), gamma = -log(1-0.05)/12)# Piecewise exponential survival with hazard 0.0533 in the first 6 # months, and hazard 0.0309 thereafter, and 5% dropout by the end of # 1 year. patrisk(time = c(3, 9), piecewiseSurvivalTime = c(0, 6), lambda = c(0.0533, 0.0309), gamma = -log(1-0.05)/12)
Computes the cumulative distribution function (CDF) of the standard bivariate normal distribution with specified lower and upper integration limits and correlation coefficient.
pbvnorm(lower = NA_real_, upper = NA_real_, rho = 0)pbvnorm(lower = NA_real_, upper = NA_real_, rho = 0)
lower |
A numeric vector of length 2 specifying the lower limits of integration. |
upper |
A numeric vector of length 2 specifying the upper limits of integration. |
rho |
A numeric value specifying the correlation coefficient of the standard bivariate normal distribution. |
This function evaluates the probability
where
follows a standard bivariate normal
distribution with correlation corr.
A numeric value representing the probability that a standard bivariate normal vector falls within the specified rectangular region.
Kaifeng Lu, [email protected]
pbvnorm(c(-1, -1), c(1, 1), 0.5)pbvnorm(c(-1, -1), c(1, 1), 0.5)
Obtains the probability of having an event at given analysis times.
pevent(time, piecewiseSurvivalTime, lambda, gamma)pevent(time, piecewiseSurvivalTime, lambda, gamma)
time |
A vector of analysis times at which to calculate the probability of having an event. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
lambda |
A vector of hazard rates for the event. One for each analysis time interval. |
gamma |
The hazard rate for exponential dropout, or a vector of hazard rates for piecewise exponential dropout. |
A vector of probabilities of having an event at the specified analysis times after enrollment for a patient in a treatment group with specified piecewise exponential survival and dropout distributions.
Kaifeng Lu, [email protected]
# Piecewise exponential survival with hazard 0.0533 in the first 6 # months, and hazard 0.0309 thereafter, and 5% dropout by the end of # 1 year. pevent(time = c(3, 9), piecewiseSurvivalTime = c(0, 6), lambda = c(0.0533, 0.0309), gamma = -log(1-0.05)/12)# Piecewise exponential survival with hazard 0.0533 in the first 6 # months, and hazard 0.0309 thereafter, and 5% dropout by the end of # 1 year. pevent(time = c(3, 9), piecewiseSurvivalTime = c(0, 6), lambda = c(0.0533, 0.0309), gamma = -log(1-0.05)/12)
Obtains the hazard ratio estimates from the proportional hazards regression model with right censored or counting process data.
phregr( data, stratum = "", time = "time", time2 = "", event = "event", covariates = "", weight = "", offset = "", id = "", ties = "efron", init = NA_real_, robust = FALSE, est_basehaz = TRUE, est_resid = TRUE, firth = FALSE, plci = FALSE, alpha = 0.05, maxiter = 50, eps = 1e-09 )phregr( data, stratum = "", time = "time", time2 = "", event = "event", covariates = "", weight = "", offset = "", id = "", ties = "efron", init = NA_real_, robust = FALSE, est_basehaz = TRUE, est_resid = TRUE, firth = FALSE, plci = FALSE, alpha = 0.05, maxiter = 50, eps = 1e-09 )
data |
The input data frame that contains the following variables:
|
stratum |
The name(s) of the stratum variable(s) in the input data. |
time |
The name of the time variable or the left end of each interval for counting process data in the input data. |
time2 |
The name of the right end of each interval for counting process data in the input data. |
event |
The name of the event variable in the input data. |
covariates |
The vector of names of baseline and time-dependent covariates in the input data. |
weight |
The name of the weight variable in the input data. |
offset |
The name of the offset variable in the input data. |
id |
The name of the id variable in the input data. |
ties |
The method for handling ties, either "breslow" or "efron" (default). |
init |
The vector of initial values. Defaults to zero for all variables. |
robust |
Whether a robust sandwich variance estimate should be computed. In the presence of the id variable, the score residuals will be aggregated for each id when computing the robust sandwich variance estimate. |
est_basehaz |
Whether to estimate the baseline hazards.
Defaults to |
est_resid |
Whether to estimate the martingale residuals.
Defaults to |
firth |
Whether to use Firth’s penalized likelihood method.
Defaults to |
plci |
Whether to obtain profile likelihood confidence interval. |
alpha |
The two-sided significance level. |
maxiter |
The maximum number of iterations. |
eps |
The tolerance to declare convergence. |
A list with the following components:
sumstat: The data frame of summary statistics of model fit
with the following variables:
n: The number of observations.
nevents: The number of events.
loglik0: The (penalized) log-likelihood under null.
loglik1: The maximum (penalized) log-likelihood.
scoretest: The score test statistic.
niter: The number of Newton-Raphson iterations.
ties: The method for handling ties, either "breslow" or
"efron".
p: The number of columns of the Cox model design matrix.
robust: Whether to use the robust variance estimate.
firth: Whether to use Firth's penalized likelihood method.
fail: Whether the model fails to converge.
loglik0_unpenalized: The unpenalized log-likelihood under null.
loglik1_unpenalized: The maximum unpenalized log-likelihood.
parest: The data frame of parameter estimates with the
following variables:
param: The name of the covariate for the parameter estimate.
beta: The log hazard ratio estimate.
sebeta: The standard error of log hazard ratio estimate.
z: The Wald test statistic for log hazard ratio.
expbeta: The hazard ratio estimate.
lower: The lower limit of confidence interval.
upper: The upper limit of confidence interval.
p: The p-value from the chi-square test.
method: The method to compute the confidence interval and
p-value.
sebeta_naive: The naive standard error of log hazard ratio
estimate if robust variance is requested.
basehaz: The data frame of baseline hazards with the following
variables (if est_basehaz is TRUE):
time: The observed event time.
nrisk: The number of patients at risk at the time point.
nevent: The number of events at the time point.
haz: The baseline hazard at the time point.
varhaz: The variance of the baseline hazard at the time point
assuming the parameter beta is known.
gradhaz: The gradient of the baseline hazard with respect to
beta at the time point (in the presence of covariates).
stratum: The stratum.
residuals: The martingale residuals.
linear_predictors: The vector of linear predictors.
p: The number of parameters.
param: The parameter names.
beta: The parameter estimate.
vbeta: The covariance matrix for parameter estimates.
vbeta_naive: The naive covariance matrix for parameter estimates.
terms: The terms object.
xlevels: A record of the levels of the factors used in fitting.
settings: A list containing the input parameter values.
Kaifeng Lu, [email protected]
Per K. Anderson and Richard D. Gill. Cox's regression model for counting processes, a large sample study. Annals of Statistics 1982; 10:1100-1120.
Terry M. Therneau and Patricia M. Grambsch. Modeling Survival Data: Extending the Cox Model. Springer-Verlag, 2000.
library(dplyr) # Example 1 with right-censored data (fit1 <- phregr( data = rawdata %>% filter(iterationNumber == 1) %>% mutate(treat = 1*(treatmentGroup == 1)), stratum = "stratum", time = "timeUnderObservation", event = "event", covariates = "treat", est_basehaz = FALSE, est_resid = FALSE)) # Example 2 with counting process data and robust variance estimate (fit2 <- phregr( data = heart %>% mutate(rx = as.numeric(transplant) - 1), time = "start", time2 = "stop", event = "event", covariates = c("rx", "age"), id = "id", robust = TRUE, est_basehaz = TRUE, est_resid = TRUE))library(dplyr) # Example 1 with right-censored data (fit1 <- phregr( data = rawdata %>% filter(iterationNumber == 1) %>% mutate(treat = 1*(treatmentGroup == 1)), stratum = "stratum", time = "timeUnderObservation", event = "event", covariates = "treat", est_basehaz = FALSE, est_resid = FALSE)) # Example 2 with counting process data and robust variance estimate (fit2 <- phregr( data = heart %>% mutate(rx = as.numeric(transplant) - 1), time = "start", time2 = "stop", event = "event", covariates = c("rx", "age"), id = "id", robust = TRUE, est_basehaz = TRUE, est_resid = TRUE))
Computes the probability that a multivariate normal random vector falls within a rectangular region defined by lower and upper bounds.
pmvnormr( lower = NULL, upper = NULL, mean = NULL, sigma, n0 = 1024, n_max = 16384, R = 8, abseps = 1e-04, releps = 0, seed = 0, parallel = TRUE, nthreads = 0 )pmvnormr( lower = NULL, upper = NULL, mean = NULL, sigma, n0 = 1024, n_max = 16384, R = 8, abseps = 1e-04, releps = 0, seed = 0, parallel = TRUE, nthreads = 0 )
lower |
A numeric vector of lower integration limits. |
upper |
A numeric vector of upper integration limits. |
mean |
The mean vector. If |
sigma |
The covariance (or correlation) matrix of the distribution. |
n0 |
Initial number of samples per replication for the Monte Carlo integration. |
n_max |
Maximum number of samples allowed per replication. |
R |
Number of independent replications used to estimate the error. |
abseps |
Absolute error tolerance for the probability calculation. |
releps |
Relative error tolerance for the probability calculation. |
seed |
Random seed for reproducibility. If 0, a seed is generated from the computer clock. |
parallel |
Logical; if |
nthreads |
Number of threads for parallel execution. If 0, the default RcppParallel behavior is used. |
The function automatically selects the most efficient computation method based on the input:
Analytic Methods: Used for univariate cases or multivariate distributions with a compound symmetry correlation structure and non-negative correlations.
Monte Carlo Estimation: Used for all other cases. The algorithm employs a randomized quasi-Monte Carlo (QMC) approach using generalized Halton sequences.
To improve efficiency and accuracy, the QMC approach incorporates:
Sequential Conditioning: Mimics the standardization and transformation
approach used in mvtnorm::lpmvnorm, reducing the -dimensional
integral to a -dimensional problem over a hypercube.
Adaptive Sampling: The number of samples per replication increases
dynamically until the estimated error falls below abseps or
releps, or until n_max is reached.
The standard error is derived from independent replications.
For high-dimensional problems, computations can be accelerated by
setting parallel = TRUE, which distributes the replications across
multiple CPU threads via nthreads.
The estimated probability with the following attributes:
method: "exact" for analytic methods or "qmc" for
the Monte Carlo approach.
error: The estimated error (half-width of 95% confidence interval).
nsamples: The total number of samples used across all replications.
Kaifeng Lu, [email protected]
# Example 1: Compound symmetry covariance structure and analytic method n <- 5 mean <- rep(0, n) lower <- rep(-1, n) upper <- rep(3, n) sigma <- matrix(0.5, n, n) diag(sigma) <- 1 pmvnormr(lower, upper, mean, sigma) # Example 2: General covariance structure and Monte Carlo method n <- 5 mean <- rep(0, n) lower <- rep(-1, n) upper <- rep(3, n) sigma <- matrix(c(1, 0.5, 0.3, 0.2, 0.1, 0.5, 1, 0.4, 0.3, 0.2, 0.3, 0.4, 1, 0.5, 0.3, 0.2, 0.3, 0.5, 1, 0.4, 0.1, 0.2, 0.3, 0.4, 1), nrow = n) pmvnormr(lower, upper, mean, sigma, seed = 314159)# Example 1: Compound symmetry covariance structure and analytic method n <- 5 mean <- rep(0, n) lower <- rep(-1, n) upper <- rep(3, n) sigma <- matrix(0.5, n, n) diag(sigma) <- 1 pmvnormr(lower, upper, mean, sigma) # Example 2: General covariance structure and Monte Carlo method n <- 5 mean <- rep(0, n) lower <- rep(-1, n) upper <- rep(3, n) sigma <- matrix(c(1, 0.5, 0.3, 0.2, 0.1, 0.5, 1, 0.4, 0.3, 0.2, 0.3, 0.4, 1, 0.5, 0.3, 0.2, 0.3, 0.5, 1, 0.4, 0.1, 0.2, 0.3, 0.4, 1), nrow = n) pmvnormr(lower, upper, mean, sigma, seed = 314159)
Obtains the probability of a truncated piecewise exponential distribution.
ptpwexp( q, piecewiseSurvivalTime = 0, lambda = 0.0578, lowerBound = 0, lower.tail = TRUE, log.p = FALSE )ptpwexp( q, piecewiseSurvivalTime = 0, lambda = 0.0578, lowerBound = 0, lower.tail = TRUE, log.p = FALSE )
q |
The vector of quantiles. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
lambda |
A vector of hazard rates for the event. One for each analysis time interval. |
lowerBound |
The left truncation time point for the survival time. Defaults to 0 for no truncation. |
lower.tail |
Logical; if TRUE (default), probabilities are P(X <= x), otherwise, P(X > x). |
log.p |
Logical; if TRUE, probabilities p are given as log(p). |
The probability p such that P(X > q | X > lowerBound) = 1 - p.
Kaifeng Lu, [email protected]
ptpwexp(q = c(8, 18), piecewiseSurvivalTime = c(0, 6, 9, 15), lambda = c(0.025, 0.04, 0.015, 0.007))ptpwexp(q = c(8, 18), piecewiseSurvivalTime = c(0, 6, 9, 15), lambda = c(0.025, 0.04, 0.015, 0.007))
Obtains the piecewise exponential distribution that approximates a survival distribution.
pwexpcuts(S, ..., tol = 1e-04)pwexpcuts(S, ..., tol = 1e-04)
S |
The survival function of a univariate survival time. |
... |
Additional arguments to be passed to S. |
tol |
The tolerance for convergence of the profile log-likelihood. Defaults to 0.0001. |
This function computes the piecewise exponential approximation
to a survival distribution.
The piecewise exponential model divides the time axis into
intervals defined by the change points, where each
interval has a constant hazard rate
. The time intervals are specified as:
where , , and
for .
The function starts with (1 change point) and
gradually increases by adding one change point at a time
until the maximized profile log-likelihood for change points
stabilizes, i.e., the relative increase in the maximum of the
profile log-likelihood function is less than tol.
If the relative change in the hazard rate is also less than
tol, the function stops and returns the results.
A list with three components:
piecewiseSurvivalTime: A vector that specifies the starting
time of piecewise exponential survival time intervals.
Must start with 0, e.g., c(0, 6) breaks the time axis into 2 event
intervals: [0, 6) and [6, Inf).
lambda: A vector of hazard rates for the event. One for
each analysis time interval.
loglik: The sequence of the asymptotic limit of the
piecewise exponential log-likelihood for an increasing number
of change points.
Kaifeng Lu, [email protected]
# Example 1: Piecewise exponential pwexpcuts(ptpwexp, piecewiseSurvivalTime = c(0, 3.4, 5.5), lambda = c(0.0168, 0.0833, 0.0431), lowerBound = 0, lower.tail = FALSE) # Example 2: Weibull pwexpcuts(pweibull, shape = 1.37, scale = 1/0.818, lower.tail = FALSE)# Example 1: Piecewise exponential pwexpcuts(ptpwexp, piecewiseSurvivalTime = c(0, 3.4, 5.5), lambda = c(0.0168, 0.0833, 0.0431), lowerBound = 0, lower.tail = FALSE) # Example 2: Weibull pwexpcuts(pweibull, shape = 1.37, scale = 1/0.818, lower.tail = FALSE)
Obtains the profile log-likelihood function for change points in the piecewise exponential approximation to a survival function.
pwexploglik(tau, S, ...)pwexploglik(tau, S, ...)
tau |
The numeric vector of change points. |
S |
The survival function of a univariate survival time. |
... |
Additional arguments to be passed to S. |
This function computes the profile log-likelihood for change points in a piecewise exponential survival model.
Let denote the survival function of a univariate
survival time, and be a vector of change points.
The piecewise exponential survival model divides the time
axis into intervals defined by the change points ,
where each interval has a constant
hazard rate . The time intervals are specified as:
where , , and
for .
For each subject, the expected number of events occurring
in the -th interval is
The expected exposure in the -th interval is:
which can be shown to be equivalent to
The log-likelihood for the piecewise exponential model is:
The profile log-likelihood for is obtained by maximizing
with respect to
for fixed .
The maximum likelihood estimate of the hazard rate in the
-th interval is
Substituting back, the profile log-likelihood is
where we use the fact that
.
A list with the following three components:
piecewiseSurvivalTime: A vector that specifies the starting
time of piecewise exponential survival time intervals.
lambda: A vector of hazard rates for the event. One for
each analysis time interval.
loglik: The value of the profile log-likelihood.
Kaifeng Lu, [email protected]
pwexploglik(tau = c(0.5, 1.2, 2.8), pweibull, shape = 1.37, scale = 1/0.818, lower.tail = FALSE)pwexploglik(tau = c(0.5, 1.2, 2.8), pweibull, shape = 1.37, scale = 1/0.818, lower.tail = FALSE)
Computes the equicoordinate quantile such that
for a multivariate
normal random vector .
qmvnormr( p, mean = NULL, sigma, n0 = 1024, n_max = 16384, R = 8, abseps = 1e-04, releps = 0, seed = 0, parallel = TRUE, nthreads = 0 )qmvnormr( p, mean = NULL, sigma, n0 = 1024, n_max = 16384, R = 8, abseps = 1e-04, releps = 0, seed = 0, parallel = TRUE, nthreads = 0 )
p |
The probability level (cumulative probability). |
mean |
The mean vector. If |
sigma |
The covariance (or correlation) matrix of the distribution. |
n0 |
Initial number of samples per replication for the Monte Carlo integration. |
n_max |
Maximum number of samples allowed per replication. |
R |
Number of independent replications used to estimate the error. |
abseps |
Absolute error tolerance for the probability calculation. |
releps |
Relative error tolerance for the probability calculation. |
seed |
Random seed for reproducibility. If 0, a seed is generated from the computer clock. |
parallel |
Logical; if |
nthreads |
Number of threads for parallel execution. If 0, the default RcppParallel behavior is used. |
This function finds the value using a root-finding algorithm
applied to the pmvnormr function. It solves for the value where
the multivariate normal cumulative distribution function equals the
target probability .
A numeric value representing the calculated equicoordinate quantile.
Kaifeng Lu, [email protected]
n <- 5 mean <- rep(0, n) sigma <- matrix(0.5, n, n) diag(sigma) <- 1 qmvnormr(0.5, mean = mean, sigma = sigma)n <- 5 mean <- rep(0, n) sigma <- matrix(0.5, n, n) diag(sigma) <- 1 qmvnormr(0.5, mean = mean, sigma = sigma)
Obtains the quantile of a truncated piecewise exponential distribution.
qtpwexp( p, piecewiseSurvivalTime = 0, lambda = 0.0578, lowerBound = 0, lower.tail = TRUE, log.p = FALSE )qtpwexp( p, piecewiseSurvivalTime = 0, lambda = 0.0578, lowerBound = 0, lower.tail = TRUE, log.p = FALSE )
p |
The vector of probabilities. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
lambda |
A vector of hazard rates for the event. One for each analysis time interval. |
lowerBound |
The left truncation time point for the survival time. Defaults to 0 for no truncation. |
lower.tail |
Logical; if TRUE (default), probabilities are P(X <= x), otherwise, P(X > x). |
log.p |
Logical; if TRUE, probabilities p are given as log(p). |
The quantile q such that P(X > q | X > lowerBound) = 1 - p.
Kaifeng Lu, [email protected]
qtpwexp(p = c(0.205, 0.317), piecewiseSurvivalTime = c(0, 6, 9, 15), lambda = c(0.025, 0.04, 0.015, 0.007))qtpwexp(p = c(0.205, 0.317), piecewiseSurvivalTime = c(0, 6, 9, 15), lambda = c(0.025, 0.04, 0.015, 0.007))
A simulated data set with stratification and delayed treatment effect:
iterationNumberThe iteration number
arrivalTimeThe enrollment time for the subject
stratumThe stratum for the subject
treatmentGroupThe treatment group for the subject
timeUnderObservationThe time under observation since randomization
eventWhether the subject experienced the event
dropoutEventWhether the subject dropped out
rawdatarawdata
An object of class data.frame with 4910 rows and 7 columns.
Obtains the restricted maximum likelihood estimates of individual proportions with specified odds ratio.
remlOddsRatio(n1, y1, n2, y2, oddsRatioH0 = 1)remlOddsRatio(n1, y1, n2, y2, oddsRatioH0 = 1)
n1 |
The sample size for the active treatment group. |
y1 |
The number of responses for the active treatment group. |
n2 |
The sample size for the control group. |
y2 |
The number of responses for the control group. |
oddsRatioH0 |
The specified odds ratio. |
A vector of the restricted maximum likelihood estimates of the response probabilities for the two treatment groups.
Kaifeng Lu, [email protected]
remlOddsRatio(n1 = 10, y1 = 4, n2 = 20, y2 = 2, oddsRatioH0 = 1.25)remlOddsRatio(n1 = 10, y1 = 4, n2 = 20, y2 = 2, oddsRatioH0 = 1.25)
Obtains the restricted maximum likelihood estimates of individual proportions with specified rate difference.
remlRateDiff(t1, y1, t2, y2, rateDiffH0 = 0)remlRateDiff(t1, y1, t2, y2, rateDiffH0 = 0)
t1 |
The exposure for the active treatment group. |
y1 |
The number of events for the active treatment group. |
t2 |
The exposure for the control group. |
y2 |
The number of events for the control group. |
rateDiffH0 |
The specified rate difference. |
A vector of the restricted maximum likelihood estimates of the incidence rates for the two treatment groups.
Kaifeng Lu, [email protected]
remlRateDiff(t1 = 10, y1 = 4, t2 = 20, y2 = 2, rateDiffH0 = 0.1)remlRateDiff(t1 = 10, y1 = 4, t2 = 20, y2 = 2, rateDiffH0 = 0.1)
Obtains the restricted maximum likelihood estimates of individual proportions with specified rate ratio.
remlRateRatio(t1, y1, t2, y2, rateRatioH0 = 1)remlRateRatio(t1, y1, t2, y2, rateRatioH0 = 1)
t1 |
The exposure for the active treatment group. |
y1 |
The number of events for the active treatment group. |
t2 |
The exposure for the control group. |
y2 |
The number of events for the control group. |
rateRatioH0 |
The specified rate ratio. |
A vector of the restricted maximum likelihood estimates of the incidence rates for the two treatment groups.
Kaifeng Lu, [email protected]
remlRateRatio(t1 = 10, y1 = 4, t2 = 20, y2 = 2, rateRatioH0 = 1.1)remlRateRatio(t1 = 10, y1 = 4, t2 = 20, y2 = 2, rateRatioH0 = 1.1)
Obtains the restricted maximum likelihood estimates of individual proportions with specified risk difference.
remlRiskDiff(n1, y1, n2, y2, riskDiffH0 = 0)remlRiskDiff(n1, y1, n2, y2, riskDiffH0 = 0)
n1 |
The sample size for the active treatment group. |
y1 |
The number of responses for the active treatment group. |
n2 |
The sample size for the control group. |
y2 |
The number of responses for the control group. |
riskDiffH0 |
The specified risk difference. |
A vector of the restricted maximum likelihood estimates of the response probabilities for the two treatment groups.
Kaifeng Lu, [email protected]
remlRiskDiff(n1 = 10, y1 = 4, n2 = 20, y2 = 0, riskDiffH0 = 0.1)remlRiskDiff(n1 = 10, y1 = 4, n2 = 20, y2 = 0, riskDiffH0 = 0.1)
Obtains the restricted maximum likelihood estimates of individual proportions with specified risk ratio.
remlRiskRatio(n1, y1, n2, y2, riskRatioH0 = 1)remlRiskRatio(n1, y1, n2, y2, riskRatioH0 = 1)
n1 |
The sample size for the active treatment group. |
y1 |
The number of responses for the active treatment group. |
n2 |
The sample size for the control group. |
y2 |
The number of responses for the control group. |
riskRatioH0 |
The specified risk ratio. |
A vector of the restricted maximum likelihood estimates of the response probabilities for the two treatment groups.
Kaifeng Lu, [email protected]
remlRiskRatio(n1 = 10, y1 = 4, n2 = 20, y2 = 2, riskRatioH0 = 1.2)remlRiskRatio(n1 = 10, y1 = 4, n2 = 20, y2 = 2, riskRatioH0 = 1.2)
Obtains the repeated p-values for a group sequential design.
repeatedPValue( kMax, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA, maxInformation = 1, p, information, spendingTime = NULL, nthreads = 0 )repeatedPValue( kMax, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA, maxInformation = 1, p, information, spendingTime = NULL, nthreads = 0 )
kMax |
The maximum number of stages. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
maxInformation |
The target maximum information. Defaults to 1,
in which case, |
p |
The raw p-values at look 1 to look |
information |
The observed information by look. It can be a matrix
with |
spendingTime |
The error spending time at each analysis, must be
increasing and less than or equal to 1. Defaults to |
nthreads |
The number of threads to use in simulations (0 means the default RcppParallel behavior). |
The repeated p-values at look 1 to look k.
Kaifeng Lu, [email protected]
# Example 1: informationRates different from spendingTime repeatedPValue(kMax = 3, typeAlphaSpending = "sfOF", maxInformation = 800, p = c(0.2, 0.15, 0.1), information = c(529, 700, 800), spendingTime = c(0.6271186, 0.8305085, 1)) # Example 2: Maurer & Bretz (2013), current look is not the last look repeatedPValue(kMax = 3, typeAlphaSpending = "sfOF", p = matrix(c(0.0062, 0.017, 0.009, 0.13, 0.0002, 0.0035, 0.002, 0.06), nrow=4, ncol=2), information = c(1/3, 2/3), nthreads = 1)# Example 1: informationRates different from spendingTime repeatedPValue(kMax = 3, typeAlphaSpending = "sfOF", maxInformation = 800, p = c(0.2, 0.15, 0.1), information = c(529, 700, 800), spendingTime = c(0.6271186, 0.8305085, 1)) # Example 2: Maurer & Bretz (2013), current look is not the last look repeatedPValue(kMax = 3, typeAlphaSpending = "sfOF", p = matrix(c(0.0062, 0.017, 0.009, 0.13, 0.0002, 0.0035, 0.002, 0.06), nrow=4, ncol=2), information = c(1/3, 2/3), nthreads = 1)
Obtains the response, martingale, deviance, dfbeta, and likelihood displacement residuals for a parametric regression model for failure time data.
residuals_liferegr( object, type = c("response", "martingale", "deviance", "dfbeta", "dfbetas", "working", "ldcase", "ldresp", "ldshape", "matrix"), collapse = FALSE, weighted = (type %in% c("dfbeta", "dfbetas")) )residuals_liferegr( object, type = c("response", "martingale", "deviance", "dfbeta", "dfbetas", "working", "ldcase", "ldresp", "ldshape", "matrix"), collapse = FALSE, weighted = (type %in% c("dfbeta", "dfbetas")) )
object |
The output from the |
type |
The type of residuals desired, with options including
|
collapse |
Whether to collapse the residuals by |
weighted |
Whether to compute weighted residuals. |
The algorithms follow the residuals.survreg function in the
survival package, except for martingale residuals, which
are defined only for event or right-censored data for exponential,
weibull, lognormal, and loglogistic distributions.
Either a vector or a matrix of residuals, depending on the specified type:
response residuals are on the scale of the original data.
martingale residuals are event indicators minus the cumulative
hazards for event or right-censored data.
working residuals are on the scale of the linear predictor.
deviance residuals are on the log-likelihood scale.
dfbeta residuals are returned as a matrix, where the
-th row represents the approximate change in the model
coefficients resulting from the inclusion of subject .
dfbetas residuals are similar to dfbeta residuals, but
each column is scaled by the standard deviation of the
corresponding coefficient.
matrix residuals are a matrix of derivatives of the
log-likelihood function. Let be the log-likelihood, be
the linear predictor (), and be .
Then the resulting matrix contains six columns: ,
, ,
, , and
.
ldcase residulas are likelihood displacement for case weight
perturbation.
ldresp residuals are likelihood displacement for response value
perturbation.
ldshape residuals are likelihood displacement related to the
shape parameter.
Kaifeng Lu, [email protected]
Escobar, L. A. and Meeker, W. Q. Assessing influence in regression analysis with censored data. Biometrics 1992; 48:507-528.
library(dplyr) fit1 <- liferegr( data = tobin %>% mutate(time = ifelse(durable>0, durable, NA)), time = "time", time2 = "durable", covariates = c("age", "quant"), dist = "normal") resid <- residuals_liferegr(fit1, type = "response") head(resid)library(dplyr) fit1 <- liferegr( data = tobin %>% mutate(time = ifelse(durable>0, durable, NA)), time = "time", time2 = "durable", covariates = c("age", "quant"), dist = "normal") resid <- residuals_liferegr(fit1, type = "response") head(resid)
Obtains the martingale, deviance, score, or Schoenfeld residuals for a proportional hazards regression model.
residuals_phregr( object, type = c("martingale", "deviance", "score", "schoenfeld", "dfbeta", "dfbetas", "scaledsch"), collapse = FALSE, weighted = (type %in% c("dfbeta", "dfbetas")) )residuals_phregr( object, type = c("martingale", "deviance", "score", "schoenfeld", "dfbeta", "dfbetas", "scaledsch"), collapse = FALSE, weighted = (type %in% c("dfbeta", "dfbetas")) )
object |
The output from the |
type |
The type of residuals desired, with options including
|
collapse |
Whether to collapse the residuals by |
weighted |
Whether to compute weighted residuals. |
For score and Schoenfeld type residuals, the proportional hazards model
must include at least one covariate. The algorithms for deviance,
dfbeta, dfbetas, and scaledsch residuals follow
the residuals.coxph function in the survival package.
For martingale and deviance residuals, the result is a vector
with one element corresponding to each subject (without collapse).
For score residuals, the result is a matrix where each row represents
a subject and each column corresponds to a variable. The row order
aligns with the input data used in the original fit. For Schoenfeld
residuals, the result is a matrix with one row for each event and
one column per variable. These rows are sorted by time within strata,
with the attributes stratum and time included.
Score residuals represent each individual's contribution to the score
vector. Two commonly used transformations of this are dfbeta,
which represents the approximate change in the coefficient vector
if the observation is excluded, and dfbetas, which gives the
approximate change in the coefficients scaled by the standard error
of the coefficients.
Kaifeng Lu, [email protected]
Terry M. Therneau, Patricia M. Grambsch, and Thomas M. Fleming. Martingale based residuals for survival models. Biometrika 1990; 77:147-160.
Patricia M. Grambsch and Terry M. Therneau. Proportional hazards tests and diagnostics based on weighted residuals. Biometrika 1994; 81:515-26.
library(dplyr) # Example 1 with right-censored data fit1 <- phregr(data = rawdata %>% filter(iterationNumber == 1) %>% mutate(treat = 1*(treatmentGroup == 1)), stratum = "stratum", time = "timeUnderObservation", event = "event", covariates = "treat") ressco <- residuals_phregr(fit1, type = "score") head(ressco) # Example 2 with counting process data fit2 <- phregr(data = heart %>% mutate(rx = as.numeric(transplant) - 1), time = "start", time2 = "stop", event = "event", covariates = c("rx", "age"), id = "id", robust = TRUE) resssch <- residuals_phregr(fit2, type = "scaledsch") head(resssch)library(dplyr) # Example 1 with right-censored data fit1 <- phregr(data = rawdata %>% filter(iterationNumber == 1) %>% mutate(treat = 1*(treatmentGroup == 1)), stratum = "stratum", time = "timeUnderObservation", event = "event", covariates = "treat") ressco <- residuals_phregr(fit1, type = "score") head(ressco) # Example 2 with counting process data fit2 <- phregr(data = heart %>% mutate(rx = as.numeric(transplant) - 1), time = "start", time2 = "stop", event = "event", covariates = c("rx", "age"), id = "id", robust = TRUE) resssch <- residuals_phregr(fit2, type = "scaledsch") head(resssch)
Obtains the exact unconditional confidence interval for risk difference based on the standardized score statistic.
riskDiffExactCI( n1 = NA_integer_, y1 = NA_integer_, n2 = NA_integer_, y2 = NA_integer_, cilevel = 0.95 )riskDiffExactCI( n1 = NA_integer_, y1 = NA_integer_, n2 = NA_integer_, y2 = NA_integer_, cilevel = 0.95 )
n1 |
The sample size for the active treatment group. |
y1 |
The number of responses for the active treatment group. |
n2 |
The sample size for the control group. |
y2 |
The number of responses for the control group. |
cilevel |
The confidence interval level. |
A data frame containing the following variables:
scale: The scale of treatment effect.
estimate: The point estimate.
lower: The lower limit of the confidence interval.
upper: The upper limit of the confidence interval.
cilevel: The confidence interval level.
Kaifeng Lu, [email protected]
riskDiffExactCI(n1 = 30, y1 = 2, n2 = 30, y2 = 1, cilevel = 0.95)riskDiffExactCI(n1 = 30, y1 = 2, n2 = 30, y2 = 1, cilevel = 0.95)
Obtains the p-value for exact unconditional test of risk difference.
riskDiffExactPValue( n1 = NA_integer_, y1 = NA_integer_, n2 = NA_integer_, y2 = NA_integer_, riskDiffH0 = 0, directionUpper = TRUE )riskDiffExactPValue( n1 = NA_integer_, y1 = NA_integer_, n2 = NA_integer_, y2 = NA_integer_, riskDiffH0 = 0, directionUpper = TRUE )
n1 |
The sample size for the active treatment group. |
y1 |
The number of responses for the active treatment group. |
n2 |
The sample size for the control group. |
y2 |
The number of responses for the control group. |
riskDiffH0 |
The risk difference under the null hypothesis. Defaults to 0. |
directionUpper |
Whether larger values represent better responses. |
A data frame containing the following variables:
riskDiffH0: The risk difference under the null hypothesis.
directionUpper: Whether larger values represent better
responses.
riskDiff: The observed risk difference.
zstat: The observed value of the Z test statistic.
pvalue: The one-sided p-value for the unconditional exact test.
pi2star: The value of pi2 that yields the p-value.
Kaifeng Lu, [email protected]
riskDiffExactPValue(riskDiffH0 = 0, directionUpper = 1, n1 = 68, y1 = 2, n2 = 65, y2 = 1)riskDiffExactPValue(riskDiffH0 = 0, directionUpper = 1, n1 = 68, y1 = 2, n2 = 65, y2 = 1)
Obtains the exact unconditional confidence interval for risk ratio based on the standardized score statistic.
riskRatioExactCI( n1 = NA_integer_, y1 = NA_integer_, n2 = NA_integer_, y2 = NA_integer_, cilevel = 0.95 )riskRatioExactCI( n1 = NA_integer_, y1 = NA_integer_, n2 = NA_integer_, y2 = NA_integer_, cilevel = 0.95 )
n1 |
The sample size for the active treatment group. |
y1 |
The number of responses for the active treatment group. |
n2 |
The sample size for the control group. |
y2 |
The number of responses for the control group. |
cilevel |
The confidence interval level. |
A data frame containing the following variables:
scale: The scale of treatment effect.
estimate: The point estimate.
lower: The lower limit of the confidence interval.
upper: The upper limit of the confidence interval.
cilevel: The confidence interval level.
Kaifeng Lu, [email protected]
riskRatioExactCI(n1 = 30, y1 = 2, n2 = 30, y2 = 1, cilevel = 0.95)riskRatioExactCI(n1 = 30, y1 = 2, n2 = 30, y2 = 1, cilevel = 0.95)
Obtains the p-value for exact unconditional test of risk ratio.
riskRatioExactPValue( n1 = NA_integer_, y1 = NA_integer_, n2 = NA_integer_, y2 = NA_integer_, riskRatioH0 = 1, directionUpper = TRUE )riskRatioExactPValue( n1 = NA_integer_, y1 = NA_integer_, n2 = NA_integer_, y2 = NA_integer_, riskRatioH0 = 1, directionUpper = TRUE )
n1 |
The sample size for the active treatment group. |
y1 |
The number of responses for the active treatment group. |
n2 |
The sample size for the control group. |
y2 |
The number of responses for the control group. |
riskRatioH0 |
The risk ratio under the null hypothesis. Defaults to 1. |
directionUpper |
Whether larger values represent better responses. |
A data frame containing the following variables:
riskRatioH0: The risk ratio under the null hypothesis.
directionUpper: Whether larger values represent better
responses.
riskRatio: The observed risk ratio.
zstat: The observed value of the Z test statistic.
pvalue: The one-sided p-value for the unconditional exact test.
pi2star: The value of pi2 that yields the p-value.
Kaifeng Lu, [email protected]
riskRatioExactPValue(riskRatioH0 = 1, directionUpper = 1, n1 = 68, y1 = 2, n2 = 65, y2 = 1)riskRatioExactPValue(riskRatioH0 = 1, directionUpper = 1, n1 = 68, y1 = 2, n2 = 65, y2 = 1)
Obtains the estimate of restricted mean survival time difference between two treatment groups.
rmdiff( data, stratum = "", treat = "treat", time = "time", event = "event", milestone = 0, rmstDiffH0 = 0, conflev = 0.95, biascorrection = FALSE )rmdiff( data, stratum = "", treat = "treat", time = "time", event = "event", milestone = 0, rmstDiffH0 = 0, conflev = 0.95, biascorrection = FALSE )
data |
The input data frame that contains the following variables:
|
stratum |
The name of the stratum variable in the input data. |
treat |
The name of the treatment variable in the input data. |
time |
The name of the time variable in the input data. |
event |
The name of the event variable in the input data. |
milestone |
The milestone time at which to calculate the restricted mean survival time. |
rmstDiffH0 |
The difference in restricted mean survival times under the null hypothesis. Defaults to 0 for superiority test. |
conflev |
The level of the two-sided confidence interval for the difference in restricted mean survival times. Defaults to 0.95. |
biascorrection |
Whether to apply bias correction for the variance estimate of individual restricted mean survival times. Defaults to no bias correction. |
A data frame with the following variables:
milestone: The milestone time relative to randomization.
rmstDiffH0: The difference in restricted mean survival times
under the null hypothesis.
rmst1: The estimated restricted mean survival time for
the treatment group.
rmst2: The estimated restricted mean survival time for
the control group.
rmstDiff: The estimated difference in restricted mean
survival times.
vrmst1: The variance for rmst1.
vrmst2: The variance for rmst2.
sermstDiff: The standard error for rmstDiff.
rmstDiffZ: The Z-statistic value.
rmstDiffPValue: The two-sided p-value.
lower: The lower bound of confidence interval.
upper: The upper bound of confidence interval.
conflev: The level of confidence interval.
biascorrection: Whether to apply bias correction for the
variance estimate of individual restricted mean survival times.
Kaifeng Lu, [email protected]
rmdiff(data = rawdata[rawdata$iterationNumber == 1, ], stratum = "stratum", treat = "treatmentGroup", time = "timeUnderObservation", event = "event", milestone = 12)rmdiff(data = rawdata[rawdata$iterationNumber == 1, ], stratum = "stratum", treat = "treatmentGroup", time = "timeUnderObservation", event = "event", milestone = 12)
Obtains the estimate of restricted means survival time for each stratum.
rmest( data, stratum = "", time = "time", event = "event", milestone = 0, conflev = 0.95, biascorrection = FALSE )rmest( data, stratum = "", time = "time", event = "event", milestone = 0, conflev = 0.95, biascorrection = FALSE )
data |
The input data frame that contains the following variables:
|
stratum |
The name of the stratum variable in the input data. |
time |
The name of the time variable in the input data. |
event |
The name of the event variable in the input data. |
milestone |
The milestone time at which to calculate the restricted mean survival time. |
conflev |
The level of the two-sided confidence interval for the survival probabilities. Defaults to 0.95. |
biascorrection |
Whether to apply bias correction for the variance estimate. Defaults to no bias correction. |
A data frame with the following variables:
stratum: The stratum variable.
size: The number of subjects in the stratum.
milestone: The milestone time relative to randomization.
rmst: The estimate of restricted mean survival time.
stderr: The standard error of the estimated rmst.
lower: The lower bound of confidence interval if requested.
upper: The upper bound of confidence interval if requested.
conflev: The level of confidence interval if requested.
biascorrection: Whether to apply bias correction for the
variance estimate.
Kaifeng Lu, [email protected]
rmest(data = aml, stratum = "x", time = "time", event = "status", milestone = 24)rmest(data = aml, stratum = "x", time = "time", event = "status", milestone = 24)
Estimates the power for testing the difference in restricted mean survival times in a two-sample survival design.
rmpower( kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRmstDiff = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, milestone = NA_real_, rmstDiffH0 = 0, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )rmpower( kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRmstDiff = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, milestone = NA_real_, rmstDiffH0 = 0, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilityRmstDiff |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
milestone |
The milestone time at which to calculate the restricted mean survival time. |
rmstDiffH0 |
The difference in restricted mean survival times under the null hypothesis. Defaults to 0 for superiority test. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
studyDuration |
Study duration for fixed follow-up design.
Defaults to missing, which is to be replaced with the sum of
|
An S3 class rmpower object with 4 components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
numberOfEvents: The total number of events.
numberOfDropouts: The total number of dropouts.
numbeOfSubjects: The total number of subjects.
numberOfMilestone: The total number of subjects reaching
milestone.
studyDuration: The total study duration.
information: The maximum information.
expectedNumberOfEvents: The expected number of events.
expectedNumberOfDropouts: The expected number of dropouts.
expectedNumberOfSubjects: The expected number of subjects.
expectedNumberOfMilestone: The expected number of subjects
reaching milestone.
expectedStudyDuration: The expected study duration.
expectedInformation: The expected information.
accrualDuration: The accrual duration.
followupTime: The follow-up duration.
fixedFollowup: Whether a fixed follow-up design is used.
kMax: The number of stages.
milestone: The milestone time relative to randomization.
rmstDiffH0: The difference in restricted mean survival
times under the null hypothesis.
rmst1: The restricted mean survival time for the
treatment group.
rmst2: The restricted mean survival time for the
control group.
rmstDiff: The difference in restricted mean survival times,
equal to rmst1 - rmst2.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
numberOfEvents: The number of events.
numberOfDropouts: The number of dropouts.
numberOfSubjects: The number of subjects.
numberOfMilestone: The number of subjects reaching
milestone.
analysisTime: The average time since trial start.
efficacyRmstDiff: The efficacy boundaries on the restricted
mean survival time difference scale.
futilityRmstDiff: The futility boundaries on the restricted
mean survival time difference scale.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
settings: A list containing the following input parameters:
typeAlphaSpending, parameterAlphaSpending,
userAlphaSpending, typeBetaSpending,
parameterBetaSpending, allocationRatioPlanned,
accrualTime, accuralIntensity,
piecewiseSurvivalTime, stratumFraction,
lambda1, lambda2, gamma1, gamma2,
and spendingTime.
byTreatmentCounts: A list containing the following counts by
treatment group:
numberOfEvents1: The number of events by stage for
the treatment group.
numberOfDropouts1: The number of dropouts by stage for
the treatment group.
numberOfSubjects1: The number of subjects by stage for
the treatment group.
numberOfMilestone1: The number of subjects reaching
milestone by stage for the active treatment group.
numberOfEvents2: The number of events by stage for
the control group.
numberOfDropouts2: The number of dropouts by stage for
the control group.
numberOfSubjects2: The number of subjects by stage for
the control group.
numberOfMilestone2: The number of subjects reaching
milestone by stage for the control group.
expectedNumberOfEvents1: The expected number of events for
the treatment group.
expectedNumberOfDropouts1: The expected number of dropouts
for the active treatment group.
expectedNumberOfSubjects1: The expected number of subjects
for the active treatment group.
expectedNumberOfMilestone1: The expected number of subjects
reaching milestone for the active treatment group.
expectedNumberOfEvents2: The expected number of events for
control group.
expectedNumberOfDropouts2: The expected number of dropouts
for the control group.
expectedNumberOfSubjects2: The expected number of subjects
for the control group.
expectedNumberOfMilestone2: The expected number of subjects
reaching milestone for the control group.
Kaifeng Lu, [email protected]
# Piecewise accrual, piecewise exponential survival, and 5% dropout by # the end of 1 year. rmpower(kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)# Piecewise accrual, piecewise exponential survival, and 5% dropout by # the end of 1 year. rmpower(kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)
Estimates the power, stopping probabilities, and expected sample size in a one-group survival design.
rmpower1s( kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRmst = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, milestone = NA_real_, rmstH0 = NA_real_, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda = NA_real_, gamma = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )rmpower1s( kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRmst = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, milestone = NA_real_, rmstH0 = NA_real_, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda = NA_real_, gamma = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilityRmst |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
milestone |
The milestone time at which to calculate the restricted mean survival time. |
rmstH0 |
The restricted mean survival time under the null hypothesis. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda |
A vector of hazard rates for the event in each analysis time interval by stratum under the alternative hypothesis. |
gamma |
The hazard rate for exponential dropout or a vector of hazard rates for piecewise exponential dropout. Defaults to 0 for no dropout. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
studyDuration |
Study duration for fixed follow-up design.
Defaults to missing, which is to be replaced with the sum of
|
An S3 class rmpower1s object with 3 components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
numberOfEvents: The total number of events.
numbeOfSubjects: The total number of subjects.
numberOfMilestone: The total number of subjects reaching
milestone.
studyDuration: The total study duration.
information: The maximum information.
expectedNumberOfEvents: The expected number of events.
expectedNumberOfSubjects: The expected number of subjects.
expectedNumberOfMilestone: The expected number of subjects
reaching milestone.
expectedStudyDuration: The expected study duration.
expectedInformation: The expected information.
accrualDuration: The accrual duration.
followupTime: The follow-up duration.
fixedFollowup: Whether a fixed follow-up design is used.
kMax: The number of stages.
milestone: The milestone time to calculate the restricted
mean survival time.
rmstH0: The restricted mean survival time under the null
hypothesis.
rmst: The restricted mean survival time under the
alternative hypothesis.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale.
futilityBounds: The futility boundaries on the Z-scale.
rejectPerStage: The probability for efficacy stopping.
futilityPerStage: The probability for futility stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeFutility: The cumulative probability for futility
stopping.
cumulativeAlphaSpent: The cumulative alpha spent.
numberOfEvents: The number of events.
numberOfDropouts: The number of dropouts.
numberOfSubjects: The number of subjects.
numberOfMilestone: The number of subjects reaching
milestone.
analysisTime: The average time since trial start.
efficacyRmst: The efficacy boundaries on the restricted
mean survival time.
futilityRmst: The futility boundaries on the restricted
mean survival time.
efficacyP: The efficacy boundaries on the p-value scale.
futilityP: The futility boundaries on the p-value scale.
information: The cumulative information.
efficacyStopping: Whether to allow efficacy stopping.
futilityStopping: Whether to allow futility stopping.
settings: A list containing the following input parameters:
typeAlphaSpending, parameterAlphaSpending,
userAlphaSpending, typeBetaSpending,
parameterBetaSpending, accrualTime,
accuralIntensity, piecewiseSurvivalTime,
stratumFraction, lambda, gamma,
and spendingTime.
Kaifeng Lu, [email protected]
rmpower1s(kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, rmstH0 = 10, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)rmpower1s(kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, rmstH0 = 10, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)
Obtains the power for equivalence in restricted mean survival time difference.
rmpowerequiv( kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, milestone = NA_real_, rmstDiffLower = NA_real_, rmstDiffUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )rmpowerequiv( kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, milestone = NA_real_, rmstDiffLower = NA_real_, rmstDiffUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, studyDuration = NA_real_ )
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
milestone |
The milestone time at which to calculate the restricted mean survival time. |
rmstDiffLower |
The lower equivalence limit of restricted mean survival time difference. |
rmstDiffUpper |
The upper equivalence limit of restricted mean survival time difference. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
studyDuration |
Study duration for fixed follow-up design.
Defaults to missing, which is to be replaced with the sum of
|
An S3 class rmpowerequiv object with 4 components:
overallResults: A data frame containing the following variables:
overallReject: The overall rejection probability.
alpha: The overall significance level.
numberOfEvents: The total number of events.
numberOfSubjects: The total number of subjects.
studyDuration: The total study duration.
information: The maximum information.
expectedNumberOfEvents: The expected number of events.
expectedNumberOfSubjects: The expected number of subjects.
expectedStudyDuration: The expected study duration.
expectedInformation: The expected information.
kMax: The number of stages.
milestone: The milestone time relative to randomization.
rmstDiffLower: The lower equivalence limit of restricted
mean survival time difference.
rmstDiffUpper: The upper equivalence limit of restricted
mean survival time difference.
rmst1: The restricted mean survival time for the
treatment group.
rmst2: The restricted mean survival time for the
control group.
rmstDiff: The restricted mean survival time difference.
accrualDuration: The accrual duration.
followupTime: The follow-up duration.
fixedFollowup: Whether a fixed follow-up design is used.
byStageResults: A data frame containing the following variables:
informationRates: The information rates.
efficacyBounds: The efficacy boundaries on the Z-scale for
each of the two one-sided tests.
rejectPerStage: The probability for efficacy stopping.
cumulativeRejection: The cumulative probability for efficacy
stopping.
cumulativeAlphaSpent: The cumulative alpha for each of
the two one-sided tests.
cumulativeAttainedAlphaH10: The cumulative alpha attained
under H10.
cumulativeAttainedAlphaH20: The cumulative alpha attained
under H20.
numberOfEvents: The number of events.
numberOfDropouts: The number of dropouts.
numberOfSubjects: The number of subjects.
numberOfMilestone: The number of subjects reaching
milestone.
analysisTime: The average time since trial start.
efficacyRmstDiffLower: The efficacy boundaries on the
restricted mean survival time difference scale for the one-sided
null hypothesis at the lower equivalence limit.
efficacyRmstDiffUpper: The efficacy boundaries on the
restricted mean survival time difference scale for the one-sided
null hypothesis at the upper equivalence limit.
efficacyP: The efficacy bounds on the p-value scale for
each of the two one-sided tests.
information: The cumulative information.
settings: A list containing the following input parameters:
typeAlphaSpending, parameterAlphaSpending,
userAlphaSpending, allocationRatioPlanned,
accrualTime, accuralIntensity,
piecewiseSurvivalTime, stratumFraction,
lambda1, lambda2, gamma1, gamma2,
and spendingTime.
byTreatmentCounts: A list containing the following counts by
treatment group:
numberOfEvents1: The number of events by stage for
the treatment group.
numberOfDropouts1: The number of dropouts by stage for
the treatment group.
numberOfSubjects1: The number of subjects by stage for
the treatment group.
numberOfMilestone1: The number of subjects reaching
milestone by stage for the active treatment group.
numberOfEvents2: The number of events by stage for
the control group.
numberOfDropouts2: The number of dropouts by stage for
the control group.
numberOfSubjects2: The number of subjects by stage for
the control group.
numberOfMilestone2: The number of subjects reaching
milestone by stage for the control group.
expectedNumberOfEvents1: The expected number of events for
the treatment group.
expectedNumberOfDropouts1: The expected number of dropouts
for the active treatment group.
expectedNumberOfSubjects1: The expected number of subjects
for the active treatment group.
expectedNumberOfMilestone1: The expected number of subjects
reaching milestone for the active treatment group.
expectedNumberOfEvents2: The expected number of events for
control group.
expectedNumberOfDropouts2: The expected number of dropouts
for the control group.
expectedNumberOfSubjects2: The expected number of subjects
for the control group.
expectedNumberOfMilestone2: The expected number of subjects
reaching milestone for the control group.
Kaifeng Lu, [email protected]
rmpowerequiv(kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", milestone = 18, rmstDiffLower = -2, rmstDiffUpper = 2, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 29/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)rmpowerequiv(kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", milestone = 18, rmstDiffLower = -2, rmstDiffUpper = 2, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 29/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)
Obtains the needed accrual duration given power, accrual intensity, and follow-up time, the needed follow-up time given power, accrual intensity, and accrual duration, or the needed absolute accrual intensity given power, relative accrual intensity, accrual duration, and follow-up time in a two-group survival design.
rmsamplesize( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRmstDiff = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, milestone = NA_real_, rmstDiffH0 = 0, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, rounding = TRUE )rmsamplesize( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRmstDiff = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, milestone = NA_real_, rmstDiffH0 = 0, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, rounding = TRUE )
beta |
Type II error. Defaults to 0.2. |
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilityRmstDiff |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
milestone |
The milestone time at which to calculate the restricted mean survival time. |
rmstDiffH0 |
The difference in restricted mean survival times under the null hypothesis. Defaults to 0 for superiority test. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
A list of two components:
resultsUnderH1: An S3 class rmpower object under the
alternative hypothesis.
resultsUnderH0: An S3 class rmpower object under the
null hypothesis.
Kaifeng Lu, [email protected]
# Example 1: Obtains follow-up time given power, accrual intensity, # and accrual duration for variable follow-up. Of note, the power # reaches the maximum when the follow-up time equals milestone. rmsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 100/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = NA, fixedFollowup = FALSE) # Example 2: Obtains accrual intensity given power, accrual duration, and # follow-up time for variable follow-up rmsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 100/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE) # Example 3: Obtains accrual duration given power, accrual intensity, and # follow-up time for fixed follow-up rmsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 100/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = TRUE)# Example 1: Obtains follow-up time given power, accrual intensity, # and accrual duration for variable follow-up. Of note, the power # reaches the maximum when the follow-up time equals milestone. rmsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 100/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = NA, fixedFollowup = FALSE) # Example 2: Obtains accrual intensity given power, accrual duration, and # follow-up time for variable follow-up rmsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 100/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE) # Example 3: Obtains accrual duration given power, accrual intensity, and # follow-up time for fixed follow-up rmsamplesize(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 100/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = TRUE)
Obtains the needed accrual duration given power and follow-up time, the needed follow-up time given power and accrual duration, or the needed absolute accrual rates given power, accrual duration, follow-up duration, and relative accrual rates in a one-group survival design.
rmsamplesize1s( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRmst = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, milestone = NA_real_, rmstH0 = NA_real_, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda = NA_real_, gamma = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, rounding = TRUE )rmsamplesize1s( beta = 0.2, kMax = 1L, informationRates = NA_real_, efficacyStopping = NA_integer_, futilityStopping = NA_integer_, criticalValues = NULL, alpha = 0.025, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, futilityBounds = NULL, futilityCP = NULL, futilityRmst = NULL, typeBetaSpending = "none", parameterBetaSpending = NA_real_, userBetaSpending = NA_real_, milestone = NA_real_, rmstH0 = NA_real_, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda = NA_real_, gamma = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE, spendingTime = NA_real_, rounding = TRUE )
beta |
Type II error. Defaults to 0.2. |
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
efficacyStopping |
Indicators of whether efficacy stopping is allowed
at each stage. Defaults to |
futilityStopping |
Indicators of whether futility stopping is allowed
at each stage. Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level. Defaults to 0.025. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
futilityBounds |
Lower boundaries on the z-test statistic scale
for stopping for futility at stages |
futilityCP |
A vector of length |
futilityRmst |
A vector of length |
typeBetaSpending |
The type of beta spending. One of the following:
|
parameterBetaSpending |
The parameter value for the beta spending.
Corresponds to |
userBetaSpending |
The user defined beta spending. Cumulative beta spent up to each stage. |
milestone |
The milestone time at which to calculate the restricted survival time. |
rmstH0 |
The restricted mean survival time under the null hypothesis. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda |
A vector of hazard rates for the event in each analysis time interval by stratum under the alternative hypothesis. |
gamma |
The hazard rate for exponential dropout or a vector of hazard rates for piecewise exponential dropout. Defaults to 0 for no dropout. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
A list of two components:
resultsUnderH1: An S3 class rmpower1s object under the
alternative hypothesis.
resultsUnderH0: An S3 class rmpower1s object under the
null hypothesis.
Kaifeng Lu, [email protected]
# Example 1: Obtains follow-up duration given power, accrual intensity, # and accrual duration for variable follow-up rmsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, rmstH0 = 10, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = 22, followupTime = NA, fixedFollowup = FALSE) # Example 2: Obtains accrual intensity given power, accrual duration, and # follow-up duration for variable follow-up rmsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, rmstH0 = 10, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE) # Example 3: Obtains accrual duration given power, accrual intensity, and # follow-up duration for fixed follow-up rmsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, rmstH0 = 10, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = TRUE)# Example 1: Obtains follow-up duration given power, accrual intensity, # and accrual duration for variable follow-up rmsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, rmstH0 = 10, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = 22, followupTime = NA, fixedFollowup = FALSE) # Example 2: Obtains accrual intensity given power, accrual duration, and # follow-up duration for variable follow-up rmsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, rmstH0 = 10, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE) # Example 3: Obtains accrual duration given power, accrual intensity, and # follow-up duration for fixed follow-up rmsamplesize1s(beta = 0.2, kMax = 2, informationRates = c(0.8, 1), alpha = 0.025, typeAlphaSpending = "sfOF", milestone = 18, rmstH0 = 10, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), gamma = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = TRUE)
Obtains the sample size for equivalence in restricted mean survival time difference.
rmsamplesizeequiv( beta = 0.2, kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, milestone = NA_real_, rmstDiffLower = NA_real_, rmstDiffUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = 0L, spendingTime = NA_real_, rounding = 1L )rmsamplesizeequiv( beta = 0.2, kMax = 1L, informationRates = NA_real_, criticalValues = NULL, alpha = 0.05, typeAlphaSpending = "sfOF", parameterAlphaSpending = NA_real_, userAlphaSpending = NA_real_, milestone = NA_real_, rmstDiffLower = NA_real_, rmstDiffUpper = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = 0L, spendingTime = NA_real_, rounding = 1L )
beta |
The type II error. |
kMax |
The maximum number of stages. |
informationRates |
The information rates.
Defaults to |
criticalValues |
Upper boundaries on the z-test statistic scale for stopping for efficacy. |
alpha |
The significance level for each of the two one-sided tests. Defaults to 0.05. |
typeAlphaSpending |
The type of alpha spending. One of the following:
|
parameterAlphaSpending |
The parameter value for the alpha spending.
Corresponds to |
userAlphaSpending |
The user defined alpha spending. Cumulative alpha spent up to each stage. |
milestone |
The milestone time at which to calculate the restricted mean survival time. |
rmstDiffLower |
The lower equivalence limit of restricted mean survival time difference. |
rmstDiffUpper |
The upper equivalence limit of restricted mean survival time difference. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
spendingTime |
A vector of length |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
An S3 class rmpowerequiv object
Kaifeng Lu, [email protected]
rmsamplesizeequiv(beta = 0.1, kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", milestone = 18, rmstDiffLower = -2, rmstDiffUpper = 2, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = FALSE)rmsamplesizeequiv(beta = 0.1, kMax = 2, informationRates = c(0.5, 1), alpha = 0.05, typeAlphaSpending = "sfOF", milestone = 18, rmstDiffLower = -2, rmstDiffUpper = 2, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = NA, followupTime = 18, fixedFollowup = FALSE)
Obtains the restricted mean survival time over an interval.
rmst(t1 = 0, t2 = NA_real_, piecewiseSurvivalTime = 0L, lambda = NA_real_)rmst(t1 = 0, t2 = NA_real_, piecewiseSurvivalTime = 0L, lambda = NA_real_)
t1 |
Lower bound of the analysis time interval. |
t2 |
Upper bound of the analysis time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
lambda |
A vector of hazard rates for the event. One for each analysis time interval. |
The integral of the survival function from t1 to t2
Kaifeng Lu, [email protected]
rmst(t1 = 0, t2 = 7, piecewiseSurvivalTime = c(0, 6), lambda = c(0.0533, 0.0309))rmst(t1 = 0, t2 = 7, piecewiseSurvivalTime = c(0, 6), lambda = c(0.0533, 0.0309))
Obtains the stratified restricted mean survival times and difference in restricted mean survival times at given calendar times.
rmstat( time = NA_real_, milestone = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE )rmstat( time = NA_real_, milestone = NA_real_, allocationRatioPlanned = 1, accrualTime = 0L, accrualIntensity = NA_real_, piecewiseSurvivalTime = 0L, stratumFraction = 1L, lambda1 = NA_real_, lambda2 = NA_real_, gamma1 = 0L, gamma2 = 0L, accrualDuration = NA_real_, followupTime = NA_real_, fixedFollowup = FALSE )
time |
A vector of calendar times for data cut. |
milestone |
The milestone time at which to calculate the restricted mean survival time. |
allocationRatioPlanned |
Allocation ratio for the active treatment versus control. Defaults to 1 for equal randomization. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda1 |
A vector of hazard rates for the event in each analysis time interval by stratum for the active treatment group. |
lambda2 |
A vector of hazard rates for the event in each analysis time interval by stratum for the control group. |
gamma1 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the active treatment group. |
gamma2 |
The hazard rate for exponential dropout, a vector of hazard rates for piecewise exponential dropout applicable for all strata, or a vector of hazard rates for dropout in each analysis time interval by stratum for the control group. |
accrualDuration |
Duration of the enrollment period. |
followupTime |
Follow-up time for the last enrolled subject. |
fixedFollowup |
Whether a fixed follow-up design is used.
Defaults to |
A data frame containing the following variables:
time: The calendar time since trial start.
subjects: The number of enrolled subjects.
nevents: The total number of events.
nevents1: The number of events in the active treatment group.
nevents2: The number of events in the control group.
ndropouts: The total number of dropouts.
ndropouts1: The number of dropouts in the active treatment
group.
ndropouts2: The number of dropouts in the control group.
milestone: The milestone time relative to randomization.
nmilestone: The total number of subjects reaching milestone.
nmilestone1: The number of subjects reaching milestone
in the active treatment group.
nmiletone2: The number of subjects reaching milestone
in the control group.
rmst1: The restricted mean survival time for the treatment
group.
rmst2: The restricted mean survival time for the control group.
rmstDiff: The difference in restricted mean survival times,
i.e., rmst1 - rmst2.
vrmst1: The variance for rmst1.
vrmst2: The variance for rmst2.
vrmstDiff: The variance for rmstDiff.
information: The information for rmstDiff, equal to
1/vrmstDiff.
rmstDiffZ: The Z-statistic value, i.e.,
rmstDiff/sqrt(vrmstDiff).
Kaifeng Lu, [email protected]
# Piecewise accrual, piecewise exponential survivals, and 5% dropout by # the end of 1 year. rmstat(time = c(22, 40), milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)# Piecewise accrual, piecewise exponential survivals, and 5% dropout by # the end of 1 year. rmstat(time = c(22, 40), milestone = 18, allocationRatioPlanned = 1, accrualTime = seq(0, 8), accrualIntensity = 26/9*seq(1, 9), piecewiseSurvivalTime = c(0, 6), stratumFraction = c(0.2, 0.8), lambda1 = c(0.0533, 0.0309, 1.5*0.0533, 1.5*0.0309), lambda2 = c(0.0533, 0.0533, 1.5*0.0533, 1.5*0.0533), gamma1 = -log(1-0.05)/12, gamma2 = -log(1-0.05)/12, accrualDuration = 22, followupTime = 18, fixedFollowup = FALSE)
Obtains random samples from a truncated piecewise exponential distribution.
rtpwexp(n, piecewiseSurvivalTime = 0, lambda = 0.0578, lowerBound = 0)rtpwexp(n, piecewiseSurvivalTime = 0, lambda = 0.0578, lowerBound = 0)
n |
The number of observations. |
piecewiseSurvivalTime |
A vector that specifies the starting time of
piecewise exponential survival time intervals. Must start with 0, e.g.,
|
lambda |
A vector of hazard rates for the event. One for each analysis time interval. |
lowerBound |
The left truncation time point for the survival time. Defaults to 0 for no truncation. |
The random numbers from truncated piecewise exponential distribution.
Kaifeng Lu, [email protected]
rtpwexp(n = 10, piecewiseSurvivalTime = c(0, 6, 9, 15), lambda = c(0.025, 0.04, 0.015, 0.007))rtpwexp(n = 10, piecewiseSurvivalTime = c(0, 6, 9, 15), lambda = c(0.025, 0.04, 0.015, 0.007))
Runs the log-rank test power and sample size calculation Shiny app.
runShinyApp_lrstat()runShinyApp_lrstat()
No return value, called for side effects.
Kaifeng Lu, [email protected]
This data set deals with urinary tract infection in sexually active college women, along with covariate information on age an contraceptive use. The variables are all binary and coded in 1 (condition is present) and 0 (condition is absent).
sexaggsexagg
An object of class data.frame with 36 rows and 9 columns.
caseurinary tract infection, the study outcome variable
age>= 24 years
diause of diaphragm
ocuse of oral contraceptive
vicuse of condom
vicluse of lubricated condom
visuse of spermicide
The original SHIdat data set contains an anonymized excerpt of data from the SHIVA01 trial. This was the first randomized clinical trial that aimed at comparing molecularly targeted therapy based on tumor profiling (MTA) versus conventional therapy (CT) for advanced cancer. Patients were randomly assigned to receive the active or control treatment and may switch to the other arm or subsequent anti-cancer therapy upon disease progression. The restructured data is in the long format.
idThe patient's identifier
tstartThe start of the time interval
tstopThe end of the time interval
eventWhether the patient died at the end of the interval
agerandThe patient's age (in years) at randomization
sex.fThe patients' gender, either Male or Female
tt_LnumThe number of previous lines of treatment
rmh_alea.cThe Royal Marsden Hospital score segregated into two categories
pathway.fThe molecular pathway altered (the hormone receptors pathway, the PI3K/ AKT/mTOR pathway, and the RAF/MEK pathway)
bras.fThe patient's randomized arm, either MTA or CT
psThe ECOG performance status
ttcThe presence of concomitant treatments
tranThe use of platelet transfusions
dpdThe relative day of a potential progression
dcoThe relative day of treatment switching
adyThe relative day of the latest news
dcutThe relative day of administrative cutoff
pdWhether the patient had disease progression
coWhether the patient switched treatment
shilongshilong
An object of class data.frame with 602 rows and 19 columns.
Obtains Simon's two-stage minimax, admissible, and optimal designs.
simon2stage( alpha = NA_real_, beta = NA_real_, piH0 = NA_real_, pi = NA_real_, n_max = 110L )simon2stage( alpha = NA_real_, beta = NA_real_, piH0 = NA_real_, pi = NA_real_, n_max = 110L )
alpha |
Type I error rate (one-sided). |
beta |
Type II error rate (1-power). |
piH0 |
Response probability under the null hypothesis. |
pi |
Response probability under the alternative hypothesis. |
n_max |
Upper limit for sample size, defaults to 110. |
A data frame containing the following variables:
piH0: Response probability under the null hypothesis.
pi: Response probability under the alternative hypothesis.
alpha: The specified one-sided significance level.
beta: The specified type II error.
n: Total sample size.
n1: Stage 1 sample size.
r1: Futility boundary for stage 1.
r: Futility boundary for stage 2.
EN0: Expected sample size under the null hypothesis.
attainedAlpha: Attained type 1 error.
power: Attained power.
PET0: Probability of early stopping under the null hypothesis.
w_lower: Lower bound of the interval for w.
w_upper: Upper bound of the interval for w.
design: Description of the design, e.g., minimax, admissible,
or optimal.
Here w is the weight in the objective function:
w*n + (1-w)*EN0.
Kaifeng Lu, [email protected]
simon2stage(0.05, 0.2, 0.1, 0.3)simon2stage(0.05, 0.2, 0.1, 0.3)
Obtains the prior and posterior probabilities for Simon's Bayesian basket discovery trials.
simonBayesAnalysis( nstrata = NA_integer_, r = NA_real_, n = NA_real_, lambda = NA_real_, gamma = NA_real_, phi = NA_real_, plo = NA_real_ )simonBayesAnalysis( nstrata = NA_integer_, r = NA_real_, n = NA_real_, lambda = NA_real_, gamma = NA_real_, phi = NA_real_, plo = NA_real_ )
nstrata |
The number of strata. |
r |
The vector of number of responders across strata. |
n |
The vector of number of subjects across strata. |
lambda |
The prior probability that the drug activity is homogeneous across strata. |
gamma |
The prior probability that the drug is active in a stratum. |
phi |
The response probability for an active drug. |
plo |
The response probability for an inactive drug. |
A list containing the following five components:
case: The matrix with each row corresponding to a combination
of drug activity over strata represented by the columns.
prior_case: The vector of joint prior probabilities
for the stratum-specific response rates.
prior_stratum: The vector of marginal prior probabilities
for the stratum-specific response rates.
post_case: The vector of joint posterior probabilities
for the stratum-specific response rates.
post_stratum: The vector of marginal posterior probabilities
for the stratum-specific response rates.
Kaifeng Lu, [email protected]
a <- simonBayesAnalysis( nstrata = 10, r = c(8,0,1,1,6,2,0,0,3,3), n = c(19,10,26,8,14,7,8,5,4,14), lambda = 0.5, gamma = 0.33, phi = 0.35, plo = 0.15) a$post_stratuma <- simonBayesAnalysis( nstrata = 10, r = c(8,0,1,1,6,2,0,0,3,3), n = c(19,10,26,8,14,7,8,5,4,14), lambda = 0.5, gamma = 0.33, phi = 0.35, plo = 0.15) a$post_stratum
Obtains the simulated raw and summary data for Simon's Bayesian basket discovery trials.
simonBayesSim( p = NA_real_, accrualTime = 0L, accrualIntensity = NA_real_, stratumFraction = 1L, lambda = NA_real_, gamma = NA_real_, phi = NA_real_, plo = NA_real_, T = NA_real_, maxSubjects = NA_integer_, plannedSubjects = NA_integer_, maxNumberOfIterations = 1000L, maxNumberOfRawDatasets = 1L, seed = 0L )simonBayesSim( p = NA_real_, accrualTime = 0L, accrualIntensity = NA_real_, stratumFraction = 1L, lambda = NA_real_, gamma = NA_real_, phi = NA_real_, plo = NA_real_, T = NA_real_, maxSubjects = NA_integer_, plannedSubjects = NA_integer_, maxNumberOfIterations = 1000L, maxNumberOfRawDatasets = 1L, seed = 0L )
p |
The vector of true response probabilities across strata. |
accrualTime |
A vector that specifies the starting time of
piecewise Poisson enrollment time intervals. Must start with 0, e.g.,
|
accrualIntensity |
A vector of accrual intensities. One for each accrual time interval. |
stratumFraction |
A vector of stratum fractions that sum to 1. Defaults to 1 for no stratification. |
lambda |
The prior probability that the drug activity is homogeneous across strata. |
gamma |
The prior probability that the drug is active in a stratum. |
phi |
The response probability for an active drug. |
plo |
The response probability for an inactive drug. |
T |
The threshold for a conclusive posterior probability to stop enrollment. |
maxSubjects |
The maximum total sample size. |
plannedSubjects |
The planned cumulative number of subjects at each stage. |
maxNumberOfIterations |
The number of simulation iterations. Defaults to 1000. |
maxNumberOfRawDatasets |
The number of raw datasets to extract. |
seed |
The seed to reproduce the simulation results. The seed from the environment will be used if left unspecified, |
A list containing the following four components:
rawdata: A data frame for subject-level data, containing
the following variables:
iterationNumber: The iteration number.
stageNumber: The stage number.
subjectId: The subject ID.
arrivalTime: The enrollment time for the subject.
stratum: The stratum for the subject.
y: Whether the subject was a responder (1) or
nonresponder (0).
sumdata1: A data frame for simulation and stratum-level
summary data, containing the following variables:
iterationNumber: The iteration number.
stageNumber: The stage number.
stratum: The stratum number.
active: Whether the drug is active in the stratum.
n: The number of subjects in the stratum.
r: The number of responders in the stratum.
posterior: The posterior probability that the drug is
active in the stratum.
open: Whether the stratum is still open for enrollment.
positive: Whether the stratum has been determined to be
a positive stratum.
negative: Whether the stratum has been determined to be
a negative stratum.
sumdata2: A data frame for the simulation level summary data,
containing the following variables:
iterationNumber: The iteration number.
numberOfStrata: The total number of strata.
n_active_strata: The number of active strata.
true_positive: The number of true positive strata.
false_negative: The number of false negative strata.
false_positive: The number of false positive strata.
true_negative: The number of true negative strata.
n_indet_strata: The number of indeterminate strata.
numberOfSubjects: The number of subjects.
overview: A data frame for the summary across simulations,
containing the following variables:
numberOfStrata: The total number of strata.
n_active_strata: The average number of active strata.
true_positive: The average number of true positive strata.
false_negative: The average number of false negative strata.
false_positive: The average number of false positive strata.
true_negative: The average number of true negative strata.
n_indet_strata: The average number of indeterminate strata.
numberOfSubjects: The average number of subjects.
Kaifeng Lu, [email protected]
sim1 <- simonBayesSim( p = c(0.25, 0.25, 0.05), accrualIntensity = 5, stratumFraction = c(1/3, 1/3, 1/3), lambda = 0.33, gamma = 0.5, phi = 0.25, plo = 0.05, T = 0.8, maxSubjects = 50, plannedSubjects = seq(5, 50, 5), maxNumberOfIterations = 1000, maxNumberOfRawDatasets = 1, seed = 314159) sim1$overviewsim1 <- simonBayesSim( p = c(0.25, 0.25, 0.05), accrualIntensity = 5, stratumFraction = c(1/3, 1/3, 1/3), lambda = 0.33, gamma = 0.5, phi = 0.25, plo = 0.05, T = 0.8, maxSubjects = 50, plannedSubjects = seq(5, 50, 5), maxNumberOfIterations = 1000, maxNumberOfRawDatasets = 1, seed = 314159) sim1$overview
The data analyzed are the 16 selected cases in Lipsitz et al. (1994). The binary response is the wheezing status of 16 children at ages 9, 10, 11, and 12 years. A value of 1 of wheezing status indicates the occurrence of wheezing. The explanatory variables city of residence, age, and maternal smoking status at the particular age.
sixsix
An object of class tbl_df (inherits from tbl, data.frame) with 64 rows and 6 columns.
casecase id
citycity of residence
ageage of the child
smokematernal smoking status
wheezewheezing status
Obtains the predicted survivor function for a proportional hazards regression model.
survfit_phregr( object, newdata, sefit = TRUE, conftype = "log-log", conflev = 0.95 )survfit_phregr( object, newdata, sefit = TRUE, conftype = "log-log", conflev = 0.95 )
object |
The output from the |
newdata |
A data frame with the same variable names as those that
appear in the |
sefit |
Whether to compute the standard error of the survival estimates. |
conftype |
The type of the confidence interval. One of |
conflev |
The level of the two-sided confidence interval for the survival probabilities. Defaults to 0.95. |
If newdata is not provided and there is no covariate, survival
curves based on the basehaz data frame will be produced.
A data frame with the following variables:
id: The id of the subject for counting-process data with
time-dependent covariates.
time: The observed times in the data used to fit
phregr.
nrisk: The number of patients at risk at the time point in the
data used to fit phregr.
nevent: The number of patients having event at the time point
in the data used to fit phregr.
cumhaz: The cumulative hazard at the time point.
surv: The estimated survival probability at the time point.
sesurv: The standard error of the estimated survival probability.
lower: The lower confidence limit for survival probability.
upper: The upper confidence limit for survival probability.
conflev: The level of the two-sided confidence interval.
conftype: The type of the confidence interval.
covariates: The values of covariates based on newdata.
stratum: The stratum of the subject.
Kaifeng Lu, [email protected]
Terry M. Therneau and Patricia M. Grambsch. Modeling Survival Data: Extending the Cox Model. Springer-Verlag, 2000.
library(dplyr) # Example 1 with right-censored data fit1 <- phregr(data = rawdata %>% filter(iterationNumber == 1) %>% mutate(treat = 1*(treatmentGroup == 1)), stratum = "stratum", time = "timeUnderObservation", event = "event", covariates = "treat") surv1 <- survfit_phregr(fit1, newdata = data.frame( stratum = as.integer(c(1,1,2,2)), treat = c(1,0,1,0))) head(surv1) # Example 2 with counting process data and robust variance estimate fit2 <- phregr(data = heart %>% mutate(rx = as.numeric(transplant) - 1), time = "start", time2 = "stop", event = "event", covariates = c("rx", "age"), id = "id", robust = TRUE) surv2 <- survfit_phregr(fit2, newdata = data.frame( id = c(4,4,11,11), age = c(-7.737,-7.737,-0.019,-0.019), start = c(0,36,0,26), stop = c(36,39,26,153), rx = c(0,1,0,1))) head(surv2)library(dplyr) # Example 1 with right-censored data fit1 <- phregr(data = rawdata %>% filter(iterationNumber == 1) %>% mutate(treat = 1*(treatmentGroup == 1)), stratum = "stratum", time = "timeUnderObservation", event = "event", covariates = "treat") surv1 <- survfit_phregr(fit1, newdata = data.frame( stratum = as.integer(c(1,1,2,2)), treat = c(1,0,1,0))) head(surv1) # Example 2 with counting process data and robust variance estimate fit2 <- phregr(data = heart %>% mutate(rx = as.numeric(transplant) - 1), time = "start", time2 = "stop", event = "event", covariates = c("rx", "age"), id = "id", robust = TRUE) surv2 <- survfit_phregr(fit2, newdata = data.frame( id = c(4,4,11,11), age = c(-7.737,-7.737,-0.019,-0.019), start = c(0,36,0,26), stop = c(36,39,26,153), rx = c(0,1,0,1))) head(surv2)
Obtains the Brookmeyer-Crowley confidence interval for quantiles of right-censored time-to-event data.
survQuantile( time, event, cilevel = 0.95, transform = "loglog", probs = as.numeric(c(0.25, 0.5, 0.75)) )survQuantile( time, event, cilevel = 0.95, transform = "loglog", probs = as.numeric(c(0.25, 0.5, 0.75)) )
time |
The vector of possibly right-censored survival times. |
event |
The vector of event indicators. |
cilevel |
The confidence interval level. Defaults to 0.95. |
transform |
The transformation of the survival function to use to construct the confidence interval. Options include "linear" (alternatively "plain"), "log", "loglog" (alternatively "log-log" or "cloglog"), "asinsqrt" (alternatively "asin" or "arcsin"), and "logit". Defaults to "loglog". |
probs |
The vector of probabilities to calculate the quantiles. Defaults to c(0.25, 0.5, 0.75). |
A data frame containing the estimated quantile and confidence interval corresponding to each specified probability. It includes the following variables:
prob: The probability to calculate the quantile.
quantile: The estimated quantile.
lower: The lower limit of the confidence interval.
upper: The upper limit of the confidence interval.
cilevel: The confidence interval level.
transform: The transformation of the survival function to use
to construct the confidence interval.
Kaifeng Lu, [email protected]
survQuantile( time = c(33.7, 3.9, 10.5, 5.4, 19.5, 23.8, 7.9, 16.9, 16.6, 33.7, 17.1, 7.9, 10.5, 38), event = c(0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1), probs = c(0.25, 0.5, 0.75))survQuantile( time = c(33.7, 3.9, 10.5, 5.4, 19.5, 23.8, 7.9, 16.9, 16.6, 33.7, 17.1, 7.9, 10.5, 38), event = c(0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1), probs = c(0.25, 0.5, 0.75))
Computes the singular-value decomposition of a rectangular matrix.
svdcpp(X, outtransform = TRUE, decreasing = TRUE)svdcpp(X, outtransform = TRUE, decreasing = TRUE)
X |
A numeric matrix whose SVD decomposition is to be computed. |
outtransform |
Whether the orthogonal matrices composing of the left and right singular vectors are to be computed. |
decreasing |
Whether the singular values should be sorted in decreasing order and the corresponding singular vectors rearranged accordingly. |
Given , the following algorithm
overwrites with , where
is orthogonal, is
orthogonal, and is diagonal.
A list with the following components:
d: A vector containing the singular values of .
U: A matrix whose columns contain the left singular vectors
of .
V: A matrix whose columns contain the right singular vectors
of .
Kaifeng Lu, [email protected]
Gene N. Golub and Charles F. Van Loan. Matrix Computations, second edition. Baltimore, Maryland: The John Hopkins University Press, 1989, p.434.
A <- matrix(c(1,0,0,0, 1,2,0,0, 0,1,3,0, 0,0,1,4), 4, 4) svdcpp(A)A <- matrix(c(1,0,0,0, 1,2,0,0, 0,1,3,0, 0,0,1,4), 4, 4) svdcpp(A)
Data from Tobin's original paper.
durableDurable goods purchase
ageAge in years
quantLiquidity ratio (x 1000)
tobintobin
An object of class data.frame with 20 rows and 3 columns.
Updates the weights and transition matrix for graphical approaches.
updateGraph(w, G, I, j)updateGraph(w, G, I, j)
w |
The current vector of weights for elementary hypotheses. |
G |
The current transition matrix. |
I |
The set of indices for yet to be rejected hypotheses. |
j |
The hypothesis to remove from index set |
A list containing the new vector of weights, the new transition matrix for the graph, and the new set of indices of yet to be rejected hypotheses.
Kaifeng Lu, [email protected]
updateGraph(w = c(0.5, 0.5, 0, 0), G = matrix(c(0, 0.5, 0.5, 0, 0.5, 0, 0, 0.5, 0, 1, 0, 0, 1, 0, 0, 0), nrow=4, ncol=4, byrow=TRUE), I = c(1, 2, 3, 4), j = 1)updateGraph(w = c(0.5, 0.5, 0, 0), G = matrix(c(0, 0.5, 0.5, 0, 0.5, 0, 0, 0.5, 0, 1, 0, 0, 1, 0, 0, 0), nrow=4, ncol=4, byrow=TRUE), I = c(1, 2, 3, 4), j = 1)
Obtains the scaled Schoenfeld residuals and tests the proportional hazards assumption using a score test for the interaction between each covariate and a transformed time variable.
zph_phregr(object, transform = "km")zph_phregr(object, transform = "km")
object |
The output from the |
transform |
A character string indicating how survival times should be transformed before the test is performed. Supported values include "identity", "log", "rank", and "km" (default). |
This corresponds to the cox.zph function from the survival
package with terms = FALSE and global = TRUE.
A list with the following components:
table A matrix with one row for each parameter and a final
row for the global test. The columns contain the score test
for adding the time-dependent term, the degrees of freedom,
and the two-sided p-value.
x The transformed time values.
time The original (untransformed) event times, with tied event
times repeated.
strata The stratum index for each event.
y The matrix of scaled Schoenfeld residuals, with one column
for each parameter and one row for each event. Column names correspond
to the parameter names.
var An approximate covariance matrix of the scaled Schoenfeld
residuals, used to construct an approximate standard error band for
plots.
transform the transformation applied to the time values.
Kaifeng Lu, [email protected]
Patricia M. Grambsch and Terry M. Therneau. Proportional hazards tests and diagnostics based on weighted residuals. Biometrika 1994; 81:515-26.
fit <- phregr(data = liver, time = "Time", event = "Status", covariates = c("log(Bilirubin)", "log(Protime)", "log(Albumin)", "Age", "Edema"), ties = "breslow") zph <- zph_phregr(fit, transform = "log") zph$tablefit <- phregr(data = liver, time = "Time", event = "Status", covariates = c("log(Bilirubin)", "log(Protime)", "log(Albumin)", "Age", "Edema"), ties = "breslow") zph <- zph_phregr(fit, transform = "log") zph$table
Obtains the Miettinen-Nurminen score test statistic for two-sample odds ratio possibly with stratification.
zstatOddsRatio(n1, y1, n2, y2, oddsRatioH0 = 1)zstatOddsRatio(n1, y1, n2, y2, oddsRatioH0 = 1)
n1 |
The sample size for the active treatment group. |
y1 |
The number of responses for the active treatment group. |
n2 |
The sample size for the control group. |
y2 |
The number of responses for the control group. |
oddsRatioH0 |
The odds ratio under the null hypothesis. Defaults to 1. |
The Mantel-Haenszel sample size weights are used for stratified samples.
The value of the score test statistic.
Kaifeng Lu, [email protected]
zstatOddsRatio(n1 = c(10, 10), y1 = c(4, 3), n2 = c(20, 10), y2 = c(2, 0), oddsRatioH0 = 1)zstatOddsRatio(n1 = c(10, 10), y1 = c(4, 3), n2 = c(20, 10), y2 = c(2, 0), oddsRatioH0 = 1)
Obtains the Miettinen-Nurminen score test statistic for two-sample rate difference possibly with stratification.
zstatRateDiff(t1, y1, t2, y2, rateDiffH0 = 0)zstatRateDiff(t1, y1, t2, y2, rateDiffH0 = 0)
t1 |
The exposure for the active treatment group. |
y1 |
The number of events for the active treatment group. |
t2 |
The exposure for the control group. |
y2 |
The number of events for the control group. |
rateDiffH0 |
The rate difference under the null hypothesis. Defaults to 0. |
The Mantel-Haenszel weights are used for stratified samples.
The value of the score test statistic.
Kaifeng Lu, [email protected]
zstatRateDiff(t1 = c(10, 10), y1 = c(4, 3), t2 = c(20, 10), y2 = c(2, 0), rateDiffH0 = 0)zstatRateDiff(t1 = c(10, 10), y1 = c(4, 3), t2 = c(20, 10), y2 = c(2, 0), rateDiffH0 = 0)
Obtains the Miettinen-Nurminen score test statistic for two-sample rate ratio possibly with stratification.
zstatRateRatio(t1, y1, t2, y2, rateRatioH0 = 1)zstatRateRatio(t1, y1, t2, y2, rateRatioH0 = 1)
t1 |
The exposure for the active treatment group. |
y1 |
The number of events for the active treatment group. |
t2 |
The exposure for the control group. |
y2 |
The number of events for the control group. |
rateRatioH0 |
The rate ratio under the null hypothesis. Defaults to 1. |
The Mantel-Haenszel weights are used for stratified samples.
The value of the score test statistic.
Kaifeng Lu, [email protected]
zstatRateRatio(t1 = c(10, 10), y1 = c(4, 3), t2 = c(20, 10), y2 = c(2, 0), rateRatioH0 = 1)zstatRateRatio(t1 = c(10, 10), y1 = c(4, 3), t2 = c(20, 10), y2 = c(2, 0), rateRatioH0 = 1)
Obtains the Miettinen-Nurminen score test statistic for two-sample risk difference possibly with stratification.
zstatRiskDiff(n1, y1, n2, y2, riskDiffH0 = 0)zstatRiskDiff(n1, y1, n2, y2, riskDiffH0 = 0)
n1 |
The sample size for the active treatment group. |
y1 |
The number of responses for the active treatment group. |
n2 |
The sample size for the control group. |
y2 |
The number of responses for the control group. |
riskDiffH0 |
The risk difference under the null hypothesis. Defaults to 0. |
The Mantel-Haenszel sample size weights are used for stratified samples.
The value of the score test statistic.
Kaifeng Lu, [email protected]
zstatRiskDiff(n1 = c(10, 10), y1 = c(4, 3), n2 = c(20, 10), y2 = c(2, 0), riskDiffH0 = 0)zstatRiskDiff(n1 = c(10, 10), y1 = c(4, 3), n2 = c(20, 10), y2 = c(2, 0), riskDiffH0 = 0)
Obtains the Miettinen-Nurminen score test statistic for two-sample risk ratio possibly with stratification.
zstatRiskRatio(n1, y1, n2, y2, riskRatioH0 = 1)zstatRiskRatio(n1, y1, n2, y2, riskRatioH0 = 1)
n1 |
The sample size for the active treatment group. |
y1 |
The number of responses for the active treatment group. |
n2 |
The sample size for the control group. |
y2 |
The number of responses for the control group. |
riskRatioH0 |
The risk ratio under the null hypothesis. Defaults to 1. |
The Mantel-Haenszel sample size weights are used for stratified samples.
The value of the score test statistic.
Kaifeng Lu, [email protected]
zstatRiskRatio(n1 = c(10, 10), y1 = c(4, 3), n2 = c(20, 10), y2 = c(2, 0), riskRatioH0 = 1)zstatRiskRatio(n1 = c(10, 10), y1 = c(4, 3), n2 = c(20, 10), y2 = c(2, 0), riskRatioH0 = 1)