diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml
index b2062d75..f26ba860 100644
--- a/.github/workflows/check.yaml
+++ b/.github/workflows/check.yaml
@@ -26,6 +26,8 @@ jobs:
REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
additional-r-cmd-check-params: --as-cran
+ additional-env-vars: |
+ NOT_CRAN=true
coverage:
name: Coverage 📔
uses: insightsengineering/r.pkg.template/.github/workflows/test-coverage.yaml@main
diff --git a/R/matching.R b/R/matching.R
index 81282b72..932f17a3 100644
--- a/R/matching.R
+++ b/R/matching.R
@@ -354,9 +354,10 @@ plot_weights_ggplot <- function(weighted_data, bin_col, vline_col,
})
legend_data <- data.frame(ind = main_title, lab = lab)
+ values <- median <- NULL # dummy assignment for undefined variable check
hist_plot <- ggplot2::ggplot(wt_data) +
- ggplot2::geom_histogram(ggplot2::aes_string(x = "values"), bins = bins, color = bin_col, fill = bin_col) +
- ggplot2::geom_vline(ggplot2::aes_string(xintercept = "median"),
+ ggplot2::geom_histogram(ggplot2::aes(x = values), bins = bins, color = bin_col, fill = bin_col) +
+ ggplot2::geom_vline(ggplot2::aes(xintercept = median),
color = vline_col,
linetype = "dashed"
) +
@@ -364,7 +365,7 @@ plot_weights_ggplot <- function(weighted_data, bin_col, vline_col,
ggplot2::facet_wrap(~ind, ncol = 1) +
ggplot2::geom_text(
data = legend_data,
- ggplot2::aes_string(label = "lab"), x = Inf, y = Inf, hjust = 1, vjust = 1, size = 3
+ ggplot2::aes(label = lab), x = Inf, y = Inf, hjust = 1, vjust = 1, size = 3
) +
ggplot2::theme(
axis.title = ggplot2::element_text(size = 12),
diff --git a/tests/testthat/_snaps/maic_anchored.md b/tests/testthat/_snaps/maic_anchored.md
index 009fed7f..a33106c6 100644
--- a/tests/testthat/_snaps/maic_anchored.md
+++ b/tests/testthat/_snaps/maic_anchored.md
@@ -13,7 +13,7 @@
events% rmean se(rmean) median 0.95LCL 0.95UCL
1 100.00000 2.564797 0.11366994 1.836467 1.644765 2.045808
2 38.00000 8.709690 0.35514766 7.587627 6.278691 10.288538
- 3 100.00000 2.679473 0.20670827 1.815795 1.457222 2.292484
+ 3 100.00000 2.363509 0.18354814 1.641770 1.052627 2.093468
4 31.95014 10.584609 0.57397937 12.166430 10.244293 NA
5 100.00000 2.455272 0.09848888 1.851987 1.670540 2.009650
6 59.33333 4.303551 0.33672602 2.746131 2.261125 3.320857
@@ -21,14 +21,14 @@
---
Code
- testout$inferential$summary
+ print(testout$inferential$summary, digits = 5)
Output
- case HR LCL UCL pval
- 1 AC 0.2216588 0.1867151 0.2631423 2.136650e-66
- 2 adjusted_AC 0.1631852 0.1113815 0.2390829 1.361531e-20
- 3 BC 0.5718004 0.4811989 0.6794607 2.143660e-10
- 4 AB 0.3876507 0.3039348 0.4944253 2.270430e-14
- 5 adjusted_AB 0.2853885 0.1876867 0.4339497 4.509575e-09
+ case HR LCL UCL pval
+ 1 AC 0.22166 0.18672 0.26314 2.1366e-66
+ 2 adjusted_AC 0.13675 0.09450 0.19789 4.9838e-26
+ 3 BC 0.57180 0.48120 0.67946 2.1437e-10
+ 4 AB 0.38765 0.30393 0.49443 2.2704e-14
+ 5 adjusted_AB 0.23916 0.15906 0.35959 6.1920e-12
---
@@ -47,8 +47,8 @@
conf.type = km_conf_type)
records n events median 0.95LCL 0.95UCL
- ARM=C 500 173 173.3 55.3 44.4 69.8
- ARM=A 500 173 55.4 370.3 311.8 NA
+ ARM=C 500 173 173.3 50 32 63.7
+ ARM=A 500 173 55.4 370 312 NA
$km_agd
Call: survfit(formula = Surv(TIME, EVENT) ~ ARM, data = pseudo_ipd,
@@ -74,9 +74,9 @@
robust = TRUE)
coef exp(coef) se(coef) robust se z p
- ARMA -1.8129 0.1632 0.1602 0.1949 -9.303 <2e-16
+ ARMA -1.9896 0.1368 0.1691 0.1886 -10.55 <2e-16
- Likelihood ratio test=155.2 on 1 df, p=< 2.2e-16
+ Likelihood ratio test=175.6 on 1 df, p=< 2.2e-16
n= 1000, number of events= 690
$model_agd
@@ -91,19 +91,19 @@
$res_AC
$res_AC$est
- [1] 0.1631852
+ [1] 0.1367514
$res_AC$se
- [1] 0.194863
+ [1] 0.1885548
$res_AC$ci_l
- [1] 0.1113815
+ [1] 0.09450039
$res_AC$ci_u
- [1] 0.2390829
+ [1] 0.1978927
$res_AC$pval
- [1] 1.361531e-20
+ [1] 4.98377e-26
$res_AC_unadj
@@ -142,7 +142,7 @@
$res_AB
result pvalue
- "0.29[0.19; 0.43]" "<0.001"
+ "0.24[0.16; 0.36]" "<0.001"
$res_AB_unadj
result pvalue
@@ -164,71 +164,71 @@
---
Code
- testout2$descriptive$summary
+ print(testout2$descriptive$summary, digits = 5)
Output
- trt_ind treatment type records n.max n.start events
- 1 C C IPD, before matching 500 500.0000 500.0000 500.00000
- 2 A A IPD, before matching 500 500.0000 500.0000 190.00000
- 3 C C IPD, after matching 500 173.3137 173.3137 173.31374
- 4 A A IPD, after matching 500 173.3137 173.3137 55.37398
- 5 C C AgD, external 500 500.0000 500.0000 500.00000
- 6 B B AgD, external 300 300.0000 300.0000 178.00000
- events% rmean se(rmean) median 0.95LCL 0.95UCL
- 1 100.00000 2.564797 0.11366994 1.836467 1.644765 2.045808
- 2 38.00000 8.709690 0.35514766 7.587627 6.278691 10.288538
- 3 100.00000 2.679473 0.20670827 1.815795 1.457222 2.292484
- 4 31.95014 10.584609 0.57397937 12.166430 10.244293 NA
- 5 100.00000 2.455272 0.09848888 1.851987 1.670540 2.009650
- 6 59.33333 4.303551 0.33672602 2.746131 2.261125 3.320857
+ trt_ind treatment type records n.max n.start events events%
+ 1 C C IPD, before matching 500 500.00 500.00 500.000 100.000
+ 2 A A IPD, before matching 500 500.00 500.00 190.000 38.000
+ 3 C C IPD, after matching 500 173.31 173.31 173.314 100.000
+ 4 A A IPD, after matching 500 173.31 173.31 55.374 31.950
+ 5 C C AgD, external 500 500.00 500.00 500.000 100.000
+ 6 B B AgD, external 300 300.00 300.00 178.000 59.333
+ rmean se(rmean) median 0.95LCL 0.95UCL
+ 1 2.5648 0.113670 1.8365 1.6448 2.0458
+ 2 8.7097 0.355148 7.5876 6.2787 10.2885
+ 3 2.3635 0.183548 1.6418 1.0526 2.0935
+ 4 10.5846 0.573979 12.1664 10.2443 NA
+ 5 2.4553 0.098489 1.8520 1.6705 2.0096
+ 6 4.3036 0.336726 2.7461 2.2611 3.3209
---
Code
- testout2$inferential$summary
+ print(testout2$inferential$summary, digits = 5)
Output
- case HR LCL UCL pval
- 1 AC 0.2216588 0.1867151 0.2631423 2.136650e-66
- 2 adjusted_AC 0.1631852 0.1113815 0.2390829 1.361531e-20
- 3 BC 0.5718004 0.4811989 0.6794607 2.143660e-10
- 4 AB 0.3876507 0.3039348 0.4944253 2.270430e-14
- 5 adjusted_AB 0.2853885 0.1876867 0.4339497 4.509575e-09
+ case HR LCL UCL pval
+ 1 AC 0.22166 0.18672 0.26314 2.1366e-66
+ 2 adjusted_AC 0.13675 0.09450 0.19789 4.9838e-26
+ 3 BC 0.57180 0.48120 0.67946 2.1437e-10
+ 4 AB 0.38765 0.30393 0.49443 2.2704e-14
+ 5 adjusted_AB 0.23916 0.15906 0.35959 6.1920e-12
---
Code
- testout2$inferential$fit
+ print(testout2$inferential$fit, digits = 5)
Output
$km_before_ipd
Call: survfit(formula = Surv(TIME, EVENT) ~ ARM, data = ipd, conf.type = km_conf_type)
- n events median 0.95LCL 0.95UCL
- ARM=C 500 500 55.9 50.1 62.3
- ARM=A 500 190 230.9 191.1 313.2
+ n events median 0.95LCL 0.95UCL
+ ARM=C 500 500 55.897 50.063 62.269
+ ARM=A 500 190 230.948 191.108 313.157
$km_after_ipd
Call: survfit(formula = Surv(TIME, EVENT) ~ ARM, data = ipd, weights = ipd$weights,
conf.type = km_conf_type)
- records n events median 0.95LCL 0.95UCL
- ARM=C 500 173 173.3 55.3 44.4 69.8
- ARM=A 500 173 55.4 370.3 311.8 NA
+ records n events median 0.95LCL 0.95UCL
+ ARM=C 500 173.31 173.314 49.971 32.039 63.72
+ ARM=A 500 173.31 55.374 370.316 311.811 NA
$km_agd
Call: survfit(formula = Surv(TIME, EVENT) ~ ARM, data = pseudo_ipd,
conf.type = km_conf_type)
n events median 0.95LCL 0.95UCL
- ARM=C 500 500 56.4 50.8 61.2
- ARM=B 300 178 83.6 68.8 101.1
+ ARM=C 500 500 56.370 50.847 61.169
+ ARM=B 300 178 83.585 68.823 101.079
$model_before_ipd
Call:
coxph(formula = Surv(TIME, EVENT) ~ ARM, data = ipd)
- coef exp(coef) se(coef) z p
- ARMA -1.50662 0.22166 0.08753 -17.21 <2e-16
+ coef exp(coef) se(coef) z p
+ ARMA -1.50662 0.22166 0.08753 -17.213 < 2.2e-16
- Likelihood ratio test=341.2 on 1 df, p=< 2.2e-16
+ Likelihood ratio test=341.18 on 1 df, p=< 2.22e-16
n= 1000, number of events= 690
$model_after_ipd
@@ -236,76 +236,76 @@
coxph(formula = Surv(TIME, EVENT) ~ ARM, data = ipd, weights = weights,
robust = TRUE)
- coef exp(coef) se(coef) robust se z p
- ARMA -1.8129 0.1632 0.1602 0.1949 -9.303 <2e-16
+ coef exp(coef) se(coef) robust se z p
+ ARMA -1.98959 0.13675 0.16905 0.18855 -10.552 < 2.2e-16
- Likelihood ratio test=155.2 on 1 df, p=< 2.2e-16
+ Likelihood ratio test=175.56 on 1 df, p=< 2.22e-16
n= 1000, number of events= 690
$model_agd
Call:
coxph(formula = Surv(TIME, EVENT) ~ ARM, data = pseudo_ipd)
- coef exp(coef) se(coef) z p
- ARMB -0.55897 0.57180 0.08802 -6.351 2.14e-10
+ coef exp(coef) se(coef) z p
+ ARMB -0.558965 0.571800 0.088017 -6.3507 2.144e-10
- Likelihood ratio test=43.66 on 1 df, p=3.91e-11
+ Likelihood ratio test=43.66 on 1 df, p=3.9096e-11
n= 800, number of events= 678
$res_AC
$res_AC$est
- [1] 0.1631852
+ [1] 0.13675
$res_AC$se
- [1] 0.194863
+ [1] 0.18855
$res_AC$ci_l
- [1] 0.1113815
+ [1] 0.0945
$res_AC$ci_u
- [1] 0.2390829
+ [1] 0.19789
$res_AC$pval
- [1] 1.361531e-20
+ [1] 4.9838e-26
$res_AC_unadj
$res_AC_unadj$est
- [1] 0.2216588
+ [1] 0.22166
$res_AC_unadj$se
- [1] 0.08752989
+ [1] 0.08753
$res_AC_unadj$ci_l
- [1] 0.1867151
+ [1] 0.18672
$res_AC_unadj$ci_u
- [1] 0.2631423
+ [1] 0.26314
$res_AC_unadj$pval
- [1] 2.13665e-66
+ [1] 2.1366e-66
$res_BC
$res_BC$est
- [1] 0.5718004
+ [1] 0.5718
$res_BC$se
- [1] 0.0880166
+ [1] 0.088017
$res_BC$ci_l
- [1] 0.4811989
+ [1] 0.4812
$res_BC$ci_u
- [1] 0.6794607
+ [1] 0.67946
$res_BC$pval
- [1] 2.14366e-10
+ [1] 2.1437e-10
$res_AB
result pvalue
- "0.29[0.19; 0.43]" "<0.001"
+ "0.24[0.16; 0.36]" "<0.001"
$res_AB_unadj
result pvalue
@@ -322,26 +322,26 @@
Bootstrap Statistics :
- original bias std. error
- t1* -1.24586465 -0.161716794 0.28787014
- t2* 0.04571853 0.001994459 0.01042480
- t3* 0.21381891 0.003564636 0.02391077
- t4* -1.81286926 -0.166912210 0.25058383
- t5* 0.19486304 0.003675676 0.02618306
- t6* 0.03797160 0.001994459 0.01042480
+ original bias std. error
+ t1* -1.422586 0.0150047 0.287870
+ t2* 0.043300 0.0044132 0.010425
+ t3* 0.208086 0.0092974 0.023911
+ t4* -1.989591 0.0098093 0.250584
+ t5* 0.188555 0.0099839 0.026183
+ t6* 0.035553 0.0044132 0.010425
$boot_res_AC
$boot_res_AC$est
- [1] 0.1631852
+ [1] 0.13675
$boot_res_AC$se
[1] NA
$boot_res_AC$ci_l
- [1] 0.1179974
+ [1] 0.082866
$boot_res_AC$ci_u
- [1] 0.3151137
+ [1] 0.22129
$boot_res_AC$pval
[1] NA
@@ -349,16 +349,16 @@
$boot_res_AB_mc
$boot_res_AB_mc$est
- [1] 0.287692
+ [1] 0.24109
$boot_res_AB_mc$se
[1] NA
$boot_res_AB_mc$ci_l
- [1] 0.1923646
+ [1] 0.13509
$boot_res_AB_mc$ci_u
- [1] 0.5945605
+ [1] 0.41754
$boot_res_AB_mc$pval
[1] NA
@@ -366,16 +366,16 @@
$boot_res_AB
$boot_res_AB$est
- [1] 0.2853885
+ [1] 0.23916
$boot_res_AB$se
[1] NA
$boot_res_AB$ci_l
- [1] 0.1695758
+ [1] 0.14211
$boot_res_AB$ci_u
- [1] 0.4802958
+ [1] 0.40249
$boot_res_AB$pval
[1] NA
@@ -390,7 +390,7 @@
trt_ind treatment type n events events_pct
1 C C IPD, before matching 500.0000 338.0000 67.60000
2 A A IPD, before matching 500.0000 390.0000 78.00000
- 3 C C IPD, after matching 199.4265 131.2892 65.83339
+ 3 C C IPD, after matching 199.4265 134.0364 67.21094
4 A A IPD, after matching 199.4265 142.8968 71.65386
5 C C AgD, external 320.0000 120.0000 37.50000
6 B B AgD, external 480.0000 280.0000 58.33333
@@ -402,10 +402,10 @@
Output
case OR LCL UCL pval
1 AC 1.6993007 1.2809976 2.2541985 2.354448e-04
- 2 adjusted_AC 1.3119021 0.8210000 2.0963303 2.562849e-01
+ 2 adjusted_AC 1.2332036 0.7710134 1.9724576 3.817109e-01
3 BC 2.3333333 1.7458092 3.1185794 1.035032e-08
4 AB 0.7282717 0.4857575 1.0918611 1.248769e-01
- 5 adjusted_AB 0.5622438 0.3239933 0.9756933 4.061296e-02
+ 5 adjusted_AB 0.5285158 0.3043103 0.9179084 2.356848e-02
---
@@ -431,11 +431,11 @@
Coefficients:
(Intercept) ARMA
- 0.6559 0.2715
+ 0.7177 0.2096
Degrees of Freedom: 999 Total (i.e. Null); 998 Residual
- Null Deviance: 495.5
- Residual Deviance: 493.9 AIC: 454.5
+ Null Deviance: 491.1
+ Residual Deviance: 490.1 AIC: 458.4
$model_agd
@@ -451,19 +451,19 @@
$res_AC
$res_AC$est
- [1] 1.311902
+ [1] 1.233204
$res_AC$se
- [1] 0.3275028
+ [1] 0.3085377
$res_AC$ci_l
- [1] 0.821
+ [1] 0.7710134
$res_AC$ci_u
- [1] 2.09633
+ [1] 1.972458
$res_AC$pval
- [1] 0.2562849
+ [1] 0.3817109
$res_AC_unadj
@@ -502,7 +502,7 @@
$res_AB
result pvalue
- "0.56[0.32; 0.98]" "0.041"
+ "0.53[0.30; 0.92]" "0.024"
$res_AB_unadj
result pvalue
@@ -529,7 +529,7 @@
trt_ind treatment type n events events_pct
1 C C IPD, before matching 500.0000 338.0000 67.60000
2 A A IPD, before matching 500.0000 390.0000 78.00000
- 3 C C IPD, after matching 199.4265 131.2892 65.83339
+ 3 C C IPD, after matching 199.4265 134.0364 67.21094
4 A A IPD, after matching 199.4265 142.8968 71.65386
5 C C AgD, external 320.0000 120.0000 37.50000
6 B B AgD, external 480.0000 280.0000 58.33333
@@ -541,10 +541,10 @@
Output
case RR LCL UCL pval
1 AC 1.1538462 1.0688892 1.2455556 2.451956e-04
- 2 adjusted_AC 1.0884122 0.9398949 1.2603975 2.577047e-01
+ 2 adjusted_AC 1.0661042 0.9234409 1.2308077 3.824937e-01
3 BC 1.5555555 1.3250564 1.8261510 6.678781e-08
4 AB 0.7417582 0.6210074 0.8859883 9.832938e-04
- 5 adjusted_AB 0.6996936 0.5630034 0.8695704 1.281101e-03
+ 5 adjusted_AB 0.6853527 0.5525932 0.8500075 5.832632e-04
---
@@ -570,11 +570,11 @@
Coefficients:
(Intercept) ARMA
- -0.41804 0.08472
+ -0.39733 0.06401
Degrees of Freedom: 999 Total (i.e. Null); 998 Residual
- Null Deviance: 495.5
- Residual Deviance: 493.9 AIC: 454.5
+ Null Deviance: 491.1
+ Residual Deviance: 490.1 AIC: 458.4
$model_agd
@@ -590,19 +590,19 @@
$res_AC
$res_AC$est
- [1] 1.088412
+ [1] 1.066104
$res_AC$se
- [1] 0.08181292
+ [1] 0.07845782
$res_AC$ci_l
- [1] 0.9398949
+ [1] 0.9234409
$res_AC$ci_u
- [1] 1.260397
+ [1] 1.230808
$res_AC$pval
- [1] 0.2577047
+ [1] 0.3824937
$res_AC_unadj
@@ -641,7 +641,7 @@
$res_AB
result pvalue
- "0.70[0.56; 0.87]" "0.001"
+ "0.69[0.55; 0.85]" "0.001"
$res_AB_unadj
result pvalue
@@ -668,7 +668,7 @@
trt_ind treatment type n events events_pct
1 C C IPD, before matching 500.0000 338.0000 67.60000
2 A A IPD, before matching 500.0000 390.0000 78.00000
- 3 C C IPD, after matching 199.4265 131.2892 65.83339
+ 3 C C IPD, after matching 199.4265 134.0364 67.21094
4 A A IPD, after matching 199.4265 142.8968 71.65386
5 C C AgD, external 320.0000 120.0000 37.50000
6 B B AgD, external 480.0000 280.0000 58.33333
@@ -680,10 +680,10 @@
Output
case RD LCL UCL pval
1 AC 10.400000 4.921741 15.878259 1.985755e-04
- 2 adjusted_AC 5.820475 -4.207825 15.848775 2.552989e-01
+ 2 adjusted_AC 4.442927 -5.499175 14.385028 3.811014e-01
3 BC 20.833333 13.934963 27.731704 3.235832e-09
4 AB -10.433333 -19.242354 -1.624313 2.026711e-02
- 5 adjusted_AB -15.012859 -27.184724 -2.840993 1.563044e-02
+ 5 adjusted_AB -16.390407 -28.491353 -4.289460 7.937461e-03
---
@@ -709,11 +709,11 @@
Coefficients:
(Intercept) ARMA
- 0.6583 0.0582
+ 0.67211 0.04443
Degrees of Freedom: 999 Total (i.e. Null); 998 Residual
- Null Deviance: 495.5
- Residual Deviance: 493.9 AIC: 454.5
+ Null Deviance: 491.1
+ Residual Deviance: 490.1 AIC: 458.4
$model_agd
@@ -729,19 +729,19 @@
$res_AC
$res_AC$est
- [1] 5.820475
+ [1] 4.442927
$res_AC$se
- [1] 5.116574
+ [1] 5.072594
$res_AC$ci_l
- [1] -4.207825
+ [1] -5.499175
$res_AC$ci_u
- [1] 15.84877
+ [1] 14.38503
$res_AC$pval
- [1] 0.2552989
+ [1] 0.3811014
$res_AC_unadj
@@ -780,7 +780,7 @@
$res_AB
result pvalue
- "-15.01[-27.18; -2.84]" "0.016"
+ "-16.39[-28.49; -4.29]" "0.008"
$res_AB_unadj
result pvalue
@@ -802,32 +802,32 @@
---
Code
- testout_boot_OR$descriptive$summary
+ print(testout_boot_OR$descriptive$summary, digits = 5)
Output
- trt_ind treatment type n events events_pct
- 1 C C IPD, before matching 500.0000 338.0000 67.60000
- 2 A A IPD, before matching 500.0000 390.0000 78.00000
- 3 C C IPD, after matching 199.4265 131.2892 65.83339
- 4 A A IPD, after matching 199.4265 142.8968 71.65386
- 5 C C AgD, external 320.0000 120.0000 37.50000
- 6 B B AgD, external 480.0000 280.0000 58.33333
+ trt_ind treatment type n events events_pct
+ 1 C C IPD, before matching 500.00 338.00 67.600
+ 2 A A IPD, before matching 500.00 390.00 78.000
+ 3 C C IPD, after matching 199.43 134.04 67.211
+ 4 A A IPD, after matching 199.43 142.90 71.654
+ 5 C C AgD, external 320.00 120.00 37.500
+ 6 B B AgD, external 480.00 280.00 58.333
---
Code
- testout_boot_OR$inferential$summary
+ print(testout_boot_OR$inferential$summary, digits = 5)
Output
- case OR LCL UCL pval
- 1 AC 1.6993007 1.2809976 2.2541985 2.354448e-04
- 2 adjusted_AC 1.3119021 0.8210000 2.0963303 2.562849e-01
- 3 BC 2.3333333 1.7458092 3.1185794 1.035032e-08
- 4 AB 0.7282717 0.4857575 1.0918611 1.248769e-01
- 5 adjusted_AB 0.5622438 0.3239933 0.9756933 4.061296e-02
+ case OR LCL UCL pval
+ 1 AC 1.69930 1.28100 2.25420 2.3544e-04
+ 2 adjusted_AC 1.23320 0.77101 1.97246 3.8171e-01
+ 3 BC 2.33333 1.74581 3.11858 1.0350e-08
+ 4 AB 0.72827 0.48576 1.09186 1.2488e-01
+ 5 adjusted_AB 0.52852 0.30431 0.91791 2.3568e-02
---
Code
- testout_boot_OR$inferential$fit
+ print(testout_boot_OR$inferential$fit, digits = 5)
Output
$model_before_ipd
@@ -835,11 +835,11 @@
Coefficients:
(Intercept) ARMA
- 0.7354 0.5302
+ 0.73545 0.53022
Degrees of Freedom: 999 Total (i.e. Null); 998 Residual
- Null Deviance: 1170
- Residual Deviance: 1157 AIC: 1161
+ Null Deviance: 1170.5
+ Residual Deviance: 1156.8 AIC: 1160.8
$model_after_ipd
@@ -848,11 +848,11 @@
Coefficients:
(Intercept) ARMA
- 0.6559 0.2715
+ 0.71774 0.20962
Degrees of Freedom: 999 Total (i.e. Null); 998 Residual
- Null Deviance: 495.5
- Residual Deviance: 493.9 AIC: 454.5
+ Null Deviance: 491.07
+ Residual Deviance: 490.14 AIC: 458.35
$model_agd
@@ -860,66 +860,66 @@
Coefficients:
(Intercept) ARMB
- -0.5108 0.8473
+ -0.51083 0.84730
Degrees of Freedom: 799 Total (i.e. Null); 798 Residual
Null Deviance: 1109
- Residual Deviance: 1075 AIC: 1079
+ Residual Deviance: 1075.4 AIC: 1079.4
$res_AC
$res_AC$est
- [1] 1.311902
+ [1] 1.2332
$res_AC$se
- [1] 0.3275028
+ [1] 0.30854
$res_AC$ci_l
- [1] 0.821
+ [1] 0.77101
$res_AC$ci_u
- [1] 2.09633
+ [1] 1.9725
$res_AC$pval
- [1] 0.2562849
+ [1] 0.38171
$res_AC_unadj
$res_AC_unadj$est
- [1] 1.699301
+ [1] 1.6993
$res_AC_unadj$se
- [1] 0.2488482
+ [1] 0.24885
$res_AC_unadj$ci_l
- [1] 1.280998
+ [1] 1.281
$res_AC_unadj$ci_u
- [1] 2.254199
+ [1] 2.2542
$res_AC_unadj$pval
- [1] 0.0002354448
+ [1] 0.00023544
$res_BC
$res_BC$est
- [1] 2.333333
+ [1] 2.3333
$res_BC$se
- [1] 0.3510631
+ [1] 0.35106
$res_BC$ci_l
- [1] 1.745809
+ [1] 1.7458
$res_BC$ci_u
- [1] 3.118579
+ [1] 3.1186
$res_BC$pval
- [1] 1.035032e-08
+ [1] 1.035e-08
$res_AB
result pvalue
- "0.56[0.32; 0.98]" "0.041"
+ "0.53[0.30; 0.92]" "0.024"
$res_AB_unadj
result pvalue
@@ -936,26 +936,26 @@
Bootstrap Statistics :
- original bias std. error
- t1* -0.69289322 0.59931037 0.259160031
- t2* 0.06888563 0.01114340 0.004040355
- t3* 0.26246071 0.02034770 0.007139486
- t4* 0.27147808 0.45352064 0.291583054
- t5* 0.21675070 0.02420063 0.008380500
- t6* 0.04698086 0.01114340 0.004040355
+ original bias std. error
+ t1* -0.754756 0.661173 0.2591600
+ t2* 0.069346 0.010683 0.0040404
+ t3* 0.263336 0.019472 0.0071395
+ t4* 0.209615 0.515383 0.2915831
+ t5* 0.217810 0.023141 0.0083805
+ t6* 0.047441 0.010683 0.0040404
$boot_res_AC
$boot_res_AC$est
- [1] 1.311902
+ [1] 1.2332
$boot_res_AC$se
[1] NA
$boot_res_AC$ci_l
- [1] 0.4706998
+ [1] 0.41592
$boot_res_AC$ci_u
- [1] 1.476168
+ [1] 1.3044
$boot_res_AC$pval
[1] NA
@@ -963,16 +963,16 @@
$boot_res_AB_mc
$boot_res_AB_mc$est
- [1] 0.500127
+ [1] 0.47013
$boot_res_AB_mc$se
[1] NA
$boot_res_AB_mc$ci_l
- [1] 0.1652744
+ [1] 0.14604
$boot_res_AB_mc$ci_u
- [1] 0.4564577
+ [1] 0.40334
$boot_res_AB_mc$pval
[1] NA
@@ -980,16 +980,16 @@
$boot_res_AB
$boot_res_AB$est
- [1] 0.5622438
+ [1] 0.52852
$boot_res_AB$se
[1] NA
$boot_res_AB$ci_l
- [1] 0.2962009
+ [1] 0.27843
$boot_res_AB$ci_u
- [1] 1.067242
+ [1] 1.0032
$boot_res_AB$pval
[1] NA
diff --git a/tests/testthat/_snaps/maic_unanchored.md b/tests/testthat/_snaps/maic_unanchored.md
index 38f5ecad..5c2b9f66 100644
--- a/tests/testthat/_snaps/maic_unanchored.md
+++ b/tests/testthat/_snaps/maic_unanchored.md
@@ -274,20 +274,27 @@
---
Code
- testout_boot_RR$descriptive
+ print(testout_boot_RR$descriptive$summary, digits = 5)
Output
- $summary
- trt_ind treatment type n events events_pct
- 1 B B Before matching 400.0000 280.0000 70.00000
- 2 A A Before matching 500.0000 390.0000 78.00000
- 3 B B After matching 400.0000 280.0000 70.00000
- 4 A A After matching 199.4265 142.8968 71.65386
-
+ trt_ind treatment type n events events_pct
+ 1 B B Before matching 400.00 280.0 70.000
+ 2 A A Before matching 500.00 390.0 78.000
+ 3 B B After matching 400.00 280.0 70.000
+ 4 A A After matching 199.43 142.9 71.654
+
+---
+
+ Code
+ print(testout_boot_RR$inferential$summary, digits = 5)
+ Output
+ case RR LCL UCL pval
+ 1 AB 1.1143 1.02937 1.2062 0.0074553
+ 2 adjusted_AB 1.0236 0.91236 1.1485 0.6908096
---
Code
- testout_boot_RR$inferential$fit
+ print(testout_boot_RR$inferential$fit, digits = 5)
Output
$model_before
@@ -295,11 +302,11 @@
Coefficients:
(Intercept) ARMA
- -0.3567 0.1082
+ -0.35667 0.10821
Degrees of Freedom: 899 Total (i.e. Null); 898 Residual
Null Deviance: 1023
- Residual Deviance: 1016 AIC: 1020
+ Residual Deviance: 1015.6 AIC: 1019.6
$model_after
@@ -308,44 +315,44 @@
Coefficients:
(Intercept) ARMA
- -0.35667 0.02335
+ -0.356675 0.023352
Degrees of Freedom: 899 Total (i.e. Null); 898 Residual
- Null Deviance: 726.7
- Residual Deviance: 726.5 AIC: 712.5
+ Null Deviance: 726.66
+ Residual Deviance: 726.48 AIC: 712.47
$res_AB
$res_AB$est
- [1] 1.023627
+ [1] 1.0236
$res_AB$se
- [1] 0.06025155
+ [1] 0.060252
$res_AB$ci_l
- [1] 0.9123647
+ [1] 0.91236
$res_AB$ci_u
- [1] 1.148457
+ [1] 1.1485
$res_AB$pval
- [1] 0.6908096
+ [1] 0.69081
$res_AB_unadj
$res_AB_unadj$est
- [1] 1.114286
+ [1] 1.1143
$res_AB_unadj$se
- [1] 0.04511891
+ [1] 0.045119
$res_AB_unadj$ci_l
- [1] 1.029372
+ [1] 1.0294
$res_AB_unadj$ci_u
- [1] 1.206204
+ [1] 1.2062
$res_AB_unadj$pval
- [1] 0.007455267
+ [1] 0.0074553
$boot_res
@@ -359,37 +366,28 @@
Bootstrap Statistics :
- original bias std. error
- t1* 0.023351847 1.366708e-02 0.0538052765
- t2* 0.003055105 -4.315049e-05 0.0003823512
+ original bias std. error
+ t1* 0.0233518 0.01366708 0.05380528
+ t2* 0.0030551 -0.00004315 0.00038235
$boot_res_AB
$boot_res_AB$est
- [1] 1.023627
+ [1] 1.0236
$boot_res_AB$se
[1] NA
$boot_res_AB$ci_l
- [1] 0.9086715
+ [1] 0.90867
$boot_res_AB$ci_u
- [1] 1.122032
+ [1] 1.122
$boot_res_AB$pval
[1] NA
----
-
- Code
- testout_boot_RR$inferential$summary
- Output
- case RR LCL UCL pval
- 1 AB 1.114286 1.0293724 1.206204 0.007455267
- 2 adjusted_AB 1.023627 0.9123647 1.148457 0.690809607
-
# test time to event case
Code
@@ -500,56 +498,56 @@
---
Code
- testout2$descriptive$summary
+ print(testout2$descriptive$summary, digits = 5)
Output
- trt_ind treatment type records n.max n.start events
- 1 B B Before matching 300 300.0000 300.0000 178.00000
- 2 A A Before matching 500 500.0000 500.0000 190.00000
- 3 B B After matching 300 300.0000 300.0000 178.00000
- 4 A A After matching 500 199.4265 199.4265 65.68878
- rmean se(rmean) median 0.95LCL 0.95UCL
- 1 4.303551 0.3367260 2.746131 2.261125 3.320857
- 2 8.709690 0.3551477 7.587627 6.278691 10.288538
- 3 4.303551 0.3367260 2.746131 2.261125 3.320857
- 4 10.166029 0.5499915 11.900015 7.815275 14.873786
+ trt_ind treatment type records n.max n.start events rmean
+ 1 B B Before matching 300 300.00 300.00 178.000 4.3036
+ 2 A A Before matching 500 500.00 500.00 190.000 8.7097
+ 3 B B After matching 300 300.00 300.00 178.000 4.3036
+ 4 A A After matching 500 199.43 199.43 65.689 10.1660
+ se(rmean) median 0.95LCL 0.95UCL
+ 1 0.33673 2.7461 2.2611 3.3209
+ 2 0.35515 7.5876 6.2787 10.2885
+ 3 0.33673 2.7461 2.2611 3.3209
+ 4 0.54999 11.9000 7.8153 14.8738
---
Code
- testout2$inferential$summary
+ print(testout2$inferential$summary, digits = 5)
Output
- case HR LCL UCL pval
- 1 AB 0.3748981 0.3039010 0.4624815 5.245204e-20
- 2 adjusted_AB 0.2834780 0.2074664 0.3873387 2.473442e-15
+ case HR LCL UCL pval
+ 1 AB 0.37490 0.30390 0.46248 5.2452e-20
+ 2 adjusted_AB 0.28348 0.20747 0.38734 2.4734e-15
---
Code
- testout2$inferential$fit
+ print(testout2$inferential$fit, digits = 5)
Output
$km_before
Call: survfit(formula = Surv(TIME, EVENT) ~ ARM, data = dat, conf.type = km_conf_type)
- n events median 0.95LCL 0.95UCL
- ARM=B 300 178 83.6 68.8 101
- ARM=A 500 190 230.9 191.1 313
+ n events median 0.95LCL 0.95UCL
+ ARM=B 300 178 83.585 68.823 101.08
+ ARM=A 500 190 230.948 191.108 313.16
$km_after
Call: survfit(formula = Surv(TIME, EVENT) ~ ARM, data = dat, weights = dat$weights,
conf.type = km_conf_type)
- records n events median 0.95LCL 0.95UCL
- ARM=B 300 300 178.0 83.6 68.8 101
- ARM=A 500 199 65.7 362.2 237.9 453
+ records n events median 0.95LCL 0.95UCL
+ ARM=B 300 300.00 178.000 83.585 68.823 101.08
+ ARM=A 500 199.43 65.689 362.207 237.877 452.72
$model_before
Call:
coxph(formula = Surv(TIME, EVENT) ~ ARM, data = dat)
- coef exp(coef) se(coef) z p
- ARMA -0.9811 0.3749 0.1071 -9.159 <2e-16
+ coef exp(coef) se(coef) z p
+ ARMA -0.98110 0.37490 0.10712 -9.1589 < 2.2e-16
- Likelihood ratio test=80.62 on 1 df, p=< 2.2e-16
+ Likelihood ratio test=80.62 on 1 df, p=< 2.22e-16
n= 800, number of events= 368
$model_after
@@ -557,44 +555,44 @@
coxph(formula = Surv(TIME, EVENT) ~ ARM, data = dat, weights = weights,
robust = TRUE)
- coef exp(coef) se(coef) robust se z p
- ARMA -1.2606 0.2835 0.1504 0.1593 -7.915 2.47e-15
+ coef exp(coef) se(coef) robust se z p
+ ARMA -1.26062 0.28348 0.15035 0.15927 -7.915 2.473e-15
- Likelihood ratio test=80.4 on 1 df, p=< 2.2e-16
+ Likelihood ratio test=80.4 on 1 df, p=< 2.22e-16
n= 800, number of events= 368
$res_AB
$res_AB$est
- [1] 0.283478
+ [1] 0.28348
$res_AB$se
- [1] 0.04601759
+ [1] 0.046018
$res_AB$ci_l
- [1] 0.2074664
+ [1] 0.20747
$res_AB$ci_u
- [1] 0.3873387
+ [1] 0.38734
$res_AB$pval
- [1] 2.473442e-15
+ [1] 2.4734e-15
$res_AB_unadj
$res_AB_unadj$est
- [1] 0.3748981
+ [1] 0.3749
$res_AB_unadj$se
- [1] 0.0405065
+ [1] 0.040506
$res_AB_unadj$ci_l
- [1] 0.303901
+ [1] 0.3039
$res_AB_unadj$ci_u
- [1] 0.4624815
+ [1] 0.46248
$res_AB_unadj$pval
- [1] 5.245204e-20
+ [1] 5.2452e-20
$boot_res
@@ -608,22 +606,22 @@
Bootstrap Statistics :
- original bias std. error
- t1* -1.26062079 0.0024513461 0.131388233
- t2* 0.02536718 0.0005819358 0.002670424
+ original bias std. error
+ t1* -1.260621 0.00245135 0.1313882
+ t2* 0.025367 0.00058194 0.0026704
$boot_res_AB
$boot_res_AB$est
- [1] 0.283478
+ [1] 0.28348
$boot_res_AB$se
[1] NA
$boot_res_AB$ci_l
- [1] 0.2185832
+ [1] 0.21858
$boot_res_AB$ci_u
- [1] 0.3658412
+ [1] 0.36584
$boot_res_AB$pval
[1] NA
diff --git a/tests/testthat/_snaps/plot_km2/kmplot2-all.svg b/tests/testthat/_snaps/plot_km2/kmplot2-all.svg
index 0c60323a..e291ea1b 100644
--- a/tests/testthat/_snaps/plot_km2/kmplot2-all.svg
+++ b/tests/testthat/_snaps/plot_km2/kmplot2-all.svg
@@ -25,7 +25,7 @@
-
+
@@ -678,14 +678,16 @@
Overall Survival
Treatment
+
-+
+
+
+
+
+
-+
C
A
A (weighted)
@@ -1474,10 +1476,13 @@
Overall Survival
Treatment
+
+
+
+
+
+
B
@@ -1493,7 +1498,7 @@
-
+
@@ -1668,8 +1673,9 @@
Overall Survival
Treatment
+
-+
+
+
C
@@ -1738,8 +1744,11 @@
Overall Survival
Treatment
+
+
+
C (AgD)
C (IPD)
diff --git a/tests/testthat/_snaps/plot_km2/kmplot2-by-am.svg b/tests/testthat/_snaps/plot_km2/kmplot2-by-am.svg
index 716dced2..8bfbb189 100644
--- a/tests/testthat/_snaps/plot_km2/kmplot2-by-am.svg
+++ b/tests/testthat/_snaps/plot_km2/kmplot2-by-am.svg
@@ -25,788 +25,791 @@
-
+
-
-
+
+
-
-
-
-
-
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
+
+
+
+
+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
-
-0.00
-0.25
-0.50
-0.75
-1.00
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-0
-2
-4
-6
-8
-10
-12
-14
-16
-Time
+
+0.00
+0.25
+0.50
+0.75
+1.00
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+0
+2
+4
+6
+8
+10
+12
+14
+16
+Time
Overall Survival
-
-Treatment
-
-+
-
-+
-
-+
-B
-A
-A (weighted)
-Kaplan-Meier Curves
-(A vs B)
-Endpoint: Overall Survival
+
+Treatment
+
+
++
+
+
++
+
+
++
+B
+A
+A (weighted)
+Kaplan-Meier Curves
+(A vs B)
+Endpoint: Overall Survival
@@ -814,7 +817,7 @@
-
+
@@ -870,58 +873,61 @@
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
-0.00
-0.25
-0.50
-0.75
-1.00
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-0
-2
-4
-6
-8
-10
-12
-14
-Time
+
+0.00
+0.25
+0.50
+0.75
+1.00
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+0
+2
+4
+6
+8
+10
+12
+14
+Time
Overall Survival
-
-Treatment
-
-
-
-C (AgD)
-C (IPD)
-C (IPD,weighted)
-Kaplan-Meier Curves of Common Comparator
-C(IPD vs AgD Trial)
-Endpoint: Overall Survival
+
+Treatment
+
+
+
+
+
+
+C (AgD)
+C (IPD)
+C (IPD,weighted)
+Kaplan-Meier Curves of Common Comparator
+C(IPD vs AgD Trial)
+Endpoint: Overall Survival
diff --git a/tests/testthat/_snaps/plot_km2/kmplot2-by-trial.svg b/tests/testthat/_snaps/plot_km2/kmplot2-by-trial.svg
index 4588e30e..56183f1e 100644
--- a/tests/testthat/_snaps/plot_km2/kmplot2-by-trial.svg
+++ b/tests/testthat/_snaps/plot_km2/kmplot2-by-trial.svg
@@ -25,670 +25,672 @@
-
+
-
-
+
+
-
-
-
-
-
-
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
+
+
+
+
+
+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
-
-0.00
-0.25
-0.50
-0.75
-1.00
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-0
-2
-4
-6
-8
-10
-12
-14
-16
-Time
+
+0.00
+0.25
+0.50
+0.75
+1.00
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+0
+2
+4
+6
+8
+10
+12
+14
+16
+Time
Overall Survival
-
-Treatment
-
-+
-
-+
-
-+
-
-+
-C
-A
-A (weighted)
-C (weighted)
-Kaplan-Meier Curves
-(A vs C) in the IPD trial
-Endpoint: Overall Survival
+
+Treatment
+
+
+
+
++
+
+
++
+
+
+C
+A
+A (weighted)
+C (weighted)
+Kaplan-Meier Curves
+(A vs C) in the IPD trial
+Endpoint: Overall Survival
@@ -696,7 +698,7 @@
-
+
@@ -762,181 +764,182 @@
-
-
+
+
-
-
-
-
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
+
+
+
+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
-
-0.00
-0.25
-0.50
-0.75
-1.00
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-0
-2
-4
-6
-8
-10
-12
-14
-16
-Time
+
+0.00
+0.25
+0.50
+0.75
+1.00
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+0
+2
+4
+6
+8
+10
+12
+14
+16
+Time
Overall Survival
-
-Treatment
-
-+
-
-+
-C
-B
-Kaplan-Meier Curves
-(B vs C) in the AgD trial
-Endpoint: Overall Survival
+
+Treatment
+
+
+
+
++
+C
+B
+Kaplan-Meier Curves
+(B vs C) in the AgD trial
+Endpoint: Overall Survival
diff --git a/tests/testthat/_snaps/plot_km2/kmplot2-normalize-by-trial.svg b/tests/testthat/_snaps/plot_km2/kmplot2-normalize-by-trial.svg
index c0db2437..2a350b6a 100644
--- a/tests/testthat/_snaps/plot_km2/kmplot2-normalize-by-trial.svg
+++ b/tests/testthat/_snaps/plot_km2/kmplot2-normalize-by-trial.svg
@@ -25,670 +25,672 @@
-
+
-
-
+
+
-
-
-
-
-
-
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
+
+
+
+
+
+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
-
-0.00
-0.25
-0.50
-0.75
-1.00
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-0
-2
-4
-6
-8
-10
-12
-14
-16
-Time
+
+0.00
+0.25
+0.50
+0.75
+1.00
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+0
+2
+4
+6
+8
+10
+12
+14
+16
+Time
Overall Survival
-
-Treatment
-
-+
-
-+
-
-+
-
-+
-C
-A
-A (weighted)
-C (weighted)
-Kaplan-Meier Curves
-(A vs C) in the IPD trial
-Endpoint: Overall Survival
+
+Treatment
+
+
+
+
++
+
+
++
+
+
+C
+A
+A (weighted)
+C (weighted)
+Kaplan-Meier Curves
+(A vs C) in the IPD trial
+Endpoint: Overall Survival
@@ -696,7 +698,7 @@
-
+
@@ -762,181 +764,182 @@
-
-
+
+
-
-
-
-
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
+
+
+
+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
-
-0.00
-0.25
-0.50
-0.75
-1.00
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-0
-2
-4
-6
-8
-10
-12
-14
-16
-Time
+
+0.00
+0.25
+0.50
+0.75
+1.00
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+0
+2
+4
+6
+8
+10
+12
+14
+16
+Time
Overall Survival
-
-Treatment
-
-+
-
-+
-C
-B
-Kaplan-Meier Curves
-(B vs C) in the AgD trial
-Endpoint: Overall Survival
+
+Treatment
+
+
+
+
++
+C
+B
+Kaplan-Meier Curves
+(B vs C) in the AgD trial
+Endpoint: Overall Survival
diff --git a/tests/testthat/test-maic_anchored.R b/tests/testthat/test-maic_anchored.R
index 9f35fdad..cd24201f 100644
--- a/tests/testthat/test-maic_anchored.R
+++ b/tests/testthat/test-maic_anchored.R
@@ -56,13 +56,13 @@ test_that("maic_anchored works for TTE", {
# Compare robust outputs
expect_snapshot(testout$descriptive$summary)
- expect_snapshot(testout$inferential$summary)
+ expect_snapshot(print(testout$inferential$summary, digits = 5))
expect_snapshot(testout$inferential$fit)
# Compare bootstrap outputs
- expect_snapshot(testout2$descriptive$summary)
- expect_snapshot(testout2$inferential$summary)
- expect_snapshot(testout2$inferential$fit)
+ expect_snapshot(print(testout2$descriptive$summary, digits = 5))
+ expect_snapshot(print(testout2$inferential$summary, digits = 5))
+ expect_snapshot(print(testout2$inferential$fit, digits = 5))
})
@@ -167,7 +167,7 @@ test_that("maic_anchored for binary case gives the expected result", {
expect_snapshot(testout_RD$inferential$fit)
# Compare bootstrap outputs
- expect_snapshot(testout_boot_OR$descriptive$summary)
- expect_snapshot(testout_boot_OR$inferential$summary)
- expect_snapshot(testout_boot_OR$inferential$fit)
+ expect_snapshot(print(testout_boot_OR$descriptive$summary, digits = 5))
+ expect_snapshot(print(testout_boot_OR$inferential$summary, digits = 5))
+ expect_snapshot(print(testout_boot_OR$inferential$fit, digits = 5))
})
diff --git a/tests/testthat/test-maic_unanchored.R b/tests/testthat/test-maic_unanchored.R
index 5c73f10a..24f3cabb 100644
--- a/tests/testthat/test-maic_unanchored.R
+++ b/tests/testthat/test-maic_unanchored.R
@@ -109,9 +109,9 @@ test_that("test binary case", {
expect_snapshot(testout_OR$inferential$fit)
# Compare bootstrap outputs
- expect_snapshot(testout_boot_RR$descriptive)
- expect_snapshot(testout_boot_RR$inferential$fit)
- expect_snapshot(testout_boot_RR$inferential$summary)
+ expect_snapshot(print(testout_boot_RR$descriptive$summary, digits = 5))
+ expect_snapshot(print(testout_boot_RR$inferential$summary, digits = 5))
+ expect_snapshot(print(testout_boot_RR$inferential$fit, digits = 5))
})
@@ -226,7 +226,7 @@ test_that("test time to event case", {
expect_snapshot(testout$inferential$fit)
# Compare bootstrap outputs
- expect_snapshot(testout2$descriptive$summary)
- expect_snapshot(testout2$inferential$summary)
- expect_snapshot(testout2$inferential$fit)
+ expect_snapshot(print(testout2$descriptive$summary, digits = 5))
+ expect_snapshot(print(testout2$inferential$summary, digits = 5))
+ expect_snapshot(print(testout2$inferential$fit, digits = 5))
})
diff --git a/tests/testthat/test-matching.R b/tests/testthat/test-matching.R
index a644e4d4..d4045906 100644
--- a/tests/testthat/test-matching.R
+++ b/tests/testthat/test-matching.R
@@ -192,24 +192,28 @@ test_that("estimate_weights prints errors about convergence", {
test_that("plot_weights_base works as expected", {
vdiffr::expect_doppelganger(
title = "plot_weights_base scaled_TRUE",
- plot_weights_base(
- weighted_sat,
- bin_col = "#6ECFFF",
- vline_col = "#0000E8",
- main_title = c("Scaled Individual Weights"),
- scaled_weights = TRUE
- )
+ function() {
+ plot_weights_base(
+ weighted_sat,
+ bin_col = "#6ECFFF",
+ vline_col = "#0000E8",
+ main_title = c("Scaled Individual Weights"),
+ scaled_weights = TRUE
+ )
+ }
)
vdiffr::expect_doppelganger(
title = "plot_weights_base scaled_FALSE",
- plot_weights_base(
- weighted_sat,
- bin_col = "#6ECFFF",
- vline_col = "#0000E8",
- main_title = c("Unscaled Individual Weights"),
- scaled_weights = FALSE
- )
+ function() {
+ plot_weights_base(
+ weighted_sat,
+ bin_col = "#6ECFFF",
+ vline_col = "#0000E8",
+ main_title = c("Unscaled Individual Weights"),
+ scaled_weights = FALSE
+ )
+ }
)
})
@@ -229,7 +233,7 @@ test_that("plot_weights_ggplot works as expected", {
test_that("default plot works as expected", {
vdiffr::expect_doppelganger(
title = "default_weights_plot",
- plot(weighted_twt)
+ function() plot(weighted_twt)
)
vdiffr::expect_doppelganger(
title = "default_weights_ggplot",
diff --git a/tests/testthat/test-plot_km2.R b/tests/testthat/test-plot_km2.R
index a7354a55..734087db 100644
--- a/tests/testthat/test-plot_km2.R
+++ b/tests/testthat/test-plot_km2.R
@@ -8,20 +8,22 @@ test_that("kmplot2 works", {
vdiffr::expect_doppelganger(
title = "kmplot2_by_trial",
fig = function() {
- kmplot2(
- weights_object = weighted_twt,
- tte_ipd = adtte_twt,
- tte_pseudo_ipd = pseudo_ipd_twt,
- trt_ipd = "A",
- trt_agd = "B",
- trt_common = "C",
- trt_var_ipd = "ARM",
- trt_var_agd = "ARM",
- endpoint_name = "Overall Survival",
- km_conf_type = "log-log",
- km_layout = "by_trial",
- time_scale = "month",
- break_x_by = 2
+ suppressWarnings(
+ kmplot2(
+ weights_object = weighted_twt,
+ tte_ipd = adtte_twt,
+ tte_pseudo_ipd = pseudo_ipd_twt,
+ trt_ipd = "A",
+ trt_agd = "B",
+ trt_common = "C",
+ trt_var_ipd = "ARM",
+ trt_var_agd = "ARM",
+ endpoint_name = "Overall Survival",
+ km_conf_type = "log-log",
+ km_layout = "by_trial",
+ time_scale = "month",
+ break_x_by = 2
+ )
)
}
)