R Under development (unstable) (2024-09-23 r87189 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # This file is part of the standard setup for testthat. > # It is recommended that you do not modify it. > # > # Where should you do additional test configuration? > # Learn more about the roles of various files in: > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview > # * https://testthat.r-lib.org/articles/special-files.html > > library(testthat) > library(snSMART) Loading required package: EnvStats Attaching package: 'EnvStats' The following objects are masked from 'package:stats': predict, predict.lm > > test_that("BJSM_binary 1", { + mydata <- data_binary + + BJSM_result <- BJSM_binary( + data = mydata, prior_dist = c("beta", "beta", "pareto"), + pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), beta_prior = c(1.6, 0.4, 3, 1), + n_MCMC_chain = 1, n.adapt = 1000, MCMC_SAMPLE = 2000, ci = 0.95, + six = TRUE, DTR = TRUE, verbose = FALSE + ) + + summary(BJSM_result) + print(summary(BJSM_result)) + print(BJSM_result) + + result = c(0.3889, 0.4371, 0.5793) + names(result) = c("pi_A", "pi_B", "pi_C") + + expect_equal(BJSM_result$pi_hat_bjsm, result, tolerance = 1e-1) + }) Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3995342 0.1113242 0.95 0.1906140 0.6175689 trtB 0.4391327 0.1117672 0.95 0.2287092 0.6532466 trtC 0.5613338 0.1136629 0.95 0.3446885 0.7836304 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.03959858 0.1597705 0.95 -0.3466860 0.2702591 diffBC -0.12220102 0.1560898 0.95 -0.3989859 0.1986214 diffAC -0.16179960 0.1589890 0.95 -0.4372125 0.1705071 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta0A 0.9209096 0.1023070 0.95 0.7082071 0.9999999 beta0B 0.9206962 0.1066777 0.95 0.6837591 1.0000000 beta0C 0.6786367 0.2881943 0.95 0.1474700 0.9999995 beta1A 1.5582379 0.5078938 0.95 1.0002865 2.5691097 beta1B 1.5064925 0.4889337 0.95 1.0005836 2.3952013 beta1C 1.4531645 0.3845308 0.95 1.0002590 2.1782183 Expected Response Rate of Dynamic Treatment Regimens (DTR): Estimate Std. Error C.I. CI low CI high rep_AB 0.4956866 0.1128392 0.95 0.2907497 0.7298752 rep_AC 0.5627877 0.1070455 0.95 0.3514040 0.7758273 rep_BA 0.4983545 0.1123617 0.95 0.2919082 0.7259174 rep_BC 0.5809021 0.1084874 0.95 0.3657720 0.7916935 rep_CA 0.5662283 0.1235486 0.95 0.3315519 0.7964598 rep_CB 0.5763499 0.1260094 0.95 0.3239532 0.8003912 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3995342 0.1113242 0.95 0.1906140 0.6175689 trtB 0.4391327 0.1117672 0.95 0.2287092 0.6532466 trtC 0.5613338 0.1136629 0.95 0.3446885 0.7836304 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.03959858 0.1597705 0.95 -0.3466860 0.2702591 diffBC -0.12220102 0.1560898 0.95 -0.3989859 0.1986214 diffAC -0.16179960 0.1589890 0.95 -0.4372125 0.1705071 Test passed 🌈 > > test_that("BJSM_binary 2", { + mydata <- data_binary + + BJSM_result <- BJSM_binary( + data = mydata, prior_dist = c("beta", "beta", "pareto"), + pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), beta_prior = c(1.6, 0.4, 3, 1), + n_MCMC_chain = 1, n.adapt = 1000, MCMC_SAMPLE = 2000, ci = 0.95, + six = TRUE, DTR = FALSE, verbose = FALSE + ) + + summary(BJSM_result) + print(summary(BJSM_result)) + print(BJSM_result) + + result = c(0.3889, 0.4371, 0.5793) + names(result) = c("pi_A", "pi_B", "pi_C") + + expect_equal(BJSM_result$pi_hat_bjsm, result, tolerance = 1e-1) + }) Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.4026715 0.1109377 0.95 0.1937818 0.6103474 trtB 0.4397658 0.1140955 0.95 0.2469348 0.6817720 trtC 0.5700405 0.1052876 0.95 0.3695229 0.7703145 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.03709432 0.1611159 0.95 -0.3409635 0.2703855 diffBC -0.13027471 0.1574948 0.95 -0.4679264 0.1539576 diffAC -0.16736902 0.1535410 0.95 -0.4753244 0.1199872 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta0A 0.9291543 0.10107643 0.95 0.7176876 0.9999970 beta0B 0.9279937 0.09692412 0.95 0.7199133 0.9999999 beta0C 0.6653666 0.29124676 0.95 0.1367891 0.9999972 beta1A 1.5608374 0.51330143 0.95 1.0002619 2.6021343 beta1B 1.5339024 0.47080695 0.95 1.0002154 2.4985348 beta1C 1.3948322 0.29812276 0.95 1.0005888 1.9724824 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.4026715 0.1109377 0.95 0.1937818 0.6103474 trtB 0.4397658 0.1140955 0.95 0.2469348 0.6817720 trtC 0.5700405 0.1052876 0.95 0.3695229 0.7703145 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.03709432 0.1611159 0.95 -0.3409635 0.2703855 diffBC -0.13027471 0.1574948 0.95 -0.4679264 0.1539576 diffAC -0.16736902 0.1535410 0.95 -0.4753244 0.1199872 Test passed 😸 > > test_that("BJSM_binary 3", { + mydata <- data_binary + + BJSM_result <- BJSM_binary( + data = mydata, prior_dist = c("beta", "beta", "pareto"), + pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), beta_prior = c(1.6, 0.4, 3, 1), + n_MCMC_chain = 1, n.adapt = 1000, MCMC_SAMPLE = 2000, ci = 0.95, + six = TRUE, DTR = TRUE, verbose = TRUE + ) + + summary(BJSM_result) + print(summary(BJSM_result)) + print(BJSM_result) + + result = c(0.3889, 0.4371, 0.5793) + names(result) = c("pi_A", "pi_B", "pi_C") + + expect_equal(BJSM_result$pi_hat_bjsm, result, tolerance = 1e-1) + }) Compiling model graph Resolving undeclared variables Allocating nodes Graph information: Observed stochastic nodes: 51 Unobserved stochastic nodes: 9 Total graph size: 154 Initializing model Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.4025213 0.1102630 0.95 0.1966928 0.6072857 trtB 0.4459552 0.1169460 0.95 0.2256208 0.6737942 trtC 0.5751295 0.1088679 0.95 0.3534859 0.7731365 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.04343392 0.1604685 0.95 -0.3460676 0.2705392 diffBC -0.12917436 0.1577946 0.95 -0.4318957 0.1770976 diffAC -0.17260827 0.1537404 0.95 -0.4699507 0.1258187 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta0A 0.9209025 0.10867120 0.95 0.6906414 1.0000000 beta0B 0.9266722 0.09344307 0.95 0.7284885 0.9999948 beta0C 0.6674497 0.28065902 0.95 0.1399357 0.9999905 beta1A 1.5592393 0.52697461 0.95 1.0003314 2.6365495 beta1B 1.4637434 0.44362344 0.95 1.0000457 2.3443840 beta1C 1.3991458 0.31626394 0.95 1.0003323 1.9731058 Expected Response Rate of Dynamic Treatment Regimens (DTR): Estimate Std. Error C.I. CI low CI high rep_AB 0.4993966 0.1143026 0.95 0.3003375 0.7407096 rep_AC 0.5696609 0.1059834 0.95 0.3857766 0.7942930 rep_BA 0.5014561 0.1175075 0.95 0.2882989 0.7362770 rep_BC 0.5901384 0.1080708 0.95 0.3939940 0.8133759 rep_CA 0.5719813 0.1278683 0.95 0.3093945 0.7971597 rep_CB 0.5825779 0.1274924 0.95 0.3186049 0.8031857 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.4025213 0.1102630 0.95 0.1966928 0.6072857 trtB 0.4459552 0.1169460 0.95 0.2256208 0.6737942 trtC 0.5751295 0.1088679 0.95 0.3534859 0.7731365 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.04343392 0.1604685 0.95 -0.3460676 0.2705392 diffBC -0.12917436 0.1577946 0.95 -0.4318957 0.1770976 diffAC -0.17260827 0.1537404 0.95 -0.4699507 0.1258187 Test passed 🎉 > > test_that("BJSM_binary 4", { + mydata <- data_binary + + BJSM_result <- BJSM_binary( + data = mydata, prior_dist = c("beta", "beta", "pareto"), + pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), beta_prior = c(1.6, 0.4, 3, 1), + n_MCMC_chain = 1, n.adapt = 1000, MCMC_SAMPLE = 2000, ci = 0.95, + six = TRUE, DTR = FALSE, verbose = FALSE + ) + + summary(BJSM_result) + print(summary(BJSM_result)) + print(BJSM_result) + + result = c(0.3889, 0.4371, 0.5793) + names(result) = c("pi_A", "pi_B", "pi_C") + + expect_equal(BJSM_result$pi_hat_bjsm, result, tolerance = 1e-1) + }) Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.4058130 0.1124936 0.95 0.2026503 0.6351258 trtB 0.4333047 0.1154267 0.95 0.2170795 0.6494172 trtC 0.5675258 0.1098471 0.95 0.3332968 0.7612544 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.02749176 0.1621676 0.95 -0.3443307 0.2822137 diffBC -0.13422104 0.1608945 0.95 -0.4480556 0.1747765 diffAC -0.16171280 0.1567182 0.95 -0.4497435 0.1518324 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta0A 0.9124874 0.11325485 0.95 0.6493798 1.0000000 beta0B 0.9313861 0.09104684 0.95 0.7234738 1.0000000 beta0C 0.6738987 0.28632979 0.95 0.1326391 0.9999997 beta1A 1.5392811 0.58579865 0.95 1.0002903 2.6089415 beta1B 1.5174286 0.50457402 0.95 1.0001539 2.6017015 beta1C 1.4197711 0.33969449 0.95 1.0002369 2.0926543 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.4058130 0.1124936 0.95 0.2026503 0.6351258 trtB 0.4333047 0.1154267 0.95 0.2170795 0.6494172 trtC 0.5675258 0.1098471 0.95 0.3332968 0.7612544 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.02749176 0.1621676 0.95 -0.3443307 0.2822137 diffBC -0.13422104 0.1608945 0.95 -0.4480556 0.1747765 diffAC -0.16171280 0.1567182 0.95 -0.4497435 0.1518324 Test passed 🎉 > > test_that("BJSM_binary 5", { + mydata <- data_binary + + BJSM_result2 <- BJSM_binary( + data = mydata, prior_dist = c("beta", "beta", "pareto"), + pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), beta_prior = c(1.6, 0.4, 3, 1), + n_MCMC_chain = 1, n.adapt = 10000, MCMC_SAMPLE = 60000, ci = 0.95, + six = FALSE, DTR = FALSE, verbose = FALSE + ) + + summary(BJSM_result2) + print(BJSM_result2) + print(summary(BJSM_result2)) + + result = c(0.3993, 0.4250, 0.5411) + names(result) = c("pi_A", "pi_B", "pi_C") + + expect_equal(BJSM_result2$pi_hat_bjsm, result, tolerance = 1e-1) + }) Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3975122 0.1052327 0.95 0.1936053 0.6022951 trtB 0.4245803 0.1029776 0.95 0.2237271 0.6234076 trtC 0.5384848 0.1043502 0.95 0.3305024 0.7375373 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.02706812 0.0000000 0.95 -0.3097339 0.2514984 diffBC -0.11390457 0.1327942 0.95 -0.3879147 0.1280872 diffAC -0.14097269 0.1365048 0.95 -0.4114800 0.1146740 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3975122 0.1052327 0.95 0.1936053 0.6022951 trtB 0.4245803 0.1029776 0.95 0.2237271 0.6234076 trtC 0.5384848 0.1043502 0.95 0.3305024 0.7375373 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.02706812 0.0000000 0.95 -0.3097339 0.2514984 diffBC -0.11390457 0.1327942 0.95 -0.3879147 0.1280872 diffAC -0.14097269 0.1365048 0.95 -0.4114800 0.1146740 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta0 0.9401617 0.08131102 0.95 0.7651946 1.000000 beta1 1.5853925 0.34010082 0.95 1.0000841 2.207072 Test passed 😸 > > test_that("BJSM_binary 6", { + mydata <- data_binary + + BJSM_result2 <- BJSM_binary( + data = mydata, prior_dist = c("beta", "beta", "pareto"), + pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), beta_prior = c(1.6, 0.4, 3, 1), + n_MCMC_chain = 1, n.adapt = 10000, MCMC_SAMPLE = 60000, ci = 0.95, + six = FALSE, DTR = TRUE, verbose = FALSE + ) + + summary(BJSM_result2) + print(BJSM_result2) + print(summary(BJSM_result2)) + + result = c(0.3993, 0.4250, 0.5411) + names(result) = c("pi_A", "pi_B", "pi_C") + + expect_equal(BJSM_result2$pi_hat_bjsm, result, tolerance = 1e-1) + }) Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3996746 0.1061733 0.95 0.1952006 0.6056128 trtB 0.4264299 0.1037099 0.95 0.2250715 0.6274352 trtC 0.5425323 0.1040299 0.95 0.3445470 0.7509064 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.02675532 0.0000000 0.95 -0.3090370 0.2537754 diffBC -0.11610234 0.1340480 0.95 -0.3847746 0.1391934 diffAC -0.14285766 0.1378807 0.95 -0.4232680 0.1079019 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3996746 0.1061733 0.95 0.1952006 0.6056128 trtB 0.4264299 0.1037099 0.95 0.2250715 0.6274352 trtC 0.5425323 0.1040299 0.95 0.3445470 0.7509064 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.02675532 0.0000000 0.95 -0.3090370 0.2537754 diffBC -0.11610234 0.1340480 0.95 -0.3847746 0.1391934 diffAC -0.14285766 0.1378807 0.95 -0.4232680 0.1079019 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta0 0.9437491 0.07776946 0.95 0.7761165 1.000000 beta1 1.5683280 0.33074491 0.95 1.0000098 2.167498 Expected Response Rate of Dynamic Treatment Regimens (DTR): Estimate Std. Error C.I. CI low CI high rep_AB 0.5027620 0.10630551 0.95 0.3024505 0.7162473 rep_AC 0.5678614 0.09129594 0.95 0.3910299 0.7528690 rep_BA 0.5096492 0.11043680 0.95 0.3017011 0.7286598 rep_BC 0.5860266 0.09216620 0.95 0.4099281 0.7728511 rep_CA 0.6251313 0.10512157 0.95 0.4186026 0.8224703 rep_CB 0.6364092 0.10258637 0.95 0.4416322 0.8360394 Test passed 🎉 > > test_that("BJSM_binary 7", { + mydata <- data_binary + + BJSM_result2 <- BJSM_binary( + data = mydata, prior_dist = c("beta", "beta", "pareto"), + pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), beta_prior = c(1.6, 0.4, 3, 1), + n_MCMC_chain = 1, n.adapt = 10000, MCMC_SAMPLE = 60000, ci = 0.95, + six = FALSE, DTR = TRUE, verbose = TRUE + ) + + summary(BJSM_result2) + print(BJSM_result2) + print(summary(BJSM_result2)) + + result = c(0.3993, 0.4250, 0.5411) + names(result) = c("pi_A", "pi_B", "pi_C") + + expect_equal(BJSM_result2$pi_hat_bjsm, result, tolerance = 1e-1) + }) Compiling model graph Resolving undeclared variables Allocating nodes Graph information: Observed stochastic nodes: 51 Unobserved stochastic nodes: 5 Total graph size: 147 Initializing model Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3999149 0.1057293 0.95 0.2000848 0.6093581 trtB 0.4260524 0.1023953 0.95 0.2286134 0.6257874 trtC 0.5423681 0.1026149 0.95 0.3456212 0.7442499 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.02613747 0.0000000 0.95 -0.3055287 0.2548514 diffBC -0.11631573 0.1323758 0.95 -0.3884796 0.1268930 diffAC -0.14245319 0.1371591 0.95 -0.4192554 0.1097377 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3999149 0.1057293 0.95 0.2000848 0.6093581 trtB 0.4260524 0.1023953 0.95 0.2286134 0.6257874 trtC 0.5423681 0.1026149 0.95 0.3456212 0.7442499 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.02613747 0.0000000 0.95 -0.3055287 0.2548514 diffBC -0.11631573 0.1323758 0.95 -0.3884796 0.1268930 diffAC -0.14245319 0.1371591 0.95 -0.4192554 0.1097377 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta0 0.9401216 0.08364124 0.95 0.7615311 1.000000 beta1 1.5670192 0.32745852 0.95 1.0003337 2.158699 Expected Response Rate of Dynamic Treatment Regimens (DTR): Estimate Std. Error C.I. CI low CI high rep_AB 0.5018245 0.10635712 0.95 0.3029756 0.7178411 rep_AC 0.5668050 0.09131396 0.95 0.3903311 0.7527008 rep_BA 0.5083401 0.11002130 0.95 0.3023982 0.7266505 rep_BC 0.5843277 0.09202299 0.95 0.4085911 0.7734664 rep_CA 0.6243318 0.10432157 0.95 0.4204899 0.8191172 rep_CB 0.6353389 0.10204260 0.95 0.4373505 0.8308696 Test passed 🥳 > > > test_that("BJSM_binary 7", { + mydata <- data_binary + + BJSM_result2 <- BJSM_binary( + data = mydata, prior_dist = c("beta", "beta", "pareto"), + pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), beta_prior = c(1.6, 0.4, 3, 1), + n_MCMC_chain = 1, n.adapt = 10000, MCMC_SAMPLE = 60000, ci = 0.95, + six = FALSE, DTR = FALSE, verbose = TRUE + ) + + summary(BJSM_result2) + print(BJSM_result2) + print(summary(BJSM_result2)) + + result = c(0.3993, 0.4250, 0.5411) + names(result) = c("pi_A", "pi_B", "pi_C") + + expect_equal(BJSM_result2$pi_hat_bjsm, result, tolerance = 1e-1) + }) Compiling model graph Resolving undeclared variables Allocating nodes Graph information: Observed stochastic nodes: 51 Unobserved stochastic nodes: 5 Total graph size: 147 Initializing model Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3999653 0.1055337 0.95 0.1949056 0.6035478 trtB 0.4256613 0.1031668 0.95 0.2240772 0.6232691 trtC 0.5406463 0.1040998 0.95 0.3433438 0.7476686 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.02569599 0.0000000 0.95 -0.3101081 0.2507010 diffBC -0.11498505 0.1327841 0.95 -0.3895725 0.1253296 diffAC -0.14068104 0.1373952 0.95 -0.4153164 0.1147464 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3999653 0.1055337 0.95 0.1949056 0.6035478 trtB 0.4256613 0.1031668 0.95 0.2240772 0.6232691 trtC 0.5406463 0.1040998 0.95 0.3433438 0.7476686 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.02569599 0.0000000 0.95 -0.3101081 0.2507010 diffBC -0.11498505 0.1327841 0.95 -0.3895725 0.1253296 diffAC -0.14068104 0.1373952 0.95 -0.4153164 0.1147464 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta0 0.9418336 0.07914482 0.95 0.770264 1.00000 beta1 1.5746324 0.33482256 0.95 1.001118 2.18416 Test passed 🌈 > > > test_that("BJSM_binary 8", { + + data <- data_dose + BJSM_dose_result <- BJSM_binary( + data = data_dose, prior_dist = c("beta", "gamma"), + pi_prior = c(3, 17), normal.par = c(0.2, 100), beta_prior = c(2, 2), + n_MCMC_chain = 2, n.adapt = 1000, MCMC_SAMPLE = 6000, ci = 0.95, verbose = FALSE + ) + + summary(BJSM_dose_result) + print(BJSM_dose_result) + print(summary(BJSM_dose_result)) + + result = c(0.06971, 0.40131, 0.73859) + names(result) = c("pi_P", "pi_L", "pi_H") + + expect_equal(BJSM_dose_result$pi_hat_bjsm, result, tolerance = 1e-1) + }) Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtP 0.09023371 0.03921741 0.95 0.01854941 0.1661951 trtL 0.40142433 0.06012773 0.95 0.28099935 0.5139493 trtH 0.73604173 0.07240707 0.95 0.59950866 0.8801158 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffPL -0.3111906 0.07135713 0.95 -0.4519652 -0.1754321 diffLH -0.3346174 0.07678775 0.95 -0.4815192 -0.1806079 diffPH -0.6458080 0.08234560 0.95 -0.7940808 -0.4765690 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtP 0.09023371 0.03921741 0.95 0.01854941 0.1661951 trtL 0.40142433 0.06012773 0.95 0.28099935 0.5139493 trtH 0.73604173 0.07240707 0.95 0.59950866 0.8801158 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffPL -0.3111906 0.07135713 0.95 -0.4519652 -0.1754321 diffLH -0.3346174 0.07678775 0.95 -0.4815192 -0.1806079 diffPH -0.6458080 0.08234560 0.95 -0.7940808 -0.4765690 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta[1,1] 0.9717689 0.1580690 0.95 0.66283928 1.2916862 beta[2,1] 0.8576931 0.3196139 0.95 0.24816075 1.4262533 beta[1,2] 1.0690193 0.1824296 0.95 0.69086585 1.4127943 beta[2,2] 0.9833201 0.2516689 0.95 0.48670097 1.4357676 beta[1,3] 0.3827137 0.1873112 0.95 0.05676956 0.7485723 beta[2,3] 1.0641796 0.1626098 0.95 0.75618018 1.3915202 Test passed 😀 > > > test_that("BJSM_binary 9", { + + data <- data_dose + BJSM_dose_result <- BJSM_binary( + data = data_dose, prior_dist = c("beta", "gamma"), + pi_prior = c(3, 17), normal.par = c(0.2, 100), beta_prior = c(2, 2), + n_MCMC_chain = 2, n.adapt = 1000, MCMC_SAMPLE = 6000, ci = 0.95, verbose = TRUE + ) + + summary(BJSM_dose_result) + print(BJSM_dose_result) + print(summary(BJSM_dose_result)) + + result = c(0.06971, 0.40131, 0.73859) + names(result) = c("pi_P", "pi_L", "pi_H") + + expect_equal(BJSM_dose_result$pi_hat_bjsm, result, tolerance = 1e-1) + }) Compiling model graph Resolving undeclared variables Allocating nodes Graph information: Observed stochastic nodes: 180 Unobserved stochastic nodes: 9 Total graph size: 483 Initializing model Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtP 0.08174639 0.03321452 0.95 0.03402562 0.1468745 trtL 0.39987952 0.06110762 0.95 0.28195615 0.5184603 trtH 0.73604298 0.07515375 0.95 0.59218801 0.8756874 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffPL -0.3181331 0.06848808 0.95 -0.4580147 -0.1899285 diffLH -0.3361635 0.07977623 0.95 -0.4913531 -0.1807277 diffPH -0.6542966 0.08074472 0.95 -0.8041383 -0.4969344 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtP 0.08174639 0.03321452 0.95 0.03402562 0.1468745 trtL 0.39987952 0.06110762 0.95 0.28195615 0.5184603 trtH 0.73604298 0.07515375 0.95 0.59218801 0.8756874 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffPL -0.3181331 0.06848808 0.95 -0.4580147 -0.1899285 diffLH -0.3361635 0.07977623 0.95 -0.4913531 -0.1807277 diffPH -0.6542966 0.08074472 0.95 -0.8041383 -0.4969344 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta[1,1] 0.9760166 0.1603863 0.95 0.6714362 1.2946307 beta[2,1] 0.8494435 0.3227888 0.95 0.2273472 1.4096461 beta[1,2] 1.0693059 0.1925391 0.95 0.6534925 1.4157907 beta[2,2] 0.9838772 0.2527395 0.95 0.4726775 1.4366455 beta[1,3] 0.3817047 0.1874835 0.95 0.0570745 0.7360569 beta[2,3] 1.0684634 0.1660967 0.95 0.7494427 1.3991288 Test passed 😸 > > > test_that("BJSM_c 1", { + + trialData <- trialDataMF + + BJSM_result <- BJSM_c( + data = trialData, xi_prior.mean = c(50, 50, 50), + xi_prior.sd = c(50, 50, 50), phi3_prior.sd = 20, n_MCMC_chain = 1, + n.adapt = 1000, MCMC_SAMPLE = 5000, BURIN.IN = 1000, ci = 0.95, n.digits = 5, verbose = FALSE + ) + + summary(BJSM_result) + print(BJSM_result) + print(summary(BJSM_result)) + + result = 51.12 + names(result) = c("xi_[1]") + + expect_equal(BJSM_result$mean_estimate[c("xi_[1]")], result, tolerance = 1e-1) + }) Treatment Effect Estimation: Estimate CI CI_low CI_high trtA 51.10147 0.95 47.12535 54.84401 trtB 61.98519 0.95 58.34192 65.68894 trtC 69.01625 0.95 65.23133 72.64966 Parameter Estimation: Estimate CI CI_low CI_high V1[1,1] 111.71583 0.95 5.765699e+01 168.1402348 V1[2,1] 85.67891 0.95 4.440385e+01 133.4116999 V1[1,2] 85.67891 0.95 4.440385e+01 133.4116999 V1[2,2] 77.73816 0.95 4.166010e+01 119.1648265 V2[1,1] 123.02248 0.95 6.524563e+01 195.3509020 V2[2,1] 28.94240 0.95 -1.796188e+01 78.8121532 V2[1,2] 28.94240 0.95 -1.796188e+01 78.8121532 V2[2,2] 105.97317 0.95 5.434035e+01 166.1085113 phi1 0.17977 0.95 1.629469e-05 0.3726021 phi3 4.00329 0.95 2.726449e+00 5.2880431 xi_[A] 51.10147 0.95 4.712535e+01 54.8440074 xi_[B] 61.98519 0.95 5.834192e+01 65.6889366 xi_[C] 69.01625 0.95 6.523133e+01 72.6496585 Test passed 😀 > > test_that("BJSM_c 2", { + + trialData <- trialDataMF + + BJSM_result <- BJSM_c( + data = trialData, xi_prior.mean = c(50, 50, 50), + xi_prior.sd = c(50, 50, 50), phi3_prior.sd = 20, n_MCMC_chain = 1, + n.adapt = 1000, MCMC_SAMPLE = 5000, BURIN.IN = 1000, ci = 0.95, n.digits = 5, verbose = TRUE + ) + + summary(BJSM_result) + print(BJSM_result) + print(summary(BJSM_result)) + + result = 51.12 + names(result) = c("xi_[1]") + + expect_equal(BJSM_result$mean_estimate[c("xi_[1]")], result, tolerance = 1e-1) + }) Compiling model graph Resolving undeclared variables Allocating nodes Graph information: Observed stochastic nodes: 60 Unobserved stochastic nodes: 7 Total graph size: 401 Initializing model Treatment Effect Estimation: Estimate CI CI_low CI_high trtA 51.11241 0.95 47.46294 55.22281 trtB 62.01998 0.95 58.18491 65.87051 trtC 68.99409 0.95 65.33105 72.61362 Parameter Estimation: Estimate CI CI_low CI_high V1[1,1] 112.04144 0.95 6.133407e+01 168.8429696 V1[2,1] 86.06011 0.95 4.471507e+01 130.8699859 V1[1,2] 86.06011 0.95 4.471507e+01 130.8699859 V1[2,2] 78.16127 0.95 4.175297e+01 117.9230068 V2[1,1] 122.70487 0.95 6.526178e+01 194.5991377 V2[2,1] 29.00467 0.95 -1.644779e+01 79.1468972 V2[1,2] 29.00467 0.95 -1.644779e+01 79.1468972 V2[2,2] 107.37669 0.95 5.471066e+01 172.5163289 phi1 0.17879 0.95 1.595297e-04 0.3755844 phi3 4.00735 0.95 2.690492e+00 5.2966893 xi_[A] 51.11241 0.95 4.746294e+01 55.2228102 xi_[B] 62.01998 0.95 5.818491e+01 65.8705144 xi_[C] 68.99409 0.95 6.533105e+01 72.6136235 Test passed 😀 > > test_that("group_seq 1", { + + mydata <- groupseqDATA_look1 + + result1 <- group_seq( + data = mydata, interim = TRUE, drop_threshold_pair = c(0.5, 0.4), + prior_dist = c("beta", "beta", "pareto"), pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), + beta_prior = c(1.6, 0.4, 3, 1), MCMC_SAMPLE = 6000, n.adapt = 1000, n_MCMC_chain = 1 + ) + + summary(result1) + print(result1) + print(summary(result1)) + + expect_equal(result1$dropped_arm, 1, tolerance = 1e-1) + }) Arm A is dropped Arm A is dropped Iterations = 1101:7100 Thinning interval = 1 Number of chains = 1 Sample size per chain = 6000 1. Empirical mean and standard deviation for each variable, plus standard error of the mean: Mean SD Naive SE Time-series SE beta[1] 0.7704 0.21010 0.002712 0.006159 beta[2] 1.2432 0.26489 0.003420 0.008406 beta[3] 0.6808 0.28126 0.003631 0.008112 beta[4] 1.3488 0.32553 0.004203 0.009168 beta[5] 0.8489 0.18391 0.002374 0.006564 beta[6] 1.2118 0.21294 0.002749 0.006693 pi[1] 0.2869 0.08957 0.001156 0.001629 pi[2] 0.4206 0.08482 0.001095 0.001781 pi[3] 0.5727 0.11413 0.001473 0.002384 2. Quantiles for each variable: 2.5% 25% 50% 75% 97.5% beta[1] 0.29634 0.6268 0.8222 0.9588 0.9997 beta[2] 1.00587 1.0642 1.1618 1.3263 1.9755 beta[3] 0.09824 0.4599 0.7439 0.9452 0.9998 beta[4] 1.01032 1.1109 1.2579 1.4880 2.1910 beta[5] 0.35345 0.7640 0.9269 0.9893 1.0000 beta[6] 1.00631 1.0637 1.1474 1.2926 1.7735 pi[1] 0.13151 0.2220 0.2808 0.3448 0.4762 pi[2] 0.26144 0.3607 0.4194 0.4773 0.5905 pi[3] 0.34764 0.4936 0.5745 0.6538 0.7876 Test passed 😀 > > test_that("group_seq 2", { + + mydata <- groupseqDATA_look1 + + result1 <- group_seq( + data = mydata, interim = TRUE, drop_threshold_pair = c(0.5, 0.4), + prior_dist = c("beta", "beta", "pareto"), pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), + beta_prior = c(1.6, 0.4, 3, 1), MCMC_SAMPLE = 6000, n.adapt = 1000, n_MCMC_chain = 1, + DTR = TRUE, verbose = TRUE + ) + + summary(result1) + print(result1) + print(summary(result1)) + + expect_equal(result1$dropped_arm, 1, tolerance = 1e-1) + }) Compiling model graph Resolving undeclared variables Allocating nodes Graph information: Observed stochastic nodes: 76 Unobserved stochastic nodes: 9 Total graph size: 212 Initializing model Arm A is dropped Arm A is dropped Iterations = 1101:7100 Thinning interval = 1 Number of chains = 1 Sample size per chain = 6000 1. Empirical mean and standard deviation for each variable, plus standard error of the mean: Mean SD Naive SE Time-series SE beta[1] 0.7730 0.20603 0.002660 0.005760 beta[2] 1.2417 0.26432 0.003412 0.008964 beta[3] 0.6903 0.27307 0.003525 0.008155 beta[4] 1.3349 0.29574 0.003818 0.007914 beta[5] 0.8414 0.18992 0.002452 0.007792 beta[6] 1.2249 0.21890 0.002826 0.006238 pi[1] 0.2885 0.09119 0.001177 0.001684 pi[2] 0.4240 0.08276 0.001068 0.001617 pi[3] 0.5653 0.11407 0.001473 0.002328 2. Quantiles for each variable: 2.5% 25% 50% 75% 97.5% beta[1] 0.2942 0.6367 0.8286 0.9535 0.9997 beta[2] 1.0064 1.0621 1.1573 1.3213 1.9623 beta[3] 0.1137 0.4798 0.7533 0.9429 0.9998 beta[4] 1.0109 1.1128 1.2576 1.4827 2.0690 beta[5] 0.3334 0.7562 0.9205 0.9884 1.0000 beta[6] 1.0052 1.0668 1.1632 1.3094 1.8034 pi[1] 0.1315 0.2232 0.2817 0.3468 0.4886 pi[2] 0.2707 0.3653 0.4221 0.4808 0.5899 pi[3] 0.3414 0.4856 0.5667 0.6451 0.7819 Test passed 🥇 > > test_that("group_seq 3", { + + mydata <- groupseqDATA_look1 + + result1 <- group_seq( + data = mydata, interim = TRUE, drop_threshold_pair = c(0.5, 0.4), + prior_dist = c("beta", "beta", "pareto"), pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), + beta_prior = c(1.6, 0.4, 3, 1), MCMC_SAMPLE = 6000, n.adapt = 1000, n_MCMC_chain = 1, + DTR = FALSE, verbose = TRUE + ) + + summary(result1) + print(result1) + print(summary(result1)) + + expect_equal(result1$dropped_arm, 1, tolerance = 1e-1) + }) Compiling model graph Resolving undeclared variables Allocating nodes Graph information: Observed stochastic nodes: 76 Unobserved stochastic nodes: 9 Total graph size: 212 Initializing model Arm A is dropped Arm A is dropped Iterations = 1101:7100 Thinning interval = 1 Number of chains = 1 Sample size per chain = 6000 1. Empirical mean and standard deviation for each variable, plus standard error of the mean: Mean SD Naive SE Time-series SE beta[1] 0.7758 0.20821 0.002688 0.005688 beta[2] 1.2491 0.26768 0.003456 0.009446 beta[3] 0.6789 0.28596 0.003692 0.008549 beta[4] 1.3392 0.30764 0.003972 0.008337 beta[5] 0.8172 0.20322 0.002624 0.007698 beta[6] 1.2123 0.21095 0.002723 0.006937 pi[1] 0.2906 0.09004 0.001162 0.001916 pi[2] 0.4225 0.08462 0.001092 0.002135 pi[3] 0.5701 0.11162 0.001441 0.002471 2. Quantiles for each variable: 2.5% 25% 50% 75% 97.5% beta[1] 0.29428 0.6356 0.8308 0.9606 0.9997 beta[2] 1.00614 1.0662 1.1678 1.3378 1.9716 beta[3] 0.09058 0.4494 0.7454 0.9504 0.9998 beta[4] 1.01069 1.1103 1.2516 1.4809 2.1359 beta[5] 0.29702 0.7096 0.8979 0.9800 0.9999 beta[6] 1.00546 1.0608 1.1503 1.2953 1.7586 pi[1] 0.13395 0.2254 0.2848 0.3492 0.4829 pi[2] 0.26340 0.3645 0.4197 0.4808 0.5918 pi[3] 0.35186 0.4927 0.5715 0.6494 0.7842 Test passed 🥇 > > > test_that("group_seq 4", { + + mydata <- groupseqDATA_look1 + + result1 <- group_seq( + data = mydata, interim = TRUE, drop_threshold_pair = c(0.5, 0.4), + prior_dist = c("beta", "beta", "pareto"), pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), + beta_prior = c(1.6, 0.4, 3, 1), MCMC_SAMPLE = 6000, n.adapt = 1000, n_MCMC_chain = 1, + DTR = FALSE, verbose = FALSE + ) + + summary(result1) + print(result1) + print(summary(result1)) + + expect_equal(result1$dropped_arm, 1, tolerance = 1e-1) + }) Arm A is dropped Arm A is dropped Iterations = 1101:7100 Thinning interval = 1 Number of chains = 1 Sample size per chain = 6000 1. Empirical mean and standard deviation for each variable, plus standard error of the mean: Mean SD Naive SE Time-series SE beta[1] 0.7791 0.20697 0.002672 0.006243 beta[2] 1.2521 0.29182 0.003767 0.010291 beta[3] 0.6849 0.27538 0.003555 0.007585 beta[4] 1.3438 0.32159 0.004152 0.009171 beta[5] 0.8394 0.18903 0.002440 0.006975 beta[6] 1.2157 0.21023 0.002714 0.006023 pi[1] 0.2884 0.08721 0.001126 0.001634 pi[2] 0.4244 0.08622 0.001113 0.001980 pi[3] 0.5694 0.11399 0.001472 0.002658 2. Quantiles for each variable: 2.5% 25% 50% 75% 97.5% beta[1] 0.3052 0.6419 0.8377 0.9608 0.9999 beta[2] 1.0063 1.0656 1.1609 1.3291 2.0060 beta[3] 0.1016 0.4802 0.7526 0.9375 0.9993 beta[4] 1.0103 1.1096 1.2565 1.4788 2.2260 beta[5] 0.3285 0.7519 0.9177 0.9870 0.9999 beta[6] 1.0065 1.0640 1.1534 1.2986 1.7578 pi[1] 0.1351 0.2253 0.2823 0.3454 0.4724 pi[2] 0.2590 0.3652 0.4237 0.4830 0.5998 pi[3] 0.3383 0.4927 0.5698 0.6495 0.7831 Test passed 🌈 > > test_that("group_seq 5", { + + mydata <- groupseqDATA_full + result2 <- group_seq( + data = mydata, interim = FALSE, prior_dist = c("beta", "beta", "pareto"), + pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), + beta_prior = c(1.6, 0.4, 3, 1), MCMC_SAMPLE = 6000, n.adapt = 1000, + n_MCMC_chain = 1, ci = 0.95, DTR = TRUE + ) + + summary(result2) + print(result2) + print(summary(result2)) + + result = c(0.3014, 0.4729, 0.6761) + names(result) = c("pi_A", "pi_B", "pi_C") + + expect_equal(result2$pi_hat_bjsm, result, tolerance = 1e-1) + }) Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3004007 0.04896475 0.95 0.2052492 0.3930625 trtB 0.4719660 0.03967735 0.95 0.3935427 0.5481915 trtC 0.6768943 0.06230622 0.95 0.5498037 0.7788861 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.1715653 0.06337608 0.95 -0.3032311 -0.05760492 diffBC -0.2049282 0.07316676 0.95 -0.3451819 -0.05707470 diffAC -0.3764935 0.07741287 0.95 -0.5262982 -0.21662522 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3004007 0.04896475 0.95 0.2052492 0.3930625 trtB 0.4719660 0.03967735 0.95 0.3935427 0.5481915 trtC 0.6768943 0.06230622 0.95 0.5498037 0.7788861 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.1715653 0.06337608 0.95 -0.3032311 -0.05760492 diffBC -0.2049282 0.07316676 0.95 -0.3451819 -0.05707470 diffAC -0.3764935 0.07741287 0.95 -0.5262982 -0.21662522 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta0A 0.8698008 0.1108828 0.95 0.6565287 0.9999996 beta0B 0.7224175 0.1168690 0.95 0.5416897 0.9999985 beta0C 0.8722277 0.1262189 0.95 0.6214516 1.0000000 beta1A 1.4734435 0.3791163 0.95 1.0002778 2.2056185 beta1B 1.3696869 0.1711929 0.95 1.0465479 1.6934235 beta1C 1.4728749 0.1815225 0.95 1.2188761 1.7934444 Test passed 🌈 > > test_that("group_seq 6", { + + mydata <- groupseqDATA_full + result2 <- group_seq( + data = mydata, interim = FALSE, prior_dist = c("beta", "beta", "pareto"), + pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), + beta_prior = c(1.6, 0.4, 3, 1), MCMC_SAMPLE = 6000, n.adapt = 1000, + n_MCMC_chain = 1, ci = 0.95, DTR = TRUE, verbose = TRUE + ) + + summary(result2) + print(result2) + print(summary(result2)) + + result = c(0.3014, 0.4729, 0.6761) + names(result) = c("pi_A", "pi_B", "pi_C") + + expect_equal(result2$pi_hat_bjsm, result, tolerance = 1e-1) + }) Compiling model graph Resolving undeclared variables Allocating nodes Graph information: Observed stochastic nodes: 600 Unobserved stochastic nodes: 9 Total graph size: 1530 Initializing model Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3031653 0.04878024 0.95 0.2114356 0.4033363 trtB 0.4731038 0.03952600 0.95 0.3941379 0.5450163 trtC 0.6801615 0.04516671 0.95 0.5813479 0.7617856 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.1699385 0.06211707 0.95 -0.2904261 -0.04737888 diffBC -0.2070577 0.05993687 0.95 -0.3216838 -0.08382062 diffAC -0.3769962 0.06485394 0.95 -0.5042247 -0.24694869 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3031653 0.04878024 0.95 0.2114356 0.4033363 trtB 0.4731038 0.03952600 0.95 0.3941379 0.5450163 trtC 0.6801615 0.04516671 0.95 0.5813479 0.7617856 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.1699385 0.06211707 0.95 -0.2904261 -0.04737888 diffBC -0.2070577 0.05993687 0.95 -0.3216838 -0.08382062 diffAC -0.3769962 0.06485394 0.95 -0.5042247 -0.24694869 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta0A 0.8686489 0.1128570 0.95 0.6547354 1.0000000 beta0B 0.7159427 0.1167624 0.95 0.5355994 0.9999987 beta0C 0.8735725 0.1240449 0.95 0.6233315 1.0000000 beta1A 1.4605217 0.3478520 0.95 1.0001348 2.1294987 beta1B 1.3643985 0.1733543 0.95 1.0420418 1.6982488 beta1C 1.4570138 0.1045088 0.95 1.2778766 1.6892036 Test passed 🌈 > > test_that("group_seq 7", { + + mydata <- groupseqDATA_full + result2 <- group_seq( + data = mydata, interim = FALSE, prior_dist = c("beta", "beta", "pareto"), + pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), + beta_prior = c(1.6, 0.4, 3, 1), MCMC_SAMPLE = 6000, n.adapt = 1000, + n_MCMC_chain = 1, ci = 0.95, DTR = FALSE, verbose = TRUE + ) + + summary(result2) + print(result2) + print(summary(result2)) + + result = c(0.3014, 0.4729, 0.6761) + names(result) = c("pi_A", "pi_B", "pi_C") + + expect_equal(result2$pi_hat_bjsm, result, tolerance = 1e-1) + }) Compiling model graph Resolving undeclared variables Allocating nodes Graph information: Observed stochastic nodes: 600 Unobserved stochastic nodes: 9 Total graph size: 1530 Initializing model Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3022460 0.04811129 0.95 0.2077872 0.3956387 trtB 0.4738881 0.03868484 0.95 0.3960460 0.5456243 trtC 0.6917177 0.04030091 0.95 0.6130924 0.7634903 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.1716421 0.06131887 0.95 -0.2874664 -0.04668897 diffBC -0.2178297 0.05449010 0.95 -0.3229718 -0.11033660 diffAC -0.3894717 0.06083994 0.95 -0.5067164 -0.26886287 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3022460 0.04811129 0.95 0.2077872 0.3956387 trtB 0.4738881 0.03868484 0.95 0.3960460 0.5456243 trtC 0.6917177 0.04030091 0.95 0.6130924 0.7634903 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.1716421 0.06131887 0.95 -0.2874664 -0.04668897 diffBC -0.2178297 0.05449010 0.95 -0.3229718 -0.11033660 diffAC -0.3894717 0.06083994 0.95 -0.5067164 -0.26886287 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta0A 0.8684907 0.10992135 0.95 0.6602683 0.9999998 beta0B 0.7017752 0.10831127 0.95 0.5064867 0.9380221 beta0C 0.8689515 0.12748934 0.95 0.6126484 1.0000000 beta1A 1.4585830 0.35629997 0.95 1.0001409 2.1457480 beta1B 1.3589935 0.16636761 0.95 1.0340836 1.6596761 beta1C 1.4302345 0.08763502 0.95 1.2792468 1.6045628 Test passed 🎊 > > > test_that("group_seq 8", { + + mydata <- groupseqDATA_full + result2 <- group_seq( + data = mydata, interim = FALSE, prior_dist = c("beta", "beta", "pareto"), + pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), + beta_prior = c(1.6, 0.4, 3, 1), MCMC_SAMPLE = 6000, n.adapt = 1000, + n_MCMC_chain = 1, ci = 0.95, DTR = FALSE, verbose = FALSE + ) + + summary(result2) + print(result2) + print(summary(result2)) + + result = c(0.3014, 0.4729, 0.6761) + names(result) = c("pi_A", "pi_B", "pi_C") + + expect_equal(result2$pi_hat_bjsm, result, tolerance = 1e-1) + }) Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3045159 0.04939488 0.95 0.2038335 0.3965225 trtB 0.4742970 0.03897507 0.95 0.3956598 0.5488982 trtC 0.6936812 0.03171714 0.95 0.6381959 0.7568955 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.1697811 0.06262016 0.95 -0.2930931 -0.05058895 diffBC -0.2193842 0.04971323 0.95 -0.3206161 -0.12612009 diffAC -0.3891653 0.05669605 0.95 -0.4974523 -0.27549808 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.3045159 0.04939488 0.95 0.2038335 0.3965225 trtB 0.4742970 0.03897507 0.95 0.3956598 0.5488982 trtC 0.6936812 0.03171714 0.95 0.6381959 0.7568955 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB -0.1697811 0.06262016 0.95 -0.2930931 -0.05058895 diffBC -0.2193842 0.04971323 0.95 -0.3206161 -0.12612009 diffAC -0.3891653 0.05669605 0.95 -0.4974523 -0.27549808 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta0A 0.8634104 0.11291861 0.95 0.6521321 1.0000000 beta0B 0.6986680 0.10750442 0.95 0.4890003 0.9183587 beta0C 0.8734600 0.12622399 0.95 0.6211931 1.0000000 beta1A 1.4518278 0.34484565 0.95 1.0000086 2.0991723 beta1B 1.3586934 0.17133924 0.95 1.0185433 1.6635012 beta1C 1.4244984 0.06678254 0.95 1.3044733 1.5539293 Test passed 🌈 > > test_that("group_seq 9", { + + mydata <- groupseqDATA_look1 + mydata$trt.1st = ifelse(mydata$trt.1st == 1, 4, mydata$trt.1st) + mydata$trt.1st = ifelse(mydata$trt.1st == 2, 1, mydata$trt.1st) + mydata$trt.1st = ifelse(mydata$trt.1st == 4, 2, mydata$trt.1st) + + mydata$trt.2nd = ifelse(mydata$trt.2nd == 1, 4, mydata$trt.2nd) + mydata$trt.2nd = ifelse(mydata$trt.2nd == 2, 1, mydata$trt.2nd) + mydata$trt.2nd = ifelse(mydata$trt.2nd == 4, 2, mydata$trt.2nd) + + result1 <- group_seq( + data = mydata, interim = TRUE, drop_threshold_pair = c(0.5, 0.4), + prior_dist = c("beta", "beta", "pareto"), pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), + beta_prior = c(1.6, 0.4, 3, 1), MCMC_SAMPLE = 6000, n.adapt = 1000, n_MCMC_chain = 1 + ) + + summary(result1) + print(result1) + print(summary(result1)) + + expect_equal(result1$dropped_arm, 2, tolerance = 1e-1) + }) Arm B is dropped Arm B is dropped Iterations = 1101:7100 Thinning interval = 1 Number of chains = 1 Sample size per chain = 6000 1. Empirical mean and standard deviation for each variable, plus standard error of the mean: Mean SD Naive SE Time-series SE beta[1] 0.6864 0.27895 0.003601 0.007901 beta[2] 1.3515 0.32530 0.004200 0.009421 beta[3] 0.7620 0.21532 0.002780 0.006095 beta[4] 1.2416 0.26369 0.003404 0.009496 beta[5] 0.8280 0.19795 0.002556 0.007079 beta[6] 1.2107 0.20382 0.002631 0.006578 pi[1] 0.4211 0.08445 0.001090 0.001777 pi[2] 0.2865 0.08835 0.001141 0.001723 pi[3] 0.5714 0.11225 0.001449 0.002507 2. Quantiles for each variable: 2.5% 25% 50% 75% 97.5% beta[1] 0.1038 0.4756 0.7533 0.9475 0.9996 beta[2] 1.0103 1.1114 1.2615 1.4947 2.2165 beta[3] 0.2781 0.6089 0.8150 0.9562 0.9998 beta[4] 1.0054 1.0627 1.1572 1.3303 1.9596 beta[5] 0.3052 0.7317 0.9095 0.9836 0.9998 beta[6] 1.0058 1.0618 1.1516 1.2940 1.7295 pi[1] 0.2623 0.3632 0.4203 0.4772 0.5931 pi[2] 0.1295 0.2227 0.2812 0.3456 0.4805 pi[3] 0.3492 0.4948 0.5730 0.6494 0.7854 Test passed 🥳 > > test_that("group_seq 10", { + + mydata <- groupseqDATA_look1 + mydata$trt.1st = ifelse(mydata$trt.1st == 1, 4, mydata$trt.1st) + mydata$trt.1st = ifelse(mydata$trt.1st == 3, 1, mydata$trt.1st) + mydata$trt.1st = ifelse(mydata$trt.1st == 4, 3, mydata$trt.1st) + + result1 <- group_seq( + data = mydata, interim = TRUE, drop_threshold_pair = c(0.5, 0.4), + prior_dist = c("beta", "beta", "pareto"), pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), + beta_prior = c(1.6, 0.4, 3, 1), MCMC_SAMPLE = 6000, n.adapt = 1000, n_MCMC_chain = 1 + ) + + summary(result1) + print(result1) + print(summary(result1)) + + expect_equal(result1$dropped_arm, 3, tolerance = 1e-1) + }) Arm C is dropped Arm C is dropped Iterations = 1101:7100 Thinning interval = 1 Number of chains = 1 Sample size per chain = 6000 1. Empirical mean and standard deviation for each variable, plus standard error of the mean: Mean SD Naive SE Time-series SE beta[1] 0.8221 0.20423 0.002637 0.007406 beta[2] 1.3887 0.40154 0.005184 0.013102 beta[3] 0.6866 0.27827 0.003593 0.007731 beta[4] 1.3447 0.31615 0.004082 0.008505 beta[5] 0.8066 0.20205 0.002609 0.006533 beta[6] 1.1615 0.16987 0.002193 0.005501 pi[1] 0.4373 0.10600 0.001368 0.001949 pi[2] 0.4219 0.08290 0.001070 0.001722 pi[3] 0.3848 0.09946 0.001284 0.002016 2. Quantiles for each variable: 2.5% 25% 50% 75% 97.5% beta[1] 0.2946 0.7169 0.9045 0.9844 0.9999 beta[2] 1.0106 1.1119 1.2679 1.5350 2.4474 beta[3] 0.1018 0.4739 0.7496 0.9509 0.9999 beta[4] 1.0086 1.1113 1.2610 1.4795 2.1607 beta[5] 0.2979 0.6918 0.8783 0.9747 0.9997 beta[6] 1.0038 1.0449 1.1079 1.2198 1.6040 pi[1] 0.2395 0.3632 0.4359 0.5101 0.6506 pi[2] 0.2663 0.3630 0.4207 0.4785 0.5838 pi[3] 0.1986 0.3158 0.3802 0.4520 0.5916 Test passed 😸 > > > test_that("group_seq 11", { + + mydata <- groupseqDATA_full + mydata$trt.1st = ifelse(mydata$trt.1st == 1, 4, mydata$trt.1st) + mydata$trt.1st = ifelse(mydata$trt.1st == 3, 1, mydata$trt.1st) + mydata$trt.1st = ifelse(mydata$trt.1st == 4, 3, mydata$trt.1st) + + mydata$trt.2nd = ifelse(mydata$trt.2nd == 1, 4, mydata$trt.2nd) + mydata$trt.2nd = ifelse(mydata$trt.2nd == 3, 1, mydata$trt.2nd) + mydata$trt.2nd = ifelse(mydata$trt.2nd == 4, 3, mydata$trt.2nd) + + result2 <- group_seq( + data = mydata, interim = FALSE, prior_dist = c("beta", "beta", "pareto"), + pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), + beta_prior = c(1.6, 0.4, 3, 1), MCMC_SAMPLE = 6000, n.adapt = 1000, + n_MCMC_chain = 1, ci = 0.95, DTR = FALSE, verbose = FALSE + ) + + summary(result2) + print(result2) + print(summary(result2)) + + result = c(0.6878912, 0.4730337, 0.3022561) + names(result) = c("pi_A", "pi_B", "pi_C") + + expect_equal(result2$pi_hat_bjsm, result, tolerance = 1e-1) + }) Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.6554713 0.05278629 0.95 0.5363848 0.7469150 trtB 0.4709650 0.03975750 0.95 0.3931664 0.5473071 trtC 0.3005643 0.04889250 0.95 0.2108641 0.4012289 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB 0.1845062 0.06511417 0.95 0.05246036 0.3136093 diffBC 0.1704007 0.06259635 0.95 0.04948306 0.2930441 diffAC 0.3549070 0.06890414 0.95 0.21677117 0.4820316 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.6554713 0.05278629 0.95 0.5363848 0.7469150 trtB 0.4709650 0.03975750 0.95 0.3931664 0.5473071 trtC 0.3005643 0.04889250 0.95 0.2108641 0.4012289 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB 0.1845062 0.06511417 0.95 0.05246036 0.3136093 diffBC 0.1704007 0.06259635 0.95 0.04948306 0.2930441 diffAC 0.3549070 0.06890414 0.95 0.21677117 0.4820316 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta0A 0.8663685 0.1278593 0.95 0.6139343 1.000000 beta0B 0.7431730 0.1225905 0.95 0.5512876 1.000000 beta0C 0.8844370 0.1064875 0.95 0.6772841 1.000000 beta1A 1.5164605 0.1354673 0.95 1.3011063 1.827541 beta1B 1.3751789 0.1765676 0.95 1.0531781 1.717464 beta1C 1.4713616 0.3572264 0.95 1.0001121 2.158850 Test passed 🥳 > > > test_that("group_seq 12", { + + mydata <- groupseqDATA_full + mydata$trt.1st = ifelse(mydata$trt.1st == 1, 4, mydata$trt.1st) + mydata$trt.1st = ifelse(mydata$trt.1st == 2, 1, mydata$trt.1st) + mydata$trt.1st = ifelse(mydata$trt.1st == 4, 2, mydata$trt.1st) + + mydata$trt.2nd = ifelse(mydata$trt.2nd == 1, 4, mydata$trt.2nd) + mydata$trt.2nd = ifelse(mydata$trt.2nd == 2, 1, mydata$trt.2nd) + mydata$trt.2nd = ifelse(mydata$trt.2nd == 4, 2, mydata$trt.2nd) + + result2 <- group_seq( + data = mydata, interim = FALSE, prior_dist = c("beta", "beta", "pareto"), + pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), + beta_prior = c(1.6, 0.4, 3, 1), MCMC_SAMPLE = 6000, n.adapt = 1000, + n_MCMC_chain = 1, ci = 0.95, DTR = FALSE, verbose = FALSE + ) + + summary(result2) + print(result2) + print(summary(result2)) + + result = c(0.4727878, 0.3003522, 0.6828518) + names(result) = c("pi_A", "pi_B", "pi_C") + + expect_equal(result2$pi_hat_bjsm, result, tolerance = 1e-1) + }) Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.4728833 0.03911499 0.95 0.3954623 0.5480344 trtB 0.3018066 0.04812403 0.95 0.2092822 0.3961399 trtC 0.6755664 0.04345149 0.95 0.5927503 0.7616049 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB 0.1710767 0.06087229 0.95 0.04735699 0.28605490 diffBC -0.3737598 0.06351461 0.95 -0.49791216 -0.25154013 diffAC -0.2026831 0.05686630 0.95 -0.30956865 -0.09162712 Treatment Effects Estimate: Estimate Std. Error C.I. CI low CI high trtA 0.4728833 0.03911499 0.95 0.3954623 0.5480344 trtB 0.3018066 0.04812403 0.95 0.2092822 0.3961399 trtC 0.6755664 0.04345149 0.95 0.5927503 0.7616049 Differences between Treatments: Estimate Std.Error C.I. CI low CI high diffAB 0.1710767 0.06087229 0.95 0.04735699 0.28605490 diffBC -0.3737598 0.06351461 0.95 -0.49791216 -0.25154013 diffAC -0.2026831 0.05686630 0.95 -0.30956865 -0.09162712 Linkage Parameter Estimate: Estimate Std. Error C.I. CI low CI high beta0A 0.7222402 0.11328851 0.95 0.5080574 0.9539981 beta0B 0.8791444 0.11004821 0.95 0.6657694 0.9999991 beta0C 0.8715516 0.12582241 0.95 0.6241491 1.0000000 beta1A 1.3616397 0.17083667 0.95 1.0328291 1.6832299 beta1B 1.4711051 0.36020173 0.95 1.0001405 2.1413472 beta1C 1.4665219 0.09769318 0.95 1.2947396 1.6709349 Test passed 🌈 > > test_that("LPJSM_binary 3", { + + data <- data_binary + + LPJSM_result <- LPJSM_binary(data = data, six = TRUE, DTR = TRUE) + + summary(LPJSM_result) + print(LPJSM_result) + print(summary(LPJSM_result)) + + result = c(0.2966, 0.3736, 0.4298) + names(result) = c("alphaA", "alphaB", "alphaC") + + expect_equal(LPJSM_result$pi_hat, result, tolerance = 1e-1) + }) Treatment Effect Estimate Estimate Std. Error trtA 0.2965635 0.1195242 trtB 0.3736200 0.1271434 trtC 0.4298165 0.1304802 GEE output: Call: geepack::geeglm(formula = Y ~ alphaA + alphaB + alphaC + gamma1A + gamma2A + gamma1B + gamma2B + gamma1C + gamma2C - 1, family = poisson(link = "log"), data = geedata, id = ptid, corstr = "independence") Coefficients: Estimate Std.err Wald Pr(>|W|) alphaA -1.2155 0.4030 9.096 0.00256 ** alphaB -0.9845 0.3403 8.370 0.00381 ** alphaC -0.8444 0.3036 7.737 0.00541 ** gamma1A 1.2155 0.4030 9.096 0.00256 ** gamma2A 0.7029 0.3664 3.680 0.05508 . gamma1B 0.9845 0.3403 8.370 0.00381 ** gamma2B 0.8271 0.3497 5.594 0.01803 * gamma1C 0.8444 0.3036 7.737 0.00541 ** gamma2C -42.2449 0.6085 4820.409 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation structure = independence Estimated Scale Parameters: Estimate Std.err (Intercept) 0.4096 0.1259 Number of clusters: 30 Maximum cluster size: 2 Treatment Effect Estimate: Estimate Std. Error trtA 0.2966 0.1195 trtB 0.3736 0.1271 trtC 0.4298 0.1305 Expected Response Rate of Dynamic Treatment Regimens (DTR): NULL Test passed 😀 > > test_that("LPJSM_binary 4", { + + data <- data_binary + + LPJSM_result <- LPJSM_binary(data = data, six = FALSE, DTR = TRUE) + + summary(LPJSM_result) + print(LPJSM_result) + print(summary(LPJSM_result)) + + result = c(0.2966, 0.3736, 0.4298) + names(result) = c("alphaA", "alphaB", "alphaC") + + expect_equal(LPJSM_result$pi_hat, result, tolerance = 1e-1) + }) Treatment Effect Estimate Estimate Std. Error trtA 0.3191 0.1080 trtB 0.3386 0.1076 trtC 0.4424 0.1085 GEE output: Call: geepack::geeglm(formula = Y ~ alphaA + alphaB + alphaC + gamma1 + gamma2 - 1, family = poisson(link = "log"), data = geedata, id = ptid, corstr = "independence") Coefficients: Estimate Std.err Wald Pr(>|W|) alphaA -1.142 0.339 11.38 0.00074 *** alphaB -1.083 0.318 11.62 0.00065 *** alphaC -0.816 0.245 11.06 0.00088 *** gamma1 0.953 0.240 15.76 7.2e-05 *** gamma2 0.524 0.314 2.78 0.09552 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation structure = independence Estimated Scale Parameters: Estimate Std.err (Intercept) 0.465 0.131 Number of clusters: 30 Maximum cluster size: 2 Treatment Effect Estimate: Estimate Std. Error trtA 0.319 0.108 trtB 0.339 0.108 trtC 0.442 0.109 Expected Response Rate of Dynamic Treatment Regimens (DTR): NULL Test passed 😸 > > test_that("LPJSM_binary 5", { + + data <- data_binary + + LPJSM_result <- LPJSM_binary(data = data, six = FALSE, DTR = FALSE) + + summary(LPJSM_result) + print(LPJSM_result) + print(summary(LPJSM_result)) + + result = c(0.2966, 0.3736, 0.4298) + names(result) = c("alphaA", "alphaB", "alphaC") + + expect_equal(LPJSM_result$pi_hat, result, tolerance = 1e-1) + }) Treatment Effect Estimate Estimate Std. Error trtA 0.319 0.108 trtB 0.339 0.108 trtC 0.442 0.109 GEE output: Call: geepack::geeglm(formula = Y ~ alphaA + alphaB + alphaC + gamma1 + gamma2 - 1, family = poisson(link = "log"), data = geedata, id = ptid, corstr = "independence") Coefficients: Estimate Std.err Wald Pr(>|W|) alphaA -1.142 0.339 11.38 0.00074 *** alphaB -1.083 0.318 11.62 0.00065 *** alphaC -0.816 0.245 11.06 0.00088 *** gamma1 0.953 0.240 15.76 7.2e-05 *** gamma2 0.524 0.314 2.78 0.09552 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation structure = independence Estimated Scale Parameters: Estimate Std.err (Intercept) 0.465 0.131 Number of clusters: 30 Maximum cluster size: 2 Treatment Effect Estimate: Estimate Std. Error trtA 0.319 0.108 trtB 0.339 0.108 trtC 0.442 0.109 Expected Response Rate of Dynamic Treatment Regimens (DTR): NULL Test passed 😀 > > test_that("LPJSM_binary 5", { + + data <- data_binary + + LPJSM_result <- LPJSM_binary(data = data, six = TRUE, DTR = FALSE) + + result = c(0.2966, 0.3736, 0.4298) + names(result) = c("alphaA", "alphaB", "alphaC") + + summary(LPJSM_result) + print(LPJSM_result) + print(summary(LPJSM_result)) + + expect_equal(LPJSM_result$pi_hat, result, tolerance = 1e-1) + }) Treatment Effect Estimate Estimate Std. Error trtA 0.297 0.120 trtB 0.374 0.127 trtC 0.430 0.130 GEE output: Call: geepack::geeglm(formula = Y ~ alphaA + alphaB + alphaC + gamma1A + gamma2A + gamma1B + gamma2B + gamma1C + gamma2C - 1, family = poisson(link = "log"), data = geedata, id = ptid, corstr = "independence") Coefficients: Estimate Std.err Wald Pr(>|W|) alphaA -1.215 0.403 9.10 0.0026 ** alphaB -0.985 0.340 8.37 0.0038 ** alphaC -0.844 0.304 7.74 0.0054 ** gamma1A 1.215 0.403 9.10 0.0026 ** gamma2A 0.703 0.366 3.68 0.0551 . gamma1B 0.985 0.340 8.37 0.0038 ** gamma2B 0.827 0.350 5.59 0.0180 * gamma1C 0.844 0.304 7.74 0.0054 ** gamma2C -42.245 0.608 4820.41 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation structure = independence Estimated Scale Parameters: Estimate Std.err (Intercept) 0.41 0.126 Number of clusters: 30 Maximum cluster size: 2 Treatment Effect Estimate: Estimate Std. Error trtA 0.297 0.120 trtB 0.374 0.127 trtC 0.430 0.130 Expected Response Rate of Dynamic Treatment Regimens (DTR): NULL Test passed 🌈 > > test_that("sampleSize 1", { + sampleSize <- sample_size( + pi = c(0.7, 0.5, 0.25), beta1 = 1.4, beta0 = 0.5, coverage = 0.9, + power = 0.3, mu = c(0.65, 0.55, 0.25), n = c(10, 10, 10) + ) + result = 17 + + summary(sampleSize) + print(sampleSize) + print(summary(sampleSize)) + + expect_equal(sampleSize$final_N, result, tolerance = 1e-1) + }) With given settings, the estimated sample size per arm for an snSMART is: 17With given settings, the estimated sample size per arm for an snSMART is: 17 In total 1 iterations were taken: l E(D) Var(D) power N 1 0.3 0.201 0.0486 0.715 17 Test passed 🎊 > > test_that("sampleSize 2", { + sampleSize <- sample_size( + pi = c(0.7, 0.5, 0.25), beta1 = 1.4, beta0 = 0.5, coverage = 0.9, + power = 0.3, mu = c(0.65, 0.55, 0.25), n = c(10, 10, 10), verbose = TRUE + ) + result = 17 + + summary(sampleSize) + print(sampleSize) + print(summary(sampleSize)) + + expect_equal(sampleSize$final_N, result, tolerance = 1e-1) + }) | | | 0% | |===================== | 30% | |======================================================================| 100% With given settings, the estimated sample size per arm for an snSMART is: 17With given settings, the estimated sample size per arm for an snSMART is: 17 In total 1 iterations were taken: l E(D) Var(D) power N 1 0.3 0.201 0.0486 0.715 17 Test passed 🥳 > > > test_that("sampleSize 2", { + try({sampleSize <- sample_size( + pi = c(2, 2, 2), beta1 = -2, beta0 = -2, coverage = 2, + power = -2, mu = c(2, 2, 2), n = c(-2, -2, -2), verbose = TRUE + )}, silent = TRUE) + }) ── Skip: sampleSize 2 ────────────────────────────────────────────────────────── Reason: empty test > > proc.time() user system elapsed 119.40 1.42 120.96