==3784382== Memcheck, a memory error detector ==3784382== Copyright (C) 2002-2026, and GNU GPL'd, by Julian Seward et al. ==3784382== Using Valgrind-3.27.1 and LibVEX; rerun with -h for copyright info ==3784382== Command: /data/localhost/ripley/R/R-devel-vg/bin/exec/R --vanilla ==3784382== R Under development (unstable) (2026-09-03 r90482) -- "Unsuffered Consequences" Copyright (C) 2026 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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. Natural language support but running in an English locale 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. > pkgname <- "bunsen" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) > library('bunsen') > > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') > base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') > cleanEx() > nameEx("calculate_statistics") > ### * calculate_statistics > > flush(stderr()); flush(stdout()) > > ### Name: calculate_statistics > ### Title: Estimate the marginal causal survival curves using potential > ### outcome framework > ### Aliases: calculate_statistics > > ### ** Examples > > library(survival) > data("oak") > > cox_event <- coxph(Surv(OS, os.status) ~ trt + btmb + pdl1, data = oak) > calculate_statistics(model = cox_event, trt = "trt") $surv_cond0 [1] 1.0000000 1.0000000 0.9978747 0.9978715 0.9957356 0.9957198 0.9957038 [8] 0.9978455 0.9978410 0.9978365 0.9934990 0.9956386 0.9956262 0.9934236 [15] 0.9955952 0.9977894 0.9977800 0.9955512 0.9955314 0.9955112 0.9954946 [22] 0.9977404 0.9977370 0.9954655 0.9977239 0.9954180 1.0000000 0.9976878 [29] 0.9930585 0.9953359 0.9953214 0.9953042 0.9976385 0.9952666 0.9976196 [36] 0.9928508 0.9976011 0.9927787 0.9975770 0.9975735 0.9975672 0.9951293 [43] 0.9951124 0.9950895 0.9975325 0.9975283 0.9925558 0.9950110 0.9949898 [50] 0.9949637 1.0000000 0.9974581 0.9974445 0.9974315 0.9948507 0.9974121 [57] 0.9974034 0.9947946 0.9973851 0.9947628 0.9973686 0.9973638 0.9947184 [64] 0.9946879 0.9973290 0.9973243 0.9973192 0.9973128 0.9946171 0.9972911 [71] 0.9945675 0.9918134 0.9972502 0.9972419 0.9972375 0.9972306 0.9972228 [78] 0.9944306 0.9971989 0.9971941 0.9943767 0.9971772 0.9971721 0.9943268 [85] 0.9971463 0.9971388 0.9885387 0.9971042 0.9941939 0.9941654 0.9941421 [92] 0.9970548 0.9881861 0.9970125 0.9970031 0.9969979 0.9909790 0.9939477 [99] 0.9969607 0.9969547 0.9969490 0.9938807 0.9969244 0.9938364 0.9938046 [106] 0.9906554 0.9968532 0.9968466 0.9968394 0.9968292 0.9968090 0.9967905 [113] 0.9967811 0.9967705 0.9967602 0.9967398 0.9967285 0.9967223 0.9967161 [120] 0.9934137 0.9900689 0.9966521 0.9932866 0.9966245 0.9966126 0.9898109 [127] 0.9965661 0.9896687 0.9895816 0.9929859 0.9964693 0.9964620 0.9964493 [134] 0.9964336 0.9857334 0.9963860 0.9963776 0.9890968 0.9926518 0.9926039 [141] 0.9962831 0.9925393 0.9962442 1.0000000 0.9924560 0.9923906 0.9961660 [148] 0.9923088 1.0000000 0.9961167 0.9961013 0.9960873 1.0000000 0.9960611 [155] 0.9920923 0.9960183 0.9920224 0.9959893 0.9959744 0.9959645 0.9918992 [162] 0.9959157 0.9958979 0.9958875 0.9917547 0.9916834 0.9916206 0.9957808 [169] 0.9957690 0.9872428 0.9956915 0.9956726 0.9956551 0.9956380 0.9956205 [176] 0.9912054 0.9955743 0.9910801 0.9910170 0.9954727 0.9954511 0.9954294 [183] 0.9954078 0.9907924 0.9953610 0.9906970 0.9953103 0.9952883 0.9952642 [190] 0.9904826 0.9951967 0.9903723 0.9951531 0.9951302 0.9902183 0.9950639 [197] 0.9900967 0.9949998 0.9949841 0.9949687 0.9949457 0.9847774 0.9948546 [204] 0.9948392 0.9948108 0.9947862 0.9947296 0.9947036 0.9946783 0.9946597 [211] 0.9946306 0.9946141 0.9891723 0.9945284 0.9944982 0.9889320 0.9888085 [218] 1.0000000 0.9943250 0.9943065 0.9942846 0.9942476 0.9942177 0.9884065 [225] 0.9941573 0.9941119 0.9940783 0.9940555 0.9940306 0.9939913 0.9939539 [232] 0.9939210 0.9938970 0.9938730 0.9938339 0.9937937 0.9937479 0.9937055 [239] 0.9810516 0.9935905 0.9935533 0.9935285 0.9934793 0.9934541 0.9868340 [246] 0.9933356 0.9933049 0.9932777 0.9932464 0.9931984 0.9931509 0.9862557 [253] 0.9930578 0.9930068 0.9859423 0.9928507 0.9856228 0.9926935 0.9926515 [260] 0.9926198 0.9925876 0.9925557 0.9925188 0.9849556 0.9923967 0.9923582 [267] 0.9923022 0.9922628 0.9843958 0.9920736 0.9920080 0.9919604 0.9919235 [274] 0.9918627 0.9917924 0.9917479 0.9916854 0.9916438 0.9915809 0.9915165 [281] 0.9914725 0.9914305 0.9913874 0.9913094 0.9912645 0.9912114 0.9911404 [288] 0.9910885 0.9910426 0.9819550 1.0000000 1.0000000 1.0000000 1.0000000 [295] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 [302] 1.0000000 0.9894353 1.0000000 1.0000000 1.0000000 0.9889847 1.0000000 [309] 0.9884840 1.0000000 0.9882824 0.9764275 0.9753052 1.0000000 1.0000000 [316] 0.9867132 0.9863104 1.0000000 1.0000000 1.0000000 1.0000000 0.9850011 [323] 1.0000000 1.0000000 1.0000000 1.0000000 0.9837943 1.0000000 1.0000000 [330] 1.0000000 1.0000000 1.0000000 0.9816534 1.0000000 1.0000000 1.0000000 [337] 0.9802719 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 [344] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.9753036 0.9748806 [351] 1.0000000 0.9736401 1.0000000 1.0000000 0.9714089 1.0000000 1.0000000 [358] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 [365] 0.9607817 1.0000000 1.0000000 0.9548850 1.0000000 1.0000000 1.0000000 [372] 1.0000000 0.9465078 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 [379] 1.0000000 0.9205256 0.9052758 1.0000000 1.0000000 1.0000000 1.0000000 [386] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.6410363 [393] 1.0000000 1.0000000 $surv_cond1 [1] 1.0000000 1.0000000 0.9986476 0.9986455 0.9972853 0.9972752 0.9972649 [8] 0.9986289 0.9986261 0.9986232 0.9958595 0.9972233 0.9972154 0.9958113 [15] 0.9971955 0.9985931 0.9985871 0.9971674 0.9971548 0.9971419 0.9971313 [22] 0.9985618 0.9985596 0.9971127 0.9985513 0.9970823 1.0000000 0.9985283 [29] 0.9955779 0.9970299 0.9970206 0.9970096 0.9984968 0.9969856 0.9984847 [36] 0.9954450 0.9984729 0.9953989 0.9984575 0.9984553 0.9984513 0.9968978 [43] 0.9968871 0.9968724 0.9984291 0.9984264 0.9952563 0.9968222 0.9968087 [50] 0.9967920 1.0000000 0.9983816 0.9983729 0.9983646 0.9967198 0.9983522 [57] 0.9983467 0.9966840 0.9983350 0.9966636 0.9983244 0.9983214 0.9966352 [64] 0.9966157 0.9982992 0.9982961 0.9982929 0.9982888 0.9965704 0.9982749 [71] 0.9965388 0.9947813 0.9982488 0.9982435 0.9982407 0.9982363 0.9982313 [78] 0.9964512 0.9982160 0.9982130 0.9964167 0.9982022 0.9981989 0.9963847 [85] 0.9981824 0.9981776 0.9926883 0.9981555 0.9962998 0.9962815 0.9962666 [92] 0.9981239 0.9924623 0.9980969 0.9980909 0.9980875 0.9942469 0.9961422 [99] 0.9980638 0.9980599 0.9980563 0.9960993 0.9980405 0.9960709 0.9960506 [106] 0.9940395 0.9979950 0.9979908 0.9979862 0.9979797 0.9979668 0.9979550 [113] 0.9979490 0.9979422 0.9979356 0.9979226 0.9979154 0.9979114 0.9979074 [120] 0.9958005 0.9936638 0.9978665 0.9957191 0.9978489 0.9978412 0.9934985 [127] 0.9978115 0.9934074 0.9933515 0.9955267 0.9977497 0.9977450 0.9977369 [134] 0.9977268 0.9908886 0.9976964 0.9976910 0.9930406 0.9953127 0.9952820 [141] 0.9976305 0.9952406 0.9976056 1.0000000 0.9951873 0.9951454 0.9975557 [148] 0.9950930 1.0000000 0.9975241 0.9975143 0.9975053 1.0000000 0.9974886 [155] 0.9949544 0.9974612 0.9949096 0.9974427 0.9974331 0.9974268 0.9948306 [162] 0.9973956 0.9973842 0.9973775 0.9947380 0.9946923 0.9946521 0.9973092 [169] 0.9973016 0.9918512 0.9972521 0.9972400 0.9972288 0.9972179 0.9972067 [176] 0.9943860 0.9971771 0.9943057 0.9942652 0.9971120 0.9970982 0.9970844 [183] 0.9970705 0.9941213 0.9970405 0.9940601 0.9970081 0.9969940 0.9969786 [190] 0.9939226 0.9969354 0.9938518 0.9969075 0.9968928 0.9937530 0.9968504 [197] 0.9936750 0.9968093 0.9967993 0.9967893 0.9967746 0.9902675 0.9967163 [204] 0.9967064 0.9966882 0.9966725 0.9966363 0.9966196 0.9966034 0.9965915 [211] 0.9965729 0.9965623 0.9930819 0.9965074 0.9964880 0.9929277 0.9928485 [218] 1.0000000 0.9963771 0.9963653 0.9963512 0.9963276 0.9963084 0.9925904 [225] 0.9962696 0.9962406 0.9962190 0.9962045 0.9961885 0.9961633 0.9961393 [232] 0.9961182 0.9961029 0.9960875 0.9960624 0.9960367 0.9960073 0.9959802 [239] 0.9878707 0.9959064 0.9958826 0.9958667 0.9958352 0.9958190 0.9915802 [246] 0.9957430 0.9957233 0.9957059 0.9956858 0.9956550 0.9956246 0.9912084 [253] 0.9955648 0.9955321 0.9910069 0.9954320 0.9908015 0.9953312 0.9953043 [260] 0.9952839 0.9952632 0.9952428 0.9952191 0.9903722 0.9951407 0.9951160 [267] 0.9950800 0.9950548 0.9900120 0.9949334 0.9948913 0.9948608 0.9948370 [274] 0.9947980 0.9947530 0.9947244 0.9946842 0.9946575 0.9946172 0.9945758 [281] 0.9945476 0.9945206 0.9944929 0.9944428 0.9944139 0.9943798 0.9943342 [288] 0.9943009 0.9942714 0.9884400 1.0000000 1.0000000 1.0000000 1.0000000 [295] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 [302] 1.0000000 0.9932411 1.0000000 1.0000000 1.0000000 0.9929520 1.0000000 [309] 0.9926309 1.0000000 0.9925014 0.9848816 0.9841577 1.0000000 1.0000000 [316] 0.9914937 0.9912349 1.0000000 1.0000000 1.0000000 1.0000000 0.9903940 [323] 1.0000000 1.0000000 1.0000000 1.0000000 0.9896185 1.0000000 1.0000000 [330] 1.0000000 1.0000000 1.0000000 0.9882421 1.0000000 1.0000000 1.0000000 [337] 0.9873530 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 [344] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.9841528 0.9838793 [351] 1.0000000 0.9830785 1.0000000 1.0000000 0.9816376 1.0000000 1.0000000 [358] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 [365] 0.9747610 1.0000000 1.0000000 0.9709319 1.0000000 1.0000000 1.0000000 [372] 1.0000000 0.9654769 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 [379] 1.0000000 0.9484481 0.9383648 1.0000000 1.0000000 1.0000000 1.0000000 [386] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.7524613 [393] 1.0000000 1.0000000 > > > > > cleanEx() detaching ‘package:survival’ > nameEx("calculate_trt_effect") > ### * calculate_trt_effect > > flush(stderr()); flush(stdout()) > > ### Name: calculate_trt_effect > ### Title: Calculate the marginal treatment effect using counterfactual > ### simulations > ### Aliases: calculate_trt_effect > > ### ** Examples > > library(survival) > data("oak") > > cox_event <- coxph(Surv(OS, os.status) ~ trt + btmb + pdl1, data = oak) > # > cox_censor <- coxph(Surv(OS, 1 - os.status) ~ trt + btmb + pdl1, data = oak) > bh <- basehaz(cox_event, centered = FALSE) > bh_c <- basehaz(cox_censor, centered = FALSE) > s_condi <- calculate_statistics(model = cox_event, trt = "trt") > s_condi_c <- calculate_statistics(model = cox_censor, trt = "trt") > sim_out_1d <- simulate_counterfactuals( + bh = bh, surv_cond = s_condi$surv_cond1, cpp = FALSE, M = 1000) > sim_out_0d <- simulate_counterfactuals( + bh = bh, surv_cond = s_condi$surv_cond0, cpp = FALSE, M = 1000) > sim_out_1c <- simulate_counterfactuals( + bh = bh_c, surv_cond = s_condi_c$surv_cond1, cpp = FALSE, M = 1000) > sim_out_0c <- simulate_counterfactuals( + bh = bh_c, surv_cond = s_condi_c$surv_cond0, cpp = FALSE, M = 1000) > > output <- calculate_trt_effect(sim_out_1d, sim_out_0d, sim_out_1c, sim_out_0c) > > > > > cleanEx() detaching ‘package:survival’ > nameEx("clmqControl") > ### * clmqControl > > flush(stderr()); flush(stdout()) > > ### Name: clmqControl > ### Title: Control of marginal HR estimation via clustermq > ### Aliases: clmqControl > > ### ** Examples > > ## Not run: > ##D #Don't run as it requires LSF scheduler > ##D > ##D library(survival) > ##D data("oak") > ##D > ##D cox_event <- coxph(Surv(OS, os.status) ~ trt + btmb + pdl1, data = oak) > ##D > ##D cox_censor <- coxph(Surv(OS, 1 - os.status) ~ trt + btmb + pdl1, data = oak) > ##D > ##D > ##D get_marginal_effect( > ##D trt = "trt", cox_event = cox_event, cox_censor = cox_censor, SE = TRUE, > ##D M = 1000, n.boot = 10, data = oak, seed = 1, cpp = FALSE, control = clmqControl() > ##D ) > ##D > ##D > ## End(Not run) > > > > cleanEx() > nameEx("firstZeroIndex") > ### * firstZeroIndex > > flush(stderr()); flush(stdout()) > > ### Name: firstZeroIndex > ### Title: First zero index for each column of a matrix > ### Aliases: firstZeroIndex > > ### ** Examples > > m <- matrix(c(1, 0, 2,0, 3, 1),nrow = 3, ncol = 2) > firstZeroIndex(m) [1] 2 1 > > > > cleanEx() > nameEx("get_marginal_effect") > ### * get_marginal_effect > > flush(stderr()); flush(stdout()) > > ### Name: get_marginal_effect > ### Title: Calculate the marginal treatment effects for hazard ratio (HR) > ### adjusting covariates in clinical trials > ### Aliases: get_marginal_effect > > ### ** Examples > > ## Not run: > ##D #Don't run as it requires LSF scheduler > ##D > ##D library(survival) > ##D data("oak") > ##D > ##D cox_event <- coxph(Surv(OS, os.status) ~ trt + btmb + pdl1, data = oak) > ##D # > ##D cox_censor <- coxph(Surv(OS, 1 - os.status) ~ trt + btmb + pdl1, data = oak) > ##D # > ##D get_marginal_effect( > ##D trt = "trt", cox_event = cox_event, cox_censor = cox_censor, SE = TRUE, > ##D M = 1000, n.boot = 10, data = oak, seed = 1, cpp = FALSE, control = clmqControl(n_jobs = 100) > ##D ) > ##D # > ## End(Not run) > > > > cleanEx() > nameEx("get_point_estimate") > ### * get_point_estimate > > flush(stderr()); flush(stdout()) > > ### Name: get_point_estimate > ### Title: Calculate the marginal treatment effects (only the point > ### estimate) for hazard ratio (HR) adjusting covariates in clinical > ### trials > ### Aliases: get_point_estimate > > ### ** Examples > > library(survival) > data("oak") > > cox_event <- coxph(Surv(OS, os.status) ~ trt + btmb + pdl1, data = oak) > # > cox_censor <- coxph(Surv(OS, 1 - os.status) ~ trt + btmb + pdl1, data = oak) > # > get_point_estimate( + trt = "trt", cox_event = cox_event, cox_censor, M = 1000, data = oak, + seed = 1, cpp = FALSE, control = clmqControl(clmq_hr=FALSE) + ) [1] -0.4694978 > > > > cleanEx() detaching ‘package:survival’ > nameEx("get_rmst_estimate") > ### * get_rmst_estimate > > flush(stderr()); flush(stdout()) > > ### Name: get_rmst_estimate > ### Title: Calculate the marginal restricted mean survival time (RMST) when > ### adjusting covariates in clinical trials > ### Aliases: get_rmst_estimate > > ### ** Examples > > > data("oak") > tau <- 26 > time <- oak$OS > status <- oak$os.status > trt <- oak$trt > covariates <- oak[, c("btmb", "pdl1")] > get_rmst_estimate(time, status, trt, covariates, tau, SE = "delta") Call: Surv(time, status) ~ btmb + pdl1 + strata(trt) Restricted survival time: 26 coef se(coef) 2.5% 97.5% trt 3.265971 0.716351 1.861923 4.670019 Method for SE calculation: delta > > > > cleanEx() > nameEx("get_variance_estimation") > ### * get_variance_estimation > > flush(stderr()); flush(stdout()) > > ### Name: get_variance_estimation > ### Title: Calculate the variance (SE) of the marginal treatment effects > ### (hazard ratio) adjusting covariates in clinical trials > ### Aliases: get_variance_estimation > > ### ** Examples > > ## Not run: > ##D #Don't run as it requires LSF scheduler > ##D library(survival) > ##D data("oak") > ##D > ##D cox_event <- coxph(Surv(OS, os.status) ~ trt + btmb + pdl1, data = oak) > ##D # > ##D cox_censor <- coxph(Surv(OS, 1 - os.status) ~ trt + btmb + pdl1, data = oak) > ##D # > ##D get_variance_estimation(cox_event, cox_censor, > ##D trt = "trt", data = oak, > ##D M = 1000, n.boot = 10, control = clmqControl(), cpp = FALSE > ##D ) > ## End(Not run) > > > > cleanEx() > nameEx("rbinom_matrix_vec") > ### * rbinom_matrix_vec > > flush(stderr()); flush(stdout()) > > ### Name: rbinom_matrix_vec > ### Title: Generate a matrix of binomial random values > ### Aliases: rbinom_matrix_vec > > ### ** Examples > > set.seed(1) > rbinom_matrix_vec(5, 3, rep(0.3, 3)) Warning in rbinom_matrix_vec(5, 3, rep(0.3, 3)) : subscript out of bounds (index 3 >= vector size 3) ==3784382== Invalid read of size 8 ==3784382== at 0x17C8FB54: rbinom (/data/localhost/ripley/R/test-dev/Rcpp/include/Rcpp/Rmath.h:98) ==3784382== by 0x17C8FB54: rbinom_matrix_vec(int, int, Rcpp::Vector<14, Rcpp::PreserveStorage>) (/data/localhost/ripley/R/packages/tests-vg/bunsen/src/cpp_functions.cpp:51) ==3784382== by 0x17C8917C: _bunsen_rbinom_matrix_vec (/data/localhost/ripley/R/packages/tests-vg/bunsen/src/RcppExports.cpp:33) ==3784382== by 0x496E0D: R_doDotCall (/data/localhost/ripley/R/svn/R-devel/src/main/dotcode.c:760) ==3784382== by 0x4D4C5A: bcEval_loop (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:8704) ==3784382== by 0x4E4101: bcEval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:7533) ==3784382== by 0x4E4101: bcEval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:7518) ==3784382== by 0x4E44CA: Rf_eval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:1167) ==3784382== by 0x4E6366: R_execClosure (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2398) ==3784382== by 0x4E70FF: applyClosure_core (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2314) ==3784382== by 0x4E46D8: Rf_applyClosure (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2333) ==3784382== by 0x4E46D8: Rf_eval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:1278) ==3784382== by 0x51D0D3: Rf_ReplIteration (/data/localhost/ripley/R/svn/R-devel/src/main/main.c:264) ==3784382== by 0x51D4B7: R_ReplConsole (/data/localhost/ripley/R/svn/R-devel/src/main/main.c:317) ==3784382== by 0x51D544: run_Rmainloop (/data/localhost/ripley/R/svn/R-devel/src/main/main.c:1237) ==3784382== Address 0x19fb40f0 is 3,360 bytes inside a block of size 7,960 alloc'd ==3784382== at 0x4841AE6: malloc (/builddir/build/BUILD/valgrind-3.27.1-build/valgrind-3.27.1/coregrind/m_replacemalloc/vg_replace_malloc.c:447) ==3784382== by 0x5297F9: GetNewPage (/data/localhost/ripley/R/svn/R-devel/src/main/memory.c:998) ==3784382== by 0x52B873: Rf_allocVector3 (/data/localhost/ripley/R/svn/R-devel/src/main/memory.c:2873) ==3784382== by 0x4111D0: Rf_allocVector (/data/localhost/ripley/R/svn/R-devel/src/include/Rinlinedfuns.h:609) ==3784382== by 0x4111D0: new_compact_intseq (/data/localhost/ripley/R/svn/R-devel/src/main/altclasses.c:328) ==3784382== by 0x43DCDD: do_attr (/data/localhost/ripley/R/svn/R-devel/src/main/attrib.c:1587) ==3784382== by 0x4D8F7D: bcEval_loop (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:8150) ==3784382== by 0x4E4101: bcEval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:7533) ==3784382== by 0x4E4101: bcEval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:7518) ==3784382== by 0x4E44CA: Rf_eval (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:1167) ==3784382== by 0x4E6366: R_execClosure (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2398) ==3784382== by 0x4E70FF: applyClosure_core (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2314) ==3784382== by 0x4E7BF1: Rf_applyClosure (/data/localhost/ripley/R/svn/R-devel/src/main/eval.c:2333) ==3784382== by 0x531EAC: dispatchMethod (/data/localhost/ripley/R/svn/R-devel/src/main/objects.c:473) ==3784382== Warning in rbinom_matrix_vec(5, 3, rep(0.3, 3)) : subscript out of bounds (index 4 >= vector size 3) Warning in rbinom_matrix_vec(5, 3, rep(0.3, 3)) : subscript out of bounds (index 3 >= vector size 3) Warning in rbinom_matrix_vec(5, 3, rep(0.3, 3)) : subscript out of bounds (index 4 >= vector size 3) Warning in rbinom_matrix_vec(5, 3, rep(0.3, 3)) : subscript out of bounds (index 3 >= vector size 3) Warning in rbinom_matrix_vec(5, 3, rep(0.3, 3)) : subscript out of bounds (index 4 >= vector size 3) [,1] [,2] [,3] [1,] 0 0 0 [2,] 0 1 0 [3,] 0 1 0 [4,] 0 0 0 [5,] 0 0 0 > > > > cleanEx() > nameEx("rmst_delta") > ### * rmst_delta > > flush(stderr()); flush(stdout()) > > ### Name: rmst_delta > ### Title: Calculate the variance of the marginal restricted mean survival > ### time (RMST) when adjusting covariates using the delta method > ### Aliases: rmst_delta > > ### ** Examples > > library(survival) > data("oak") > > tau <- 26 > time <- oak$OS > status <- oak$os.status > trt <- oak$trt > covariates <- oak[, c("btmb", "pdl1")] > > dt <- as.data.frame(cbind(time, status, trt, covariates)) > fit <- coxph(Surv(time, status) ~ btmb + pdl1 + strata(trt), data = dt) > delta <- rmst_point_estimate(fit, dt = dt, tau) > rmst_delta(fit, time, trt, covariates, tau, + surv0 = delta$surv0, surv1 = delta$surv1, + cumhaz0 = delta$cumhaz0, cumhaz1 = delta$cumhaz1 + ) [1] 0.716351 > > > > cleanEx() detaching ‘package:survival’ > nameEx("rmst_point_estimate") > ### * rmst_point_estimate > > flush(stderr()); flush(stdout()) > > ### Name: rmst_point_estimate > ### Title: Calculate the point estimate of the marginal restricted mean > ### survival time (RMST) when adjusting covariates in clinical trials > ### Aliases: rmst_point_estimate > > ### ** Examples > > library(survival) > data("oak") > > tau <- 26 > time <- oak$OS > status <- oak$os.status > trt <- oak$trt > covariates <- oak[, c("btmb", "pdl1")] > dt <- as.data.frame(cbind(time, status, trt, covariates)) > fit <- coxph(Surv(time, status) ~ btmb + pdl1 + strata(trt), data = dt) > delta <- rmst_point_estimate(fit, dt = dt, tau) > delta$output [1] 3.265971 > > > > cleanEx() detaching ‘package:survival’ > nameEx("rmst_unadjust") > ### * rmst_unadjust > > flush(stderr()); flush(stdout()) > > ### Name: rmst_unadjust > ### Title: Calculate the unadjusted restricted mean survival time (RMST) > ### Aliases: rmst_unadjust > > ### ** Examples > > > data("oak") > tau <- 26 > time <- oak$OS > status <- oak$os.status > trt <- oak$trt > covariates <- oak[, c("btmb", "pdl1")] > results <- rmst_unadjust(time, status, trt, tau) > > > > > cleanEx() > nameEx("simulate_counterfactuals") > ### * simulate_counterfactuals > > flush(stderr()); flush(stdout()) > > ### Name: simulate_counterfactuals > ### Title: Calculate the potential outcomes using marginal survival causual > ### curves > ### Aliases: simulate_counterfactuals > > ### ** Examples > > library(survival) > data("oak") > > cox_event <- coxph(Surv(OS, os.status) ~ trt + btmb + pdl1, data = oak) > # > cox_censor <- coxph(Surv(OS, 1 - os.status) ~ trt + btmb + pdl1, data = oak) > > bh <- basehaz(cox_event, centered = FALSE) > s_condi <- calculate_statistics(model = cox_event, trt = "trt") > sim_out_1d <- simulate_counterfactuals( + bh = bh, surv_cond = s_condi$surv_cond0, cpp = FALSE, M = 1000) > > > > ### *