Skip to content

Commit c98d57c

Browse files
committed
update
1 parent 67b5828 commit c98d57c

File tree

2 files changed

+81
-28
lines changed

2 files changed

+81
-28
lines changed

tests/testthat/_snaps/table_ratet01.md

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,46 @@
33
Code
44
res
55
Output
6-
B: Placebo A: Drug X C: Combination
7-
(N=134) (N=134) (N=132)
8-
———————————————————————————————————————————————————————————————————————————————————————————————————
9-
Number of exacerbations per patient
10-
0 10 (7.46%) 6 (4.48%) 11 (8.33%)
11-
1 25 (18.66%) 21 (15.67%) 14 (10.61%)
12-
2 38 (28.36%) 41 (30.60%) 33 (25.00%)
13-
3 22 (16.42%) 26 (19.40%) 21 (15.91%)
14-
4 13 (9.70%) 18 (13.43%) 30 (22.73%)
15-
5 11 (8.21%) 10 (7.46%) 12 (9.09%)
16-
6 10 (7.46%) 7 (5.22%) 7 (5.30%)
17-
7 3 (2.24%) 4 (2.99%) 3 (2.27%)
18-
8 1 (0.75%) 1 (0.75%) 1 (0.76%)
19-
9 1 (0.75%) 0 (0.00%) 0 (0.00%)
20-
Unadjusted exacerbation rate (per year)
21-
Rate 7.2364 8.2148 9.8131
22-
Adjusted (QP) exacerbation rate (per year)
23-
Rate 2.4550 2.8514 3.4304
24-
Rate CI (1.6194, 3.7219) (1.8974, 4.2850) (2.2946, 5.1284)
25-
Rate Ratio 1.1615 1.3973
26-
Rate Ratio CI (0.6462, 2.0877) (0.7789, 2.5067)
27-
p-value 0.6169 0.2619
28-
Adjusted (NB) exacerbation rate (per year)
29-
Rate 2.7374 2.8150 2.9789
30-
Rate CI (2.3932, 3.1311) (2.4681, 3.2106) (2.6152, 3.3932)
31-
Rate Ratio 1.0283 1.0882
32-
Rate Ratio CI (0.8856, 1.1941) (0.9381, 1.2624)
33-
p-value 0.7140 0.2643
6+
B: Placebo A: Drug X C: Combination
7+
(N=134) (N=134) (N=132)
8+
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
9+
Number of exacerbations per patient
10+
0 10 (7.46%) 6 (4.48%) 11 (8.33%)
11+
1 25 (18.66%) 21 (15.67%) 14 (10.61%)
12+
2 38 (28.36%) 41 (30.60%) 33 (25.00%)
13+
3 22 (16.42%) 26 (19.40%) 21 (15.91%)
14+
4 13 (9.70%) 18 (13.43%) 30 (22.73%)
15+
5 11 (8.21%) 10 (7.46%) 12 (9.09%)
16+
6 10 (7.46%) 7 (5.22%) 7 (5.30%)
17+
7 3 (2.24%) 4 (2.99%) 3 (2.27%)
18+
8 1 (0.75%) 1 (0.75%) 1 (0.76%)
19+
9 1 (0.75%) 0 (0.00%) 0 (0.00%)
20+
Unadjusted exacerbation rate (per year) with offset
21+
Rate 7.2364 8.2148 9.8131
22+
Unadjusted exacerbation rate (per year)
23+
Rate 2.7761 2.8433 2.9848
24+
Adjusted (QP) exacerbation rate (per year) with offset
25+
Rate 2.4550 2.8514 3.4304
26+
Rate CI (1.6194, 3.7219) (1.8974, 4.2850) (2.2946, 5.1284)
27+
Rate Ratio 1.1615 1.3973
28+
Rate Ratio CI (0.6462, 2.0877) (0.7789, 2.5067)
29+
p-value 0.6169 0.2619
30+
Adjusted (QP) exacerbation rate (per year)
31+
Rate 2.7380 2.8161 2.9771
32+
Rate CI (2.3920, 3.1339) (2.4676, 3.2137) (2.6125, 3.3926)
33+
Rate Ratio 1.0285 1.0873
34+
Rate Ratio CI (0.8849, 1.1954) (0.9366, 1.2624)
35+
p-value 0.7140 0.2714
36+
Adjusted (NB) exacerbation rate (per year) with offset
37+
Rate 18.4450 28.0582 23.9304
38+
Rate CI (13.9015, 24.4736) (21.3288, 36.9108) (18.1382, 31.5722)
39+
Rate Ratio 1.5212 1.2974
40+
Rate Ratio CI (1.1166, 2.0724) (0.9505, 1.7708)
41+
p-value 0.0078 0.1009
42+
Adjusted (NB) exacerbation rate (per year)
43+
Rate 2.7374 2.8150 2.9789
44+
Rate CI (2.3932, 3.1311) (2.4681, 3.2106) (2.6152, 3.3932)
45+
Rate Ratio 1.0283 1.0882
46+
Rate Ratio CI (0.8856, 1.1941) (0.9381, 1.2624)
47+
p-value 0.7140 0.2643
3448

