From 348ae5ed70f404b3287fa9b74ff4c59399ded482 Mon Sep 17 00:00:00 2001 From: Benedikt Sommer Date: Thu, 12 Feb 2026 10:21:04 +0100 Subject: [PATCH 1/3] wip --- inst/tinytest/test_outcome_models.R | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/inst/tinytest/test_outcome_models.R b/inst/tinytest/test_outcome_models.R index 850e3c9..c69d381 100644 --- a/inst/tinytest/test_outcome_models.R +++ b/inst/tinytest/test_outcome_models.R @@ -116,7 +116,7 @@ test_outcome_continuous() test_outcome_phreg <- function() { phreg <- mets::phreg - phreg.par <- mets::phreg.par + phreg_weibull <- mets::phreg_weibull Surv <- survival::Surv #nolint par1 <- list(scale = 1 / 100, shape = 2) @@ -183,11 +183,14 @@ test_outcome_phreg <- function() { xx0 <- covar(1e4) dd <- outcome(xx0) |> cbind(xx0) - cox1 <- phreg.par(Surv(time, status) ~ a + x, data = dd) - expect_equivalent(coef(cox1), c(log(unlist(par1)), 0, 0), - tolerance = 0.2) + cox1 <- phreg_weibull(Surv(time, status) ~ a + x, data = dd) + expect_equivalent( + coef(cox1), + c(log(par1$scale), 0, 0, log(par1$shape)), + tolerance = 0.2 + ) - cox0 <- phreg.par(Surv(time, status) ~ a + x, data = dd) + cox0 <- phreg_weibull(Surv(time, status) ~ a + x, data = dd) expect_equivalent(coef(cox0), c(log(unlist(par0)), 0, 0), tolerance = 0.2) @@ -200,11 +203,11 @@ test_outcome_phreg <- function() { ) dd <- outcome(xx0) |> cbind(xx0) - cox1 <- phreg.par(Surv(time, status) ~ a + x, data = dd) + cox1 <- phreg_weibull(Surv(time, status) ~ a + x, data = dd) expect_equivalent(coef(cox1), c(log(unlist(par1)), coef(fit1)), tolerance = 0.2) - cox0 <- phreg.par(Surv(time, status) ~ a + x, data = dd) + cox0 <- phreg_weibull(Surv(time, status) ~ a + x, data = dd) expect_equivalent(coef(cox0), c(log(unlist(par0)), coef(fit1)), tolerance = 0.2) From 269f2bf0b09fd8c0a9cd5f24637c2c587a9eaa11 Mon Sep 17 00:00:00 2001 From: Benedikt Sommer Date: Mon, 16 Feb 2026 09:44:15 +0100 Subject: [PATCH 2/3] fix --- inst/tinytest/test_outcome_models.R | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/inst/tinytest/test_outcome_models.R b/inst/tinytest/test_outcome_models.R index c69d381..dc1d848 100644 --- a/inst/tinytest/test_outcome_models.R +++ b/inst/tinytest/test_outcome_models.R @@ -184,15 +184,19 @@ test_outcome_phreg <- function() { dd <- outcome(xx0) |> cbind(xx0) cox1 <- phreg_weibull(Surv(time, status) ~ a + x, data = dd) + # par1$scale ** par1$shape because of transformation in coxWeibull.lvm expect_equivalent( coef(cox1), - c(log(par1$scale), 0, 0, log(par1$shape)), + c(log(par1$scale ** par1$shape), 0, 0, log(par1$shape)), tolerance = 0.2 ) cox0 <- phreg_weibull(Surv(time, status) ~ a + x, data = dd) - expect_equivalent(coef(cox0), c(log(unlist(par0)), 0, 0), - tolerance = 0.2) + expect_equivalent( + coef(cox0), + c(log(par1$scale ** par1$shape), 0, 0, log(par1$shape)), + tolerance = 0.2 + ) ## Specify parameters outcome <- setargs(outcome_phreg, @@ -204,13 +208,18 @@ test_outcome_phreg <- function() { dd <- outcome(xx0) |> cbind(xx0) cox1 <- phreg_weibull(Surv(time, status) ~ a + x, data = dd) - expect_equivalent(coef(cox1), c(log(unlist(par1)), coef(fit1)), - tolerance = 0.2) + expect_equivalent( + coef(cox1), + c(log(par1$scale ** par1$shape), coef(fit1), log(par1$shape)), + tolerance = 0.2 + ) cox0 <- phreg_weibull(Surv(time, status) ~ a + x, data = dd) - expect_equivalent(coef(cox0), c(log(unlist(par0)), coef(fit1)), - tolerance = 0.2) - + expect_equivalent( + coef(cox0), + c(log(par0$scale ** par1$shape), coef(fit1), log(par0$shape)), + tolerance = 0.2 + ) # Specify design via `lp` argument outcome <- setallargs( From 21e3e31ae9e87381262965133971e7f45a74f5d3 Mon Sep 17 00:00:00 2001 From: Benedikt Sommer Date: Mon, 16 Feb 2026 12:17:09 +0100 Subject: [PATCH 3/3] trigger workflows