Package: carts 0.1.0

Benedikt Sommer

carts: Simulation-Based Assessment of Covariate Adjustment in Randomized Trials

Monte Carlo simulation framework for different randomized clinical trial designs with a special emphasis on estimators based on covariate adjustment. The package implements regression-based covariate adjustment (Rosenblum & van der Laan (2010) <doi:10.2202/1557-4679.1138>) and a one-step estimator (Van Lancker et al (2024) <doi:10.48550/arXiv.2404.11150>) for trials with continuous, binary and count outcomes. The estimation of the minimum sample-size required to reach a specified statistical power for a given estimator uses bisection to find an initial rough estimate, followed by stochastic approximation (Robbins-Monro (1951) <doi:10.1214/aoms/1177729586>) to improve the estimate, and finally, a grid search to refine the estimate in the neighborhood of the current best solution.

Authors:Benedikt Sommer [aut, cre], Klaus K. Holst [aut], Foroogh Shamsi [aut], Novo Nordisk A/S [cph]

carts_0.1.0.tar.gz
carts_0.1.0.tar.gz(r-4.7-arm64)carts_0.1.0.tar.gz(r-4.7-x86_64)carts_0.1.0.tar.gz(r-4.6-arm64)carts_0.1.0.tar.gz(r-4.6-x86_64)
carts_0.1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
carts/json (API)
NEWS

# Install 'carts' in R:
install.packages('carts', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/novonordisk-opensource/carts/issues

Pkgdown/docs site:https://novonordisk-opensource.github.io

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

openblascpp

3.00 score 177 downloads 24 exports 27 dependencies

Last updated from:0a2bd54cab. Checks:6 OK. Indexed: no.

TargetResultTimeFilesSyslog
linux-devel-arm64OK215
linux-devel-x86_64OK222
source / vignettesOK247
linux-release-arm64OK213
linux-release-x86_64OK218
wasm-releaseOK135

Exports:%join%aggrsurvappend<-covar_addcovar_bootstrapcovar_joincovar_loggammacovar_normalderive_covar_distributionest_adjest_geeest_geebinest_glmest_glmbinestimate_covar_model_full_condoutcome_binaryoutcome_continuousoutcome_countrmvnrnbsample_covar_parametric_modelsetallargssetargsTrial

Dependencies:abindclicodetoolsdata.tabledigestfuturefuture.applyglobalslatticelavalistenvloggerMatrixmetsmvtnormnumDerivparallellyprogressrquadprogR6RcppRcppArmadillorlangSQUAREMsurvivaltargetedtimereg

Getting started

Rendered fromgettingstarted.Rmdusingknitr::rmarkdownon Jun 11 2026.

Last update: 2025-11-13
Started: 2025-11-13

Parametrization of the negative binomial and gamma distribution

Rendered fromparam.Rmdusingknitr::rmarkdownon Jun 11 2026.

Last update: 2025-11-13
Started: 2025-11-13

Readme and manuals

Help Manual

Help pageTopics
Aggregate data in counting process formataggrsurv
Assignment function to append values to existing listappend<- append<-.list
Root finding by bisectionbisection
Add additional covariates to existing list of covariatescovar_add
Sample from empirical distribution of covariate datacovar_bootstrap
Add additional covariates to existing covariate random generator%join% covar_join join_covar
Simulate from a log gamma-gaussian copula distributioncovar_loggamma
Simulate from multivariate normal distributioncovar_normal
Derive covariate distribution from covariate data typederive_covar_distribution
Construct estimator for the treatment effect in RCT based on covariate adjustmentest_adj
Construct estimator for the treatment effect in RCTest_gee est_geebin est_glm est_glmbin
Marginal Cox proportional hazards model for the treatment effect in RCTest_phreg
Full conditional covariate simulation modelestimate_covar_model_full_cond
Get levels for factor columns in data.tableget_factor_levels
Root solver by Stochastic Approximationoptim_sa
Simulate from binary model given covariatesoutcome_binary
Simulate from continuous outcome model given covariatesoutcome_continuous
Simulate from count model given covariatesoutcome_count
Calculate linear predictor from covariatesoutcome_lp
Outcome model for time-to-event end-points (proportional hazards)outcome_phreg
EXPERIMENTAL: Outcome model for recurrent events with terminal events end-pointsoutcome_recurrent
Outcome modeloutcome_shared
Multivariate normal distribution functionrmvn
Simulate from a negative binomial distributionrnb
Sample from an estimated parametric covariate modelsample_covar_parametric_model
Set default arguments of a functionsetallargs setargs
R6 class for power and sample-size calculations for a clinical trialTrial
trial.estimates class objecttrial.estimates-class