Skip to content

Commit

Permalink
update and add test for ratet01 (#102)
Browse files Browse the repository at this point in the history
Close #101 following the changes in `tern` and `tlg-catalog`.
  • Loading branch information
duanx9 authored Jan 18, 2024
1 parent c4c9bd5 commit 767e4c5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tests/testthat/_snaps/table_ratet01.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@
Rate Ratio 1.1615 1.3973
Rate Ratio CI (0.6462, 2.0877) (0.7789, 2.5067)
p value 0.6169 0.2619
Adjusted (NB) exacerbation rate (per year)
Rate 2.7374 2.8150 2.9789
Rate CI (2.3932, 3.1311) (2.4681, 3.2106) (2.6152, 3.3932)
Rate Ratio 1.0283 1.0882
Rate Ratio CI (0.8856, 1.1941) (0.9381, 1.2624)
p value 0.7140 0.2643

16 changes: 15 additions & 1 deletion tests/testthat/test-table_ratet01.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,21 @@ testthat::test_that("RATET01 is produced correctly", {
distribution = "quasipoisson",
rate_mean_method = "ppmeans",
var_labels = "Adjusted (QP) exacerbation rate (per year)",
table_names = "adj",
table_names = "adj-qp",
.stats = c("rate", "rate_ci", "rate_ratio", "rate_ratio_ci", "pval"),
.labels = c(
rate = "Rate", rate_ci = "Rate CI", rate_ratio = "Rate Ratio",
rate_ratio_ci = "Rate Ratio CI", pval = "p value"
)
) %>%
summarize_glm_count(
vars = "AVAL",
variables = list(arm = "ARM", offset = "lgTMATRSK", covariates = c("REGION1")),
conf_level = 0.95,
distribution = "negbin",
rate_mean_method = "emmeans",
var_labels = "Adjusted (NB) exacerbation rate (per year)",
table_names = "adj-nb",
.stats = c("rate", "rate_ci", "rate_ratio", "rate_ratio_ci", "pval"),
.labels = c(
rate = "Rate", rate_ci = "Rate CI", rate_ratio = "Rate Ratio",
Expand Down

0 comments on commit 767e4c5

Please sign in to comment.