Wasserstein Index Generation (WIG) Model

Efficient implementation of several Optimal Transport algorithms in Fangzhou Xie (2025) and the Wasserstein Index Generation (WIG) model in Fangzhou Xie (2020) .


rwig

DOI:10.1016/j.econlet.2019.108874 experimentalversion CRANchecks R buildstatus License:MIT

The rwig package implements the Sinkhorn algorithms for regularized Optimal Transport problems, Wasserstein Barycenter algorithms for the regularized Wasserstein Barycenter problems, Wasserstein Dictionary Learning (WDL) model, and Wasserstein Index Generation (WIG) model in R (see references below).

All the methods are implemented from the ground up in C++ on top of R’s native C API, calling the BLAS/LAPACK libraries shipped with R directly, with additional support for multi-threading for the log-stablized methods for sinkhorn and barycenter. See the vignette on multi-threading for faster processing.

Installation

This package is on CRAN, and I recommend to use the pak to install it:

# install pak if not already done so
# install.packages("pak")
pak::pak("rwig")

# or you can install it in the classic way
install.packages("rwig")

You can install the development version of rwig from GitHub with:

# install.packages("pak")
pak::pak("fangzhou-xie/rwig")

Get Started

Please check out all the vignettes for the examples of using this package under the “Articles” drop down menu on the documentation website.

Citation

Please use the following to cite my works:

@article{xie2020,
  title = {Wasserstein Index Generation Model: Automatic Generation of Time-Series Index with Application to Economic Policy Uncertainty},
  author = {Xie, Fangzhou},
  year = 2020,
  month = jan,
  journal = {Economics Letters},
  volume = {186},
  pages = {108874},
  issn = {0165-1765},
  doi = {10.1016/j.econlet.2019.108874},
  urldate = {2019-12-10},
}

Reference

Peyré, G., & Cuturi, M. (2019). Computational Optimal Transport: With Applications to Data Science. Foundations and Trends® in Machine Learning, 11(5–6), 355–607. https://doi.org/10.1561/2200000073

Schmitz, M. A., Heitz, M., Bonneel, N., Ngolè, F., Coeurjolly, D., Cuturi, M., Peyré, G., & Starck, J.-L. (2018). Wasserstein dictionary learning: Optimal transport-based unsupervised nonlinear dictionary learning. SIAM Journal on Imaging Sciences, 11(1), 643–678. https://doi.org/10.1137/17M1140431

Xie, F. (2020). Wasserstein index generation model: Automatic generation of time-series index with applieion to economic policy uncertainty. Economics Letters, 186, 108874. https://doi.org/10.1016/j.econlet.2019.108874

Xie, F. (2025). Deriving the Gradients of Some Popular Optimal Transport Algorithms (No. arXiv:2504.08722). arXiv. https://doi.org/10.48550/arXiv.2504.08722

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("rwig")

0.3.0 by Fangzhou Xie, 15 days ago


https://github.com/fangzhou-xie/rwig, https://fangzhou-xie.github.io/rwig/


Report a bug at https://github.com/fangzhou-xie/rwig/issues


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


Authors: Fangzhou Xie [aut, cre, cph]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports utils, stats, rlang, cli, word2vec, tokenizers, stopwords

Suggests RhpcBLASctl, knitr, rmarkdown, tinytest

System requirements: autoconf, CUDA (> 13.0, only for Linux, optional)


See at CRAN