From 527245372be8e1331b14f3bceeff1c3a1a117227 Mon Sep 17 00:00:00 2001 From: "Konrad H. Stopsack" <35557324+stopsack@users.noreply.github.com> Date: Wed, 7 Jan 2026 22:34:55 +0100 Subject: [PATCH 1/3] pass on confidence level argument --- R/survdiff_ci.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/survdiff_ci.R b/R/survdiff_ci.R index 1dd7bad..f917296 100644 --- a/R/survdiff_ci.R +++ b/R/survdiff_ci.R @@ -121,7 +121,8 @@ survdiff_ci <- function( formula = formula, data = data, id = .id, - weights = .weights + weights = .weights, + conf.int = conf.level ), time = time, extend = TRUE From 2afefeeb8682ea1e1082f803f7836b33b60d1f13 Mon Sep 17 00:00:00 2001 From: "Konrad H. Stopsack" <35557324+stopsack@users.noreply.github.com> Date: Wed, 7 Jan 2026 22:35:29 +0100 Subject: [PATCH 2/3] add unit test for survdiff_ci confidence level --- tests/testthat/test-time2.R | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/testthat/test-time2.R b/tests/testthat/test-time2.R index a858b6c..1a8acc9 100644 --- a/tests/testthat/test-time2.R +++ b/tests/testthat/test-time2.R @@ -201,6 +201,50 @@ testthat::test_that( ) +testthat::test_that( + desc = "cum inc difference does not ignore confidence level", + code = { + result <- survdiff_ci( + formula = survival::Surv( + time = time, + event = status + ) ~ + sex, + data = cancer, + time = 365.25 + ) + + result09 <- survdiff_ci( + formula = survival::Surv( + time = time, + event = status + ) ~ + sex, + data = cancer, + time = 365.25, + conf.level = 0.9 + ) + + expect_gt( + object = result09$conf.low, + expected = result$conf.low + ) + expect_lt( + object = result09$conf.high, + expected = result$conf.high + ) + expect_equal( + object = result09$estimate, + expected = result$estimate + ) + expect_equal( + object = result09$std.error, + expected = result$std.error, + tolerance = 0.005 + ) + } +) + testthat::test_that( desc = "Invalid ID variable is found", code = { From 5bca534ddd75db3b997efc5b188bf5f55161dbf6 Mon Sep 17 00:00:00 2001 From: "Konrad H. Stopsack" <35557324+stopsack@users.noreply.github.com> Date: Wed, 7 Jan 2026 22:44:03 +0100 Subject: [PATCH 3/3] increase tolerance std.error necessarily differs slightly with MOVER --- tests/testthat/test-time2.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-time2.R b/tests/testthat/test-time2.R index 1a8acc9..304e98a 100644 --- a/tests/testthat/test-time2.R +++ b/tests/testthat/test-time2.R @@ -240,7 +240,7 @@ testthat::test_that( expect_equal( object = result09$std.error, expected = result$std.error, - tolerance = 0.005 + tolerance = 0.01 ) } )