VCG Sampling using Energy-Based Covariate Balancing

Provides a principled framework for sampling Virtual Control Group (VCG) using energy distance-based covariate balancing. The package offers visualization tools to assess covariate balance and includes a permutation test to evaluate the statistical significance of observed deviations.


logo

eVCGsampler R package

eVCGsampler provides a principled framework for sampling of VCG (Virtual Control Group), using energy distance-based covariate balancing. The package includes visualization tools for assessing covariate balance, as well as a permutation test to evaluate the statistical significance of the deviations.

Example.

Test for 3 covariates before balancing, comparison of the treated groups (TG) with the data pool (POOL), shows high imbalance.

Distance permutation test TG vs POOL:

image

By running the function: VCG_sampler(treated ~ cov1 + cov2 + cov3, data=dat, n=10)

image

Distance permutation test TG vs VCG:

image

Plot specifically for the variable cov3: plot_var(dat_out, what='cov3’)

image

Best VCG size (exploratory)

With BestVCGsize(treat ~ cov1 + cov2 + cov3, data=dat), you can explore the best size for VCG with the best balance of covariates. It may not necessarily be the best size in terms of power or validity of the study.

image

Multiple VCG samples

If multiple VCG samples are required, use: multiSampler(treat~cov1+cov2+cov3, n=10, Nsamples=10, data=dat)

Overview of sample overlapping:

image

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("eVCGsampler")

1.2.0 by Andreas Schulz, 3 days ago


https://github.com/Sanofi-Public/eVCGsampler


Browse source code at https://github.com/cran/eVCGsampler


Authors: Andreas Schulz [aut, cre] (Created in 2025) , Sanofi [cph, fnd]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports ggforce, osqp, patchwork, shiny

Depends on ggplot2

Suggests bslib, DT, glue, knitr, openxlsx, readxl, rmarkdown, shinycssloaders, shinyhelper, shinyjs, testthat


See at CRAN