vws: Vertical Weighted Strips in R using C++

article
programming
Published

November 5, 2025

Raim, Livsey, and Irimata (2024+) consider a method of proposal construction for rejection sampling referred to as vertical weighted strips (VWS). Here, the target density is regarded as a weighted density; i.e., the product of a weight function and a simpler (“base”) density function. The practitioner majorizes the weight function by providing another function that bounds it from above. The majorizing function is combined with the base density to form a proposal distribution. In many cases, it is useful (and also more convenient) to partition the support of the target and use a piecewise majorizer. In this case, the proposal distribution can be regarded as a finite mixture whose components are correspond to the regions in the partition.

The vws package has been developed to support development of such proposals and their use in rejection sampling. Coding is primarily done in C++ using the provided API. Sampling functions may be then exposed in R via Rcpp for use in applications. A detailed guide to vws programming - including several worked examples - is provided in the package vignette.

vws package

References

Raim, Andrew M., James A. Livsey, and Kyle M. Irimata. 2024+. “Rejection Sampling with Vertical Weighted Strips.” https://arxiv.org/abs/2401.09696.