Package: lrstat 0.3.3

lrstat: Power and Sample Size Calculation for Non-Proportional Hazards and Beyond

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]

lrstat_0.3.3.tar.gz
lrstat_0.3.3.zip(r-4.7)lrstat_0.3.3.zip(r-4.6)lrstat_0.3.3.zip(r-4.5)
lrstat_0.3.3.tgz(r-4.6-x86_64)lrstat_0.3.3.tgz(r-4.6-arm64)lrstat_0.3.3.tgz(r-4.5-x86_64)lrstat_0.3.3.tgz(r-4.5-arm64)
lrstat_0.3.3.tar.gz(r-4.7-arm64)lrstat_0.3.3.tar.gz(r-4.7-x86_64)lrstat_0.3.3.tar.gz(r-4.6-arm64)lrstat_0.3.3.tar.gz(r-4.6-x86_64)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
lrstat/json (API)

# Install 'lrstat' in R:
install.packages('lrstat', repos = c('https://kaifenglu.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/kaifenglu/lrstat/issues

Pkgdown/docs site:https://kaifenglu.github.io

Uses libs:
  • c++– GNU Standard C++ Library v3
Datasets:
  • aml - Acute myelogenous leukemia survival data from the survival package
  • heart - Stanford heart transplant data from the survival package
  • immdef - Simulated CONCORDE trial data from the rpsftm package
  • ingots - The binary data from Cox and Snell (1989, pp. 10-11).
  • liver - The liver data used in SAS PROC PHREG documentation examples.
  • rawdata - A simulated time-to-event data set with 10 replications
  • sexagg - Urinary tract infection data from the logistf package
  • shilong - The randomized clinical trial SHIVA data in long format from the ipcwswitch package
  • six - The repeated measures data from the "Six Cities" study of the health effects of air pollution (Ware et al. 1984).
  • tobin - Tobin's tobit data from the survival package

On CRAN:

Conda:

cpp

7.95 score 4 stars 3 packages 40 scripts 1.1k downloads 203 exports 45 dependencies

Last updated from:9d0a47d073. Checks:12 OK, 1 FAIL. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK509
linux-devel-x86_64OK512
source / vignettesOK734
linux-release-arm64OK481
linux-release-x86_64OK526
macos-release-arm64OK400
macos-release-x86_64OK549
macos-oldrel-arm64OK364
macos-oldrel-x86_64OK904
windows-develOK575
windows-releaseOK522
windows-oldrelOK469
wasm-releaseFAIL179

Exports:accrualadaptDesignadaptDesign_mamsadaptDesign_seamlessassess_phregrbinary_tte_simBOINTablecaltimeClopperPearsonCIcorr_pfs_oscovrmstdtpwexperrorSpentexitprobexitprob_mamsexitprob_seamlessfadjpbonfadjpdunfadjpsimfloat_to_fractionfmodmixfquantilefseqbonfstdmixfstp2seqftruncfwgtmatgetAccrualDurationFromNgetADCIgetADCI_mamsgetADCI_seamlessgetADRCIgetBoundgetBound_mamsgetBound_seamlessgetCIgetCI_mamsgetCI_seamlessgetCPgetCP_mamsgetCP_seamlessgetDesigngetDesign_mamsgetDesign_seamlessgetDesign2getDesignAgreementgetDesignANOVAgetDesignANOVAContrastgetDesignEquivgetDesignFisherExactgetDesignLogisticgetDesignMeanDiffgetDesignMeanDiffCarryovergetDesignMeanDiffCarryoverEquivgetDesignMeanDiffEquivgetDesignMeanDiffMMRMgetDesignMeanDiffXOgetDesignMeanDiffXOEquivgetDesignMeanRatiogetDesignMeanRatioEquivgetDesignMeanRatioXOgetDesignMeanRatioXOEquivgetDesignOddsRatiogetDesignOddsRatioEquivgetDesignOneMeangetDesignOneMultinomgetDesignOneProportiongetDesignOneRateExactgetDesignOneSlopegetDesignOrderedBinomgetDesignPairedMeanDiffgetDesignPairedMeanDiffEquivgetDesignPairedMeanRatiogetDesignPairedMeanRatioEquivgetDesignPairedPropMcNemargetDesignRepeatedANOVAgetDesignRepeatedANOVAContrastgetDesignRiskDiffgetDesignRiskDiffEquivgetDesignRiskDiffExactgetDesignRiskDiffExactEquivgetDesignRiskRatiogetDesignRiskRatioEquivgetDesignRiskRatioExactgetDesignRiskRatioExactEquivgetDesignRiskRatioFMgetDesignSlopeDiffgetDesignSlopeDiffMMRMgetDesignTwoMultinomgetDesignTwoOrdinalgetDesignTwoWayANOVAgetDesignUnorderedBinomgetDesignUnorderedMultinomgetDesignWilcoxongetDurationFromNeventsgetNeventsFromHazardRatiogetRCIhazard_pdhazard_subhedgesgkmdiffkmestkmpowerkmpower1skmpowerequivkmsamplesizekmsamplesize1skmsamplesizeequivkmstatkmsurvliferegrlogisregrlrpowerlrpowerequivlrsamplesizelrsamplesizeequivlrschoenfeldlrsimlrsim_mamslrsim_seamlesslrsim2elrsim2e3alrsim3alrsimsublrstatlrtestmnOddsRatioCImnRateDiffCImnRateRatioCImnRiskDiffCImnRiskRatioCImTPI2Tablemtpwexpnatrisknbpowernbpower1snbpowerequivnbsamplesizenbsamplesize1snbsamplesizeequivnbstatneventpatriskpbvnormpeventphregrpmvnormrpowerFisherExactpowerOnePropExactpowerOneRateExactpowerRiskDiffExactpowerRiskDiffExactEquivpowerRiskRatioExactpowerRiskRatioExactEquivptpwexppwexpcutspwexploglikqmvnormrqtpwexpremlOddsRatioremlRateDiffremlRateRatioremlRiskDiffremlRiskRatiorepeatedPValueresiduals_liferegrresiduals_phregrriskDiffExactCIriskDiffExactPValueriskRatioExactCIriskRatioExactPValuermdiffrmestrmpowerrmpower1srmpowerequivrmsamplesizermsamplesize1srmsamplesizeequivrmstrmstatrtpwexprunShinyApp_lrstatsamplesizeFisherExactsamplesizeOnePropExactsamplesizeOneRateExactsamplesizeRiskDiffExactsamplesizeRiskDiffExactEquivsamplesizeRiskRatioExactsamplesizeRiskRatioExactEquivsimon2stagesimonBayesAnalysissimonBayesSimsurvfit_phregrsurvQuantilesvdcppupdateGraphzph_phregrzstatOddsRatiozstatRateDiffzstatRateRatiozstatRiskDiffzstatRiskRatio

Dependencies:base64encBHbslibcachemclicommonmarkcpp11digestfarverfastmapfontawesomefsggplot2gluegtablehtmltoolshttpuvisobandjquerylibjsonlitelabelinglaterlifecyclelpSolvemagrittrmemoisemimeotelpromisesR6rappdirsRColorBrewerRcppRcppParallelRcppThreadrlangS7sassscalesshinysourcetoolsvctrsviridisLitewithrxtable

Power Calculation Using Max-Combo Tests

Last update: 2026-05-04
Started: 2022-07-25

Comparing Direct Approximation and Schoenfeld Methods

Last update: 2026-03-03
Started: 2022-08-04

Sample Size Calculation With Fixed Follow-up

Last update: 2026-03-03
Started: 2022-07-25

Simulation for Group Sequential Trials

Last update: 2026-03-03
Started: 2022-07-25

Power Calculation With Stratification Variables

Last update: 2026-03-03
Started: 2022-07-25

Sample Size Calculation Under Non-Proportional Hazards

Last update: 2025-11-30
Started: 2022-07-25

Readme and manuals

Help Manual

Help pageTopics
Power and Sample Size Calculation for Non-Proportional Hazards and Beyondlrstat-package
Number of Enrolled Subjectsaccrual
Adaptive Design at an Interim LookadaptDesign
Adaptive Multi-Arm Multi-Stage DesignadaptDesign_mams
Adaptive Phase 2/3 Seamless DesignadaptDesign_seamless
Acute myelogenous leukemia survival data from the survival packageaml
Assess Proportional Hazards Assumption Based on Supremum Testassess_phregr
Simulation for a Binary and a Time-to-Event Endpoint in Group Sequential Trialsbinary_tte_sim
BOIN Decision Table for Dose-Finding TrialsBOINTable
Calendar Times for Target Number of Eventscaltime
Clopper-Pearson Confidence Interval for One-Sample ProportionClopperPearsonCI
Correlation Between PFS and OS Given Correlation Between PD and OScorr_pfs_os
Covariance Between Restricted Mean Survival Timescovrmst
Density Function of Truncated Piecewise Exponential Distributiondtpwexp
Error SpendingerrorSpent
Stagewise Exit Probabilitiesexitprob
Exit Probabilities for Multi-Arm Multi-Stage Designexitprob_mams
Exit Probabilities for Phase 2/3 Seamless Designexitprob_seamless
Adjusted p-Values for Bonferroni-Based Graphical Approachesfadjpbon
Adjusted p-Values for Dunnett-Based Graphical Approachesfadjpdun
Adjusted p-Values for Simes-Based Graphical Approachesfadjpsim
Converting a decimal to a fractionfloat_to_fraction
Adjusted p-Values for Modified Mixture Gatekeeping Proceduresfmodmix
The Quantiles of a Survival Distributionfquantile
Group Sequential Trials Using Bonferroni-Based Graphical Approachesfseqbon
Adjusted p-Values for Standard Mixture Gatekeeping Proceduresfstdmix
Adjusted p-Values for Stepwise Testing Procedures for Two Sequencesfstp2seq
Adjusted p-Values for Holm, Hochberg, and Hommel Proceduresftrunc
Weight Matrix for All Intersection Hypothesesfwgtmat
Accrual Duration to Enroll Target Number of SubjectsgetAccrualDurationFromN
Confidence Interval After AdaptationgetADCI
Confidence Interval After Adaptation for Multi-Arm Multi-Stage DesigngetADCI_mams
Confidence Interval After Adaptation for Phase 2/3 Seamless DesigngetADCI_seamless
Repeated Confidence Interval After AdaptationgetADRCI
Efficacy Boundaries for Group Sequential DesigngetBound
Efficacy Boundaries for Multi-Arm Multi-Stage DesigngetBound_mams
Efficacy Boundaries for Phase 2/3 Seamless DesigngetBound_seamless
Confidence Interval After Trial TerminationgetCI
Confidence Interval After Trial Termination for Multi-Arm Multi-Stage DesigngetCI_mams
Confidence Interval After Trial Termination for Phase 2/3 Seamless DesigngetCI_seamless
Conditional Power for Generic Group Sequential DesigngetCP
Conditional Power for Multi-Arm Multi-Stage DesigngetCP_mams
Conditional Power for Phase 2/3 Seamless DesigngetCP_seamless
Power and Sample Size for Generic Group Sequential DesigngetDesign
Power and Sample Size for Multi-Arm Multi-Stage DesigngetDesign_mams
Power and Sample Size for Phase 2/3 Seamless DesigngetDesign_seamless
Power and Sample Size for Group Sequential Design With Futility Stopping Under Null HypothesisgetDesign2
Power and Sample Size for Cohen's kappagetDesignAgreement
Power and Sample Size for One-Way ANOVAgetDesignANOVA
Power and Sample Size for One-Way ANOVA ContrastgetDesignANOVAContrast
Power and Sample Size for Generic Group Sequential Equivalence DesigngetDesignEquiv
Power and Sample Size for Fisher's Exact Test for Two ProportionsgetDesignFisherExact
Power and Sample Size for Logistic RegressiongetDesignLogistic
Group Sequential Design for Two-Sample Mean DifferencegetDesignMeanDiff
Power and Sample Size for Direct Treatment Effects in Crossover TrialsgetDesignMeanDiffCarryover
Power and Sample Size for Equivalence in Direct Treatment Effects in Crossover TrialsgetDesignMeanDiffCarryoverEquiv
Group Sequential Design for Equivalence in Two-Sample Mean DifferencegetDesignMeanDiffEquiv
Group Sequential Design for Two-Sample Mean Difference From the MMRM ModelgetDesignMeanDiffMMRM
Group Sequential Design for Mean Difference in 2x2 CrossovergetDesignMeanDiffXO
Group Sequential Design for Equivalence in Mean Difference in 2x2 CrossovergetDesignMeanDiffXOEquiv
Group Sequential Design for Two-Sample Mean RatiogetDesignMeanRatio
Group Sequential Design for Equivalence in Two-Sample Mean RatiogetDesignMeanRatioEquiv
Group Sequential Design for Mean Ratio in 2x2 CrossovergetDesignMeanRatioXO
Group Sequential Design for Equivalence in Mean Ratio in 2x2 CrossovergetDesignMeanRatioXOEquiv
Group Sequential Design for Two-Sample Odds RatiogetDesignOddsRatio
Group Sequential Design for Equivalence in Two-Sample Odds RatiogetDesignOddsRatioEquiv
Group Sequential Design for One-Sample MeangetDesignOneMean
Power and Sample Size for One-Sample Multinomial ResponsegetDesignOneMultinom
Group Sequential Design for One-Sample ProportiongetDesignOneProportion
Power and Sample Size for One-Sample Poisson Rate Exact TestgetDesignOneRateExact
Group Sequential Design for One-Sample SlopegetDesignOneSlope
Power and Sample Size for Cochran-Armitage Trend Test for Ordered Multi-Sample Binomial ResponsegetDesignOrderedBinom
Group Sequential Design for Paired Mean DifferencegetDesignPairedMeanDiff
Group Sequential Design for Equivalence in Paired Mean DifferencegetDesignPairedMeanDiffEquiv
Group Sequential Design for Paired Mean RatiogetDesignPairedMeanRatio
Group Sequential Design for Equivalence in Paired Mean RatiogetDesignPairedMeanRatioEquiv
Group Sequential Design for McNemar's Test for Paired ProportionsgetDesignPairedPropMcNemar
Power and Sample Size for Repeated-Measures ANOVAgetDesignRepeatedANOVA
Power and Sample Size for One-Way Repeated Measures ANOVA ContrastgetDesignRepeatedANOVAContrast
Group Sequential Design for Two-Sample Risk DifferencegetDesignRiskDiff
Group Sequential Design for Equivalence in Two-Sample Risk DifferencegetDesignRiskDiffEquiv
Power and Sample Size for Exact Unconditional Test for Risk DifferencegetDesignRiskDiffExact
Power and Sample Size for Exact Unconditional Test for Equivalence in Risk DifferencegetDesignRiskDiffExactEquiv
Group Sequential Design for Two-Sample Risk RatiogetDesignRiskRatio
Group Sequential Design for Equivalence in Two-Sample Risk RatiogetDesignRiskRatioEquiv
Power and Sample Size for Exact Unconditional Test for Risk RatiogetDesignRiskRatioExact
Power and Sample Size for Exact Unconditional Test for Equivalence in Risk RatiogetDesignRiskRatioExactEquiv
Group Sequential Design for Two-Sample Risk Ratio Based on the Farrington-Manning Score TestgetDesignRiskRatioFM
Group Sequential Design for Two-Sample Slope DifferencegetDesignSlopeDiff
Group Sequential Design for Two-Sample Slope Difference From the MMRM ModelgetDesignSlopeDiffMMRM
Power and Sample Size for Difference in Two-Sample Multinomial ResponsesgetDesignTwoMultinom
Power and Sample Size for the Wilcoxon Test for Two-Sample Ordinal ResponsegetDesignTwoOrdinal
Power and Sample Size for Two-Way ANOVAgetDesignTwoWayANOVA
Power and Sample Size for Unordered Multi-Sample Binomial ResponsegetDesignUnorderedBinom
Power and Sample Size for Unordered Multi-Sample Multinomial ResponsegetDesignUnorderedMultinom
Group Sequential Design for Two-Sample Wilcoxon TestgetDesignWilcoxon
Range of Accrual Duration for Target Number of EventsgetDurationFromNevents
Required Number of Events Given Hazard RatiogetNeventsFromHazardRatio
Repeated Confidence Interval for Group Sequential DesigngetRCI
Hazard Function for Progressive Disease (PD) Given Correlation Between PD and OShazard_pd
Hazard Function for Sub Populationhazard_sub
Stanford heart transplant data from the survival packageheart
Hedges' g Effect Sizehedgesg
Simulated CONCORDE trial data from the rpsftm packageimmdef
The binary data from Cox and Snell (1989, pp. 10-11).ingots
Estimate of Milestone Survival Differencekmdiff
Kaplan-Meier Estimates of Survival Curvekmest
Power for Difference in Milestone Survival Probabilitieskmpower
Power for One-Sample Milestone Survival Probabilitykmpower1s
Power for Equivalence in Milestone Survival Probability Differencekmpowerequiv
Sample Size for Difference in Milestone Survival Probabilitieskmsamplesize
Sample Size for One-Sample Milestone Survival Probabilitykmsamplesize1s
Sample Size for Equivalence in Milestone Survival Probability Differencekmsamplesizeequiv
Stratified Difference in Milestone Survival Probabilitieskmstat
Parametric Regression Models for Failure Time Dataliferegr
The liver data used in SAS PROC PHREG documentation examples.liver
Logistic Regression Models for Binary Datalogisregr
Log-Rank Test Powerlrpower
Power for Equivalence in Hazard Ratiolrpowerequiv
Log-Rank Test Sample Sizelrsamplesize
Sample Size for Equivalence in Hazard Ratiolrsamplesizeequiv
Schoenfeld Method for Log-Rank Test Sample Size Calculationlrschoenfeld
Log-Rank Test Simulationlrsim
Log-Rank Test Simulation for Multi-Arm Multi-Stage Designlrsim_mams
Log-Rank Test Simulation for Phase 2/3 Seamless Designlrsim_seamless
Log-Rank Test Simulation for PFS and OS Endpointslrsim2e
Log-Rank Test Simulation for Two Endpoints (PFS and OS) and Three Armslrsim2e3a
Log-Rank Test Simulation for Three Armslrsim3a
Log-Rank Test Simulation for Enrichment Designlrsimsub
Number of Subjects Having an Event and Log-Rank Statisticslrstat
Log-Rank Test of Survival Curve Differencelrtest
Miettinen-Nurminen Score Confidence Interval for Two-Sample Odds RatiomnOddsRatioCI
Miettinen-Nurminen Score Confidence Interval for Two-Sample Rate DifferencemnRateDiffCI
Miettinen-Nurminen Score Confidence Interval for Two-Sample Rate RatiomnRateRatioCI
Miettinen-Nurminen Score Confidence Interval for Two-Sample Risk DifferencemnRiskDiffCI
Miettinen-Nurminen Score Confidence Interval for Two-Sample Risk RatiomnRiskRatioCI
mTPI-2 Decision TablemTPI2Table
Mean and Variance of Truncated Piecewise Exponential Distributionmtpwexp
Number of Subjects at Risknatrisk
Power for Negative Binomial Rate Rationbpower
Power for One-Sample Negative Binomial Ratenbpower1s
Power for Equivalence in Negative Binomial Rate Rationbpowerequiv
Sample Size for Negative Binomial Rate Rationbsamplesize
Sample Size for One-Sample Negative Binomial Ratenbsamplesize1s
Sample Size for Equivalence in Negative Binomial Rate Rationbsamplesizeequiv
Negative Binomial Rate Rationbstat
Number of Subjects Having an Event by Calendar Timenevent
Probability of Being at Riskpatrisk
Distribution Function of the Standard Bivariate Normalpbvnorm
Probability of Having an Eventpevent
Proportional Hazards Regression Modelsphregr
Multivariate Normal Probabilities over a Hyperrectanglepmvnormr
Distribution Function of Truncated Piecewise Exponential Distributionptpwexp
Piecewise Exponential Approximation to a Survival Distributionpwexpcuts
Profile Log-Likelihood Function for Change Points in Piecewise Exponential Approximationpwexploglik
Equicoordinate Quantiles of the Multivariate Normal Distributionqmvnormr
Quantile Function of Truncated Piecewise Exponential Distributionqtpwexp
A simulated time-to-event data set with 10 replicationsrawdata
REML Estimates of Individual Proportions With Specified Odds RatioremlOddsRatio
REML Estimates of Individual Rates With Specified Rate DifferenceremlRateDiff
REML Estimates of Individual Rates With Specified Rate RatioremlRateRatio
REML Estimates of Individual Proportions With Specified Risk differenceremlRiskDiff
REML Estimates of Individual Proportions With Specified Risk RatioremlRiskRatio
Repeated p-Values for Group Sequential DesignrepeatedPValue
Residuals for Parametric Regression Models for Failure Time Dataresiduals_liferegr
Residuals for Proportional Hazards Regression Modelsresiduals_phregr
Exact Unconditional Confidence Interval for Risk DifferenceriskDiffExactCI
P-Value for Exact Unconditional Test of Risk DifferenceriskDiffExactPValue
Exact Unconditional Confidence Interval for Risk RatioriskRatioExactCI
P-Value for Exact Unconditional Test of Risk RatioriskRatioExactPValue
Estimate of Restricted Mean Survival Time Differencermdiff
Estimate of Restricted Mean Survival Timermest
Power for Difference in Restricted Mean Survival Timesrmpower
Power for One-Sample Restricted Mean Survival Timermpower1s
Power for Equivalence in Restricted Mean Survival Time Differencermpowerequiv
Sample Size for Difference in Restricted Mean Survival Timesrmsamplesize
Sample Size for One-Sample Restricted Mean Survival Timermsamplesize1s
Sample Size for Equivalence in Restricted Mean Survival Time Differencermsamplesizeequiv
Restricted Mean Survival Timermst
Stratified Difference in Restricted Mean Survival Timesrmstat
Random Number Generation Function of Truncated Piecewise Exponential Distributionrtpwexp
Run Shiny ApprunShinyApp_lrstat
Urinary tract infection data from the logistf packagesexagg
The randomized clinical trial SHIVA data in long format from the ipcwswitch packageshilong
Simon's Two-Stage Designsimon2stage
Analysis of Simon's Bayesian Basket TrialssimonBayesAnalysis
Simulation of Simon's Bayesian Basket TrialssimonBayesSim
The repeated measures data from the "Six Cities" study of the health effects of air pollution (Ware et al. 1984).six
Survival Curve for Proportional Hazards Regression Modelssurvfit_phregr
Brookmeyer-Crowley Confidence Interval for Quantiles of Right-Censored Time-to-Event DatasurvQuantile
Singular Value Decomposition of a Matrixsvdcpp
Tobin's tobit data from the survival packagetobin
Update Graph for Graphical ApproachesupdateGraph
Assess Proportional Hazards Assumption Based on Scaled Schoenfeld Residualszph_phregr
Miettinen-Nurminen Score Test Statistic for Two-Sample Odds RatiozstatOddsRatio
Miettinen-Nurminen Score Test Statistic for Two-Sample Rate DifferencezstatRateDiff
Miettinen-Nurminen Score Test Statistic for Two-Sample Rate RatiozstatRateRatio
Miettinen-Nurminen Score Test Statistic for Two-Sample Risk differencezstatRiskDiff
Miettinen-Nurminen Score Test Statistic for Two-Sample Risk RatiozstatRiskRatio