From 12591c0989b3a5df6e9eb8cc49826e3b4d99edff Mon Sep 17 00:00:00 2001 From: Quentin Marcou <18257721+qmarcou@users.noreply.github.com> Date: Sat, 1 Jun 2024 19:20:00 +0200 Subject: [PATCH] refactor main runner function's name --- NAMESPACE | 2 +- R/{renewnetTPreg.R => fit_netTPreg.R} | 2 +- README.Rmd | 2 +- README.md | 2 +- tests/testthat/test-netidmtpreg_fit.R | 12 ++++++------ tests/testthat/test-plot.TPreg.R | 4 ++-- tests/testthat/test-print.TPreg.R | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) rename R/{renewnetTPreg.R => fit_netTPreg.R} (99%) diff --git a/NAMESPACE b/NAMESPACE index 5be1b2f..0ffac7d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -5,13 +5,13 @@ S3method(print,TPreg) S3method(summary,TPreg) export(.filter_times) export(compute_survprob_pch) +export(fit_netTPreg) export(generate_exponential_time_to_event) export(generate_poisson_time_to_event) export(generate_uncensored_ind_exp_idm_data) export(iddata) export(invalid_argument) export(multi_assert) -export(renewnetTPreg) importFrom(data.table,":=") importFrom(data.table,.BY) importFrom(data.table,.EACHI) diff --git a/R/renewnetTPreg.R b/R/fit_netTPreg.R similarity index 99% rename from R/renewnetTPreg.R rename to R/fit_netTPreg.R index 4daacc0..a11cc1b 100644 --- a/R/renewnetTPreg.R +++ b/R/fit_netTPreg.R @@ -215,7 +215,7 @@ mod.glm.fit.callingwrapper <- #' doi:10.1177/09622802211003608 #' @examples #' # ADD_EXAMPLES_HERE -renewnetTPreg <- function(s = 0, +fit_netTPreg <- function(s = 0, t = NULL, trans, formula, diff --git a/README.Rmd b/README.Rmd index 06135e3..d56810a 100644 --- a/README.Rmd +++ b/README.Rmd @@ -98,7 +98,7 @@ Now let's carry the of net survival estimation: # Estimation can be sped up and carried in parrallel using futures: future::plan("multisession") # will work on any OS # future::plan("multicore") # more efficient but only works on UNIX systems -net_estimate <- renewnetTPreg( +net_estimate <- fit_netTPreg( formula = ~1, # intercept only model, similar to Pohar-Perme estimation data = crude_synth_idm_data, # Use a standard ratetable diff --git a/README.md b/README.md index f587d81..67a2aea 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ Now let’s carry the of net survival estimation: # Estimation can be sped up and carried in parrallel using futures: future::plan("multisession") # will work on any OS # future::plan("multicore") # more efficient but only works on UNIX systems -net_estimate <- renewnetTPreg( +net_estimate <- fit_netTPreg( formula = ~1, # intercept only model, similar to Pohar-Perme estimation data = crude_synth_idm_data, # Use a standard ratetable diff --git a/tests/testthat/test-netidmtpreg_fit.R b/tests/testthat/test-netidmtpreg_fit.R index a78267f..f8e9c02 100644 --- a/tests/testthat/test-netidmtpreg_fit.R +++ b/tests/testthat/test-netidmtpreg_fit.R @@ -60,7 +60,7 @@ testthat::test_that("IDM crude survival model estimates", { estimates <- list() for (transition in c("11", "12", "22", "13", "23")) { estimates[transition] <- - renewnetTPreg(~1, synth_idm_data, + fit_netTPreg(~1, synth_idm_data, ratetable = NULL, rmap = NULL, time_dep_popvars = NULL, @@ -154,7 +154,7 @@ testthat::test_that("IDM Net survival model fitting runs inside futures", { for (session_type in c("sequential", "multisession")){ future::plan(session_type) for (transition in c("all", "11", "12", "22", "13", "23")) { - renewnetTPreg( + fit_netTPreg( formula = ~1, synth_idm_data, # Use a standard ratetable @@ -201,7 +201,7 @@ testthat::test_that("IDM Net survival fitting arguments handling", { # vector-like t with adjusted_t gives is estimated at expected times t <- c(1.3, 1.4, 1.5) - estim <- renewnetTPreg( + estim <- fit_netTPreg( s = .5, t = t, trans = "11", @@ -213,7 +213,7 @@ testthat::test_that("IDM Net survival fitting arguments handling", { ) testthat::expect_equal(object = estim$co$time, expected = t) testthat::expect_error( # large t in unadjusted vector of times - estim <- renewnetTPreg( + estim <- fit_netTPreg( s = .5, t = c(t, 1e5), trans = "11", @@ -275,7 +275,7 @@ population mortality are equal", ) for (transition in c("11", "12", "22", "13", "23")) { - net_truth <- renewnetTPreg( + net_truth <- fit_netTPreg( formula = ~1, synth_idm_data, # Use a standard ratetable @@ -294,7 +294,7 @@ population mortality are equal", R = 1 # Number of bootstraps ) - net_estimated <- renewnetTPreg( + net_estimated <- fit_netTPreg( formula = ~1, crude_synth_idm_data, # Use a standard ratetable diff --git a/tests/testthat/test-plot.TPreg.R b/tests/testthat/test-plot.TPreg.R index e14439f..b9d4208 100644 --- a/tests/testthat/test-plot.TPreg.R +++ b/tests/testthat/test-plot.TPreg.R @@ -21,7 +21,7 @@ test_that("Plotting TPreg objects does not throw any error", { # for (transition in c("11", "all")) { for (transition in c("11")) { estimate <- - renewnetTPreg(~1, synth_idm_data, + fit_netTPreg(~1, synth_idm_data, ratetable = NULL, rmap = NULL, time_dep_popvars = NULL, @@ -38,7 +38,7 @@ test_that("Plotting TPreg objects does not throw any error", { # Check with more than just an intercept estimate <- - renewnetTPreg(~sex, synth_idm_data, + fit_netTPreg(~sex, synth_idm_data, ratetable = NULL, rmap = NULL, time_dep_popvars = NULL, diff --git a/tests/testthat/test-print.TPreg.R b/tests/testthat/test-print.TPreg.R index ae312fd..5e245ca 100644 --- a/tests/testthat/test-print.TPreg.R +++ b/tests/testthat/test-print.TPreg.R @@ -20,7 +20,7 @@ test_that("Printing TPreg objects does not throw any error", { ) for (transition in c("11", "all")) { estimate <- - renewnetTPreg(~1, synth_idm_data, + fit_netTPreg(~1, synth_idm_data, ratetable = NULL, rmap = NULL, time_dep_popvars = NULL, @@ -37,7 +37,7 @@ test_that("Printing TPreg objects does not throw any error", { # Check with more than just an intercept estimate <- - renewnetTPreg(~sex, synth_idm_data, + fit_netTPreg(~sex, synth_idm_data, ratetable = NULL, rmap = NULL, time_dep_popvars = NULL,