Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsjoberg committed May 24, 2024
1 parent a64f53a commit 9afaea8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/ard_survival_survfit_diff.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ ard_survival_survfit_diff <- function(x, times, conf.level = 0.95) {
dplyr::mutate(
# reference level
reference_level = ard_survival_survfit[["group1_level"]][1],
# short description of method
method = "Survival Difference (Z-test)",
# survival difference
estimate = .data$stat0_estimate - .data$stat1_estimate,
# survival difference standard error
Expand All @@ -85,7 +87,7 @@ ard_survival_survfit_diff <- function(x, times, conf.level = 0.95) {
conf.high = .data$estimate + .data$std.error * stats::qnorm(1 - (1 - .env$conf.level) / 2),
# p-value for test where H0: no difference
p.value = 2 * (1 - stats::pnorm(abs(.data$statistic))),
across(c("reference_level", "estimate", "std.error", "statistic", "conf.low", "conf.high", "p.value"), as.list)
across(c("reference_level", "estimate", "std.error", "statistic", "conf.low", "conf.high", "p.value", "method"), as.list)
) |>
# reshape into the cards structure
dplyr::select(-starts_with("stat0_"), -starts_with("stat1_")) |>
Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test-ard_survival_survfit_diff.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ test_that("ard_survival_survfit_diff() works", {
getElement("surv") |>
reduce(`-`)
)

# check the structure of the ARD object
expect_silent(
cards::check_ard_structure(ard1)
)
})

test_that("ard_survival_survfit_diff() messaging", {
Expand Down

0 comments on commit 9afaea8

Please sign in to comment.