R version 4.6.0 alpha (2026-04-08 r89810 ucrt) Copyright (C) 2026 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # This file is part of the standard setup for testthat. > # It is recommended that you do not modify it. > # > # Where should you do additional test configuration? > # Learn more about the roles of various files in: > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview > # * https://testthat.r-lib.org/articles/special-files.html > > library(testthat) > library(OptSurvCutR) OptSurvCutR v0.2.0 • Docs: https://github.com/paytonyau/OptSurvCutR • Paper: Yau, Payton (2025) bioRxiv 10.1101/2025.10.08.681246 • Cite: citation('OptSurvCutR') Please cite the paper to support development. > > test_check("OptSurvCutR") ## rgenoud (Version 5.9-0.11, Build Date: 2024-10-03) ## See http://sekhon.berkeley.edu/rgenoud for additional documentation. ## Please cite software as: ## Walter Mebane, Jr. and Jasjeet S. Sekhon. 2011. ## ``Genetic Optimization Using Derivatives: The rgenoud package for R.'' ## Journal of Statistical Software, 42(11): 1-26. ## num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 230.61 1.69 20% Substantial NA 1 229.58 0.66 33.5% Substantial 68.79 2 228.92 0.00 46.5% Substantial 45.24, 49.21 num_cuts AIC Delta_AIC AIC_Weight Evidence cuts 0 228.52 3.78 10.8% Moderate NA 1 227.48 2.75 18% Moderate 68.21 2 224.74 0.00 71.2% Substantial 45.07, 47.37 num_cuts AICc Delta_AICc AICc_Weight Evidence cuts 0 228.59 1.03 24.8% Substantial NA 1 227.55 0.00 41.5% Substantial 68.19 2 227.97 0.42 33.7% Substantial 47.19, 50.69 num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 230.61 3.59 11.4% Moderate NA 1 229.51 2.49 19.8% Moderate 59.77 2 227.02 0.00 68.8% Substantial 55.26, 55.53 num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 238.74 5.29 6.6% Moderate NA 1 233.45 0.00 93.4% Substantial 59.77 num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 234.71 0.83 39.8% Substantial NA 1 233.88 0.00 60.2% Substantial 48.75 num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 230.61 1.1 36.6% Substantial NA 1 229.51 0.0 63.4% Substantial 59.77 num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 230.61 1.03 37.4% Substantial NA 1 229.58 0.00 62.6% Substantial 68.42 i nmin 0.1 is a proportion. Min. group size set to 6. i Finding optimal cut number: method = systematic No valid results found with given parameters. num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 4.09 0 50% Substantial NA 1 4.09 0 50% Substantial 34.52 num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 4.09 0 50% Substantial NA 1 4.09 0 50% Substantial 47.46 Could not determine optimal cut-point. Could not determine optimal cut-point. -- Optimal Cut-point Analysis for Survival Data (Genetic) ---------------------- * Predictor: predictor * Criterion: logrank * Optimal Log-Rank Statistic: 2.2436 v Recommended Cut-point(s): 47.462 Could not determine optimal cut-point. Could not determine optimal cut-point. -- Optimal Cut-point Analysis for Survival Data (Systematic) ------------------- -- Group Counts -- Group N Events 1 G1 30 20 2 G2 30 16 -- Median Survival by Group -- Call: survfit(formula = survival::Surv(time, event) ~ group, data = data) n events median 0.95LCL 0.95UCL group=G1 30 20 23.8 9.46 NA group=G2 30 16 28.9 11.39 NA -- Final Cox Model Summary -- -- Analysis Parameters --------------------------------------------------------- * Search Method: Systematic * Predictor: predictor * Number of cuts: 1 * Minimum group size (nmin): 20 i Generating Forest Plot of Hazard Ratios... ! Invalid/missing reference group. Defaulting to: G1 i Using random seed 42 for reproducibility. i Validating 1 cut(s) from 'systematic' search using 'logrank'. i Running 20 replicates sequentially (n_cores = 1). v 20 replicates completed. Cut-point Stability Analysis (Bootstrap) ---------------------------------------- Original Optimal Cut-point(s): 37.893 Successful Replicates: 20 / 20 ( 100 %) Failed Replicates: 0 95% Confidence Intervals ------------------------ Lower Upper Cut 1 34.347 43.193 Bootstrap Summary Statistics --------------------------- Cut Mean SD Median Q1 Q3 25% Cut1 38.745 2.376 39.275 37.893 39.281 Hint: Use `summary()` or `plot()` to visualise stability. Cut-point Stability Analysis (Bootstrap) ---------------------------------------- Original Optimal Cut-point(s): 54.961, 72.866 Successful Replicates: 20 / 20 ( 100 %) Failed Replicates: 0 95% Confidence Intervals ------------------------ Lower Upper Cut 1 34.586 71.455 Cut 2 47.978 73.775 Bootstrap Summary Statistics --------------------------- Cut Mean SD Median Q1 Q3 25% Cut1 57.372 11.563 57.945 49.883 68.011 25%1 Cut2 67.994 8.543 72.024 69.556 72.791 Hint: Use `summary()` or `plot()` to visualise stability. Cut-point Stability Analysis (Bootstrap) ---------------------------------------- Original Optimal Cut-point(s): 37.893 Successful Replicates: 20 / 20 ( 100 %) Failed Replicates: 0 95% Confidence Intervals ------------------------ Lower Upper Cut 1 35.157 57.366 Bootstrap Summary Statistics --------------------------- Cut Mean SD Median Q1 Q3 25% Cut1 40.832 6.967 37.893 37.614 39.585 Hint: Use `summary()` or `plot()` to visualise stability. Cut-point Stability Analysis (Bootstrap) ---------------------------------------- Original Optimal Cut-point(s): 59.774 Successful Replicates: 20 / 20 ( 100 %) Failed Replicates: 0 95% Confidence Intervals ------------------------ Lower Upper Cut 1 34.409 63.316 Bootstrap Summary Statistics --------------------------- Cut Mean SD Median Q1 Q3 25% Cut1 48.212 9.471 45.461 41.809 56.559 Hint: Use `summary()` or `plot()` to visualise stability. Cut-point Stability Analysis (Bootstrap) ---------------------------------------- Original Optimal Cut-point(s): 45.461 Successful Replicates: 20 / 20 ( 100 %) Failed Replicates: 0 95% Confidence Intervals ------------------------ Lower Upper Cut 1 34.409 64.633 Bootstrap Summary Statistics --------------------------- Cut Mean SD Median Q1 Q3 25% Cut1 49.808 10.703 45.461 41.809 59.774 Hint: Use `summary()` or `plot()` to visualise stability. i Using random seed 1 for reproducibility. i Generating Forest Plot of Hazard Ratios... No valid optimal cut-point found. -- Optimal Cut-point Analysis for Survival Data (Systematic) ------------------- -- Optimal Cut-point Analysis for Survival Data (Systematic) ------------------- -- Group Counts -- Group N Events 1 G1 30 20 2 G2 30 16 -- Median Survival by Group -- Call: survfit(formula = survival::Surv(time, event) ~ group, data = data) n events median 0.95LCL 0.95UCL group=G1 30 20 23.8 9.46 NA group=G2 30 16 28.9 11.39 NA -- Final Cox Model Summary -- Call: survival::coxph(formula = as.formula(formula_str), data = data) n= 60, number of events= 36 coef exp(coef) se(coef) z Pr(>|z|) groupG2 -0.52173 0.59349 0.35511 -1.469 0.142 covariate1 -0.01818 0.98198 0.14227 -0.128 0.898 exp(coef) exp(-coef) lower .95 upper .95 groupG2 0.5935 1.685 0.2959 1.190 covariate1 0.9820 1.018 0.7430 1.298 Concordance= 0.565 (se = 0.054 ) Likelihood ratio test= 2.24 on 2 df, p=0.3 Wald test = 2.21 on 2 df, p=0.3 Score (logrank) test = 2.26 on 2 df, p=0.3 -- Proportional Hazards Assumption Test -- chisq df p group 0.0757 1 0.783 covariate1 3.0228 1 0.082 GLOBAL 3.3591 2 0.186 -- Analysis Parameters --------------------------------------------------------- * Search Method: Systematic * Predictor: predictor * Number of cuts: 1 * Minimum group size (nmin): 20 * Covariates: covariate1 i Generating Forest Plot of Hazard Ratios... ! Invalid/missing reference group. Defaulting to: G1 i Generating Forest Plot of Hazard Ratios... -- Optimal Cut-point Number Analysis (Systematic) ------------------------------ num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 230.61 1.1 36.6% Substantial NA 1 229.51 0.0 63.4% Substantial 59.77 -- Optimal Cut-point Number Analysis (Systematic) ------------------------------ -- Analysis Parameters --------------------------------------------------------- * Search Method: Systematic * Predictor: predictor * Criterion: BIC * Maximum Cuts: 1 * Minimum Group Size (nmin): 6 num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 230.61 1.1 36.6% Substantial NA 1 229.51 0.0 63.4% Substantial 59.77 Group N Events 1 G1 45 30 2 G2 15 6 Call: survfit(formula = survival::Surv(time, event) ~ group, data = data) n events median 0.95LCL 0.95UCL group=G1 45 30 23.8 8.77 30.5 group=G2 15 6 33.0 15.57 NA Call: survival::coxph(formula = as.formula(formula_str), data = model_data) n= 60, number of events= 36 coef exp(coef) se(coef) z Pr(>|z|) groupG2 -0.6663 0.5136 0.4497 -1.482 0.138 exp(coef) exp(-coef) lower .95 upper .95 groupG2 0.5136 1.947 0.2127 1.24 Concordance= 0.574 (se = 0.035 ) Likelihood ratio test= 2.52 on 1 df, p=0.1 Wald test = 2.19 on 1 df, p=0.1 Score (logrank) test = 2.28 on 1 df, p=0.1 num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 230.61 1.1 36.6% Substantial NA 1 229.51 0.0 63.4% Substantial 59.77 -- Optimal Cut-point Number Analysis (Systematic) ------------------------------ -- Optimal Cut-point Number Analysis ------------------------------------------- Method: systematic Criterion: BIC num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 230.61 1.1 36.6% Substantial NA 1 229.51 0.0 63.4% Substantial 59.77 v Conclusion: 1 cut-point(s) is best based on BIC. Optimal cuts at: 59.77 Hint: Use `summary()` for details, `plot()` to visualise. -- Details for Best Model ------------------------------------------------------ The best model found has 1 cut-point(s). Cut-point values: 59.77. -- Group Counts -- Group N Events 1 G1 45 30 2 G2 15 6 -- Median Survival by Group -- Call: survfit(formula = survival::Surv(time, event) ~ group, data = data) n events median 0.95LCL 0.95UCL group=G1 45 30 23.8 8.77 30.5 group=G2 15 6 33.0 15.57 NA -- Final Cox Proportional-Hazards Model -- Call: survival::coxph(formula = as.formula(formula_str), data = model_data) n= 60, number of events= 36 coef exp(coef) se(coef) z Pr(>|z|) groupG2 -0.6663 0.5136 0.4497 -1.482 0.138 exp(coef) exp(-coef) lower .95 upper .95 groupG2 0.5136 1.947 0.2127 1.24 Concordance= 0.574 (se = 0.035 ) Likelihood ratio test= 2.52 on 1 df, p=0.1 Wald test = 2.19 on 1 df, p=0.1 Score (logrank) test = 2.28 on 1 df, p=0.1 -- Analysis Parameters --------------------------------------------------------- * Search Method: Systematic * Predictor: predictor * Criterion: BIC * Maximum Cuts: 1 * Minimum Group Size (nmin): 6 Cut-point Stability Analysis (Bootstrap) ---------------------------------------- Original Optimal Cut-point(s): 37.893 Successful Replicates: 20 / 20 ( 100 %) Failed Replicates: 0 95% Confidence Intervals ------------------------ Lower Upper Cut 1 34.347 43.193 Bootstrap Summary Statistics --------------------------- Cut Mean SD Median Q1 Q3 25% Cut1 38.745 2.376 39.275 37.893 39.281 Hint: Use `summary()` or `plot()` to visualise stability. i nmin 0.2 is a proportion. Min. group size set to 12. num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 230.61 1.10 31.7% Substantial NA 1 229.51 0.00 55% Substantial 59.77 2 232.36 2.85 13.2% Moderate 45.46, 55.01 Cut-point Stability Analysis (Bootstrap) ---------------------------------------- Original Optimal Cut-point(s): 59.774 Successful Replicates: 20 / 20 ( 100 %) Failed Replicates: 0 95% Confidence Intervals ------------------------ Lower Upper Cut 1 34.409 64.633 Bootstrap Summary Statistics --------------------------- Cut Mean SD Median Q1 Q3 25% Cut1 49.808 10.703 45.461 41.809 59.774 Hint: Use `summary()` or `plot()` to visualise stability. -- Optimal Cut-point Analysis for Survival Data (Systematic) ------------------- -- Group Counts -- Group N Events 1 G1 45 30 2 G2 15 6 -- Median Survival by Group -- Call: survfit(formula = survival::Surv(time, event) ~ group, data = data) n events median 0.95LCL 0.95UCL group=G1 45 30 23.8 8.77 30.5 group=G2 15 6 33.0 15.57 NA -- Final Cox Model Summary -- Call: survival::coxph(formula = as.formula(formula_str), data = data) n= 60, number of events= 36 coef exp(coef) se(coef) z Pr(>|z|) groupG2 -0.70451 0.49435 0.46678 -1.509 0.131 covariate1 -0.03508 0.96552 0.14474 -0.242 0.808 covariate2B 0.09822 1.10321 0.34695 0.283 0.777 exp(coef) exp(-coef) lower .95 upper .95 groupG2 0.4943 2.0229 0.1980 1.234 covariate1 0.9655 1.0357 0.7270 1.282 covariate2B 1.1032 0.9064 0.5589 2.178 Concordance= 0.598 (se = 0.054 ) Likelihood ratio test= 2.68 on 3 df, p=0.4 Wald test = 2.36 on 3 df, p=0.5 Score (logrank) test = 2.44 on 3 df, p=0.5 -- Proportional Hazards Assumption Test -- chisq df p group 0.6060 1 0.436 covariate1 3.3920 1 0.066 covariate2 0.0121 1 0.912 GLOBAL 5.5837 3 0.134 -- Analysis Parameters --------------------------------------------------------- * Search Method: Systematic * Predictor: predictor * Number of cuts: 1 * Minimum group size (nmin): 9 * Covariates: covariate1, covariate2 i Generating Forest Plot of Hazard Ratios... ! Invalid/missing reference group. Defaulting to: G1 num_cuts AIC Delta_AIC AIC_Weight Evidence cuts 0 228.52 1.1 36.6% Substantial NA 1 227.42 0.0 63.4% Substantial 59.77 -- Optimal Cut-point Number Analysis (Systematic) ------------------------------ -- Optimal Cut-point Number Analysis ------------------------------------------- Method: systematic Criterion: AIC num_cuts AIC Delta_AIC AIC_Weight Evidence cuts 0 228.52 1.1 36.6% Substantial NA 1 227.42 0.0 63.4% Substantial 59.77 v Conclusion: 1 cut-point(s) is best based on AIC. Optimal cuts at: 59.77 Hint: Use `summary()` for details, `plot()` to visualise. -- Details for Best Model ------------------------------------------------------ The best model found has 1 cut-point(s). Cut-point values: 59.77. -- Group Counts -- Group N Events 1 G1 45 30 2 G2 15 6 -- Median Survival by Group -- Call: survfit(formula = survival::Surv(time, event) ~ group, data = data) n events median 0.95LCL 0.95UCL group=G1 45 30 23.8 8.77 30.5 group=G2 15 6 33.0 15.57 NA -- Final Cox Proportional-Hazards Model -- Call: survival::coxph(formula = as.formula(formula_str), data = model_data) n= 60, number of events= 36 coef exp(coef) se(coef) z Pr(>|z|) groupG2 -0.6663 0.5136 0.4497 -1.482 0.138 exp(coef) exp(-coef) lower .95 upper .95 groupG2 0.5136 1.947 0.2127 1.24 Concordance= 0.574 (se = 0.035 ) Likelihood ratio test= 2.52 on 1 df, p=0.1 Wald test = 2.19 on 1 df, p=0.1 Score (logrank) test = 2.28 on 1 df, p=0.1 -- Analysis Parameters --------------------------------------------------------- * Search Method: Systematic * Predictor: predictor * Criterion: AIC * Maximum Cuts: 1 * Minimum Group Size (nmin): 10 num_cuts AICc Delta_AICc AICc_Weight Evidence cuts 0 228.59 1.1 36.6% Substantial NA 1 227.49 0.0 63.4% Substantial 59.77 -- Optimal Cut-point Number Analysis (Systematic) ------------------------------ -- Optimal Cut-point Number Analysis ------------------------------------------- Method: systematic Criterion: AICc num_cuts AICc Delta_AICc AICc_Weight Evidence cuts 0 228.59 1.1 36.6% Substantial NA 1 227.49 0.0 63.4% Substantial 59.77 v Conclusion: 1 cut-point(s) is best based on AICc. Optimal cuts at: 59.77 Hint: Use `summary()` for details, `plot()` to visualise. -- Details for Best Model ------------------------------------------------------ The best model found has 1 cut-point(s). Cut-point values: 59.77. -- Group Counts -- Group N Events 1 G1 45 30 2 G2 15 6 -- Median Survival by Group -- Call: survfit(formula = survival::Surv(time, event) ~ group, data = data) n events median 0.95LCL 0.95UCL group=G1 45 30 23.8 8.77 30.5 group=G2 15 6 33.0 15.57 NA -- Final Cox Proportional-Hazards Model -- Call: survival::coxph(formula = as.formula(formula_str), data = model_data) n= 60, number of events= 36 coef exp(coef) se(coef) z Pr(>|z|) groupG2 -0.6663 0.5136 0.4497 -1.482 0.138 exp(coef) exp(-coef) lower .95 upper .95 groupG2 0.5136 1.947 0.2127 1.24 Concordance= 0.574 (se = 0.035 ) Likelihood ratio test= 2.52 on 1 df, p=0.1 Wald test = 2.19 on 1 df, p=0.1 Score (logrank) test = 2.28 on 1 df, p=0.1 -- Analysis Parameters --------------------------------------------------------- * Search Method: Systematic * Predictor: predictor * Criterion: AICc * Maximum Cuts: 1 * Minimum Group Size (nmin): 10 num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 230.61 1.1 36.6% Substantial NA 1 229.51 0.0 63.4% Substantial 59.77 -- Optimal Cut-point Number Analysis (Systematic) ------------------------------ -- Optimal Cut-point Number Analysis ------------------------------------------- Method: systematic Criterion: BIC num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 230.61 1.1 36.6% Substantial NA 1 229.51 0.0 63.4% Substantial 59.77 v Conclusion: 1 cut-point(s) is best based on BIC. Optimal cuts at: 59.77 Hint: Use `summary()` for details, `plot()` to visualise. -- Details for Best Model ------------------------------------------------------ The best model found has 1 cut-point(s). Cut-point values: 59.77. -- Group Counts -- Group N Events 1 G1 45 30 2 G2 15 6 -- Median Survival by Group -- Call: survfit(formula = survival::Surv(time, event) ~ group, data = data) n events median 0.95LCL 0.95UCL group=G1 45 30 23.8 8.77 30.5 group=G2 15 6 33.0 15.57 NA -- Final Cox Proportional-Hazards Model -- Call: survival::coxph(formula = as.formula(formula_str), data = model_data) n= 60, number of events= 36 coef exp(coef) se(coef) z Pr(>|z|) groupG2 -0.6663 0.5136 0.4497 -1.482 0.138 exp(coef) exp(-coef) lower .95 upper .95 groupG2 0.5136 1.947 0.2127 1.24 Concordance= 0.574 (se = 0.035 ) Likelihood ratio test= 2.52 on 1 df, p=0.1 Wald test = 2.19 on 1 df, p=0.1 Score (logrank) test = 2.28 on 1 df, p=0.1 -- Analysis Parameters --------------------------------------------------------- * Search Method: Systematic * Predictor: predictor * Criterion: BIC * Maximum Cuts: 1 * Minimum Group Size (nmin): 10 num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 102.25 0.85 39.6% Substantial NA 1 101.40 0.00 60.4% Substantial 43.11 num_cuts BIC Delta_BIC BIC_Weight Evidence cuts 0 102.25 0.85 39.6% Substantial NA 1 101.40 0.00 60.4% Substantial 43.11 No valid results found with given parameters. i nmin 0.1 is a proportion. Min. group size set to 6. i Finding optimal cut number: method = systematic i Testing for 1 cut-point(s)... No valid cut-points found for 1 cut(s) due to model failures or constraints. -- Optimal Cut-point Number Analysis ------------------------------------------- Method: systematic Criterion: BIC No optimal model could be determined. i nmin 0.1 is a proportion. Min. group size set to 6. i Finding optimal cut number: method = genetic i Running genetic algorithm for 1 cut-point(s)... No valid cut-points found for 1 cut(s) due to genetic algorithm failure or constraints. -- Optimal Cut-point Number Analysis ------------------------------------------- Method: genetic Criterion: BIC No optimal model could be determined. i nmin 0.1 is a proportion. Min. group size set to 6. i Finding optimal cut number: method = systematic [ FAIL 0 | WARN 0 | SKIP 5 | PASS 219 ] ══ Skipped tests (5) ═══════════════════════════════════════════════════════════ • On CRAN (4): 'test-core-functions.R:1579:1', 'test-core-functions.R:1595:1', 'test-core-functions.R:1611:1', 'test-core-functions.R:1627:1' • Systematic p-value search failed. (1): 'test-core-functions.R:1273:3' [ FAIL 0 | WARN 0 | SKIP 5 | PASS 219 ] > > proc.time() user system elapsed 87.82 1.51 92.12