tests/testthat/test-table_ratet01.R

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ testthat::test_that("RATET01 is produced correctly", {
2323
conf_level = 0.95,
2424
distribution = "poisson",
2525
rate_mean_method = "emmeans",
26+
var_labels = "Unadjusted exacerbation rate (per year) with offset",
27+
table_names = "unadj-offest",
28+
.stats = c("rate"),
29+
.labels = c(rate = "Rate")
30+
) %>%
31+
summarize_glm_count(
32+
vars = "AVAL",
33+
variables = list(arm = "ARM", covariates = NULL),
34+
conf_level = 0.95,
35+
distribution = "poisson",
36+
rate_mean_method = "emmeans",
2637
var_labels = "Unadjusted exacerbation rate (per year)",
2738
table_names = "unadj",
2839
.stats = c("rate"),
@@ -34,6 +45,20 @@ testthat::test_that("RATET01 is produced correctly", {
3445
conf_level = 0.95,
3546
distribution = "quasipoisson",
3647
rate_mean_method = "ppmeans",
48+
var_labels = "Adjusted (QP) exacerbation rate (per year) with offset",
49+
table_names = "adj-qp-offest",
50+
.stats = c("rate", "rate_ci", "rate_ratio", "rate_ratio_ci", "pval"),
51+
.labels = c(
52+
rate = "Rate", rate_ci = "Rate CI", rate_ratio = "Rate Ratio",
53+
rate_ratio_ci = "Rate Ratio CI", pval = "p-value"
54+
)
55+
) %>%
56+
summarize_glm_count(
57+
vars = "AVAL",
58+
variables = list(arm = "ARM", covariates = c("REGION1")),
59+
conf_level = 0.95,
60+
distribution = "quasipoisson",
61+
rate_mean_method = "emmeans",
3762
var_labels = "Adjusted (QP) exacerbation rate (per year)",
3863
table_names = "adj-qp",
3964
.stats = c("rate", "rate_ci", "rate_ratio", "rate_ratio_ci", "pval"),
@@ -48,6 +73,20 @@ testthat::test_that("RATET01 is produced correctly", {
4873
conf_level = 0.95,
4974
distribution = "negbin",
5075
rate_mean_method = "emmeans",
76+
var_labels = "Adjusted (NB) exacerbation rate (per year) with offset",
77+
table_names = "adj-nb-offest",
78+
.stats = c("rate", "rate_ci", "rate_ratio", "rate_ratio_ci", "pval"),
79+
.labels = c(
80+
rate = "Rate", rate_ci = "Rate CI", rate_ratio = "Rate Ratio",
81+
rate_ratio_ci = "Rate Ratio CI", pval = "p-value"
82+
)
83+
) %>%
84+
summarize_glm_count(
85+
vars = "AVAL",
86+
variables = list(arm = "ARM", covariates = c("REGION1")),
87+
conf_level = 0.95,
88+
distribution = "negbin",
89+
rate_mean_method = "emmeans",
5190
var_labels = "Adjusted (NB) exacerbation rate (per year)",
5291
table_names = "adj-nb",
5392
.stats = c("rate", "rate_ci", "rate_ratio", "rate_ratio_ci", "pval"),

0 commit comments

Comments
 (0)