What is the tlverse
?
The tlverse
is a new framework for Targeted Learning in R
, inspired by
the tidyverse
ecosystem of R
packages.
By analogy to the tidyverse
:
The
tidyverse
is an opinionated collection ofR
packages designed for data science. All packages share an underlying design philosophy, grammar, and data structures.
So, the tlverse
is
An opinionated collection of
R
packages for Targeted Learning sharing an underlying design philosophy, grammar, and core set of data structures. Thetlverse
aims to provide tools both for building Targeted Learning-based data analyses and for implementing novel, state-of-the-art Targeted Learning methods.
Anatomy of the tlverse
All Targeted Learning methods are targeted maximum likelihood (or minimum loss-based) estimators (i.e., TMLEs). The construction of any Targeted Learning estimator proceeds through a two-stage process:
- Flexibly learning particular components of the data-generating distribution often through machine learning (e.g., Super Learning), resulting in initial estimates of nuisance parameters.
- Use of a carefully constructed parametric model-based update, via maximum likelihood estimation (i.e., MLE), incorporating the initial estimates produced by the prior step to produce a TML estimator.
The packages making up the core components of the tlverse
software ecosystem
– sl3
and tmle3
– address the above two goals, respectively. Together, the
general functionality exposed by both allows one to build specific TMLEs
tailored exactly to a particular statistical estimation problem.
The software packages that make up the core of the tlverse
are
-
sl3
: Modern Super Machine Learning-
What? A modern object-oriented implementation of the Super Learner
algorithm, employing recently developed paradigms in
R
programming. -
Why? A design that leverages modern ideas for faster computation, is
easily extensible and forward-looking, and forms one of the cornerstones of
the
tlverse
.
-
What? A modern object-oriented implementation of the Super Learner
algorithm, employing recently developed paradigms in
-
tmle3
: An Engine for Targeted Learning- What? A generalized framework that simplifies Targeted Learning by identifying and implementing a series of common statistical estimation procedures.
- Why? A common interface and engine that accommodates current algorithmic approaches to Targeted Learning and yet remains a flexible enough engine to power the implementation of emerging statistical techniques as they are developed.
Beyond these engines that provide the driving force behind the tlverse
, there
are a few supporting packages that play important roles in the background:
-
origami
: A Generalized Framework for Cross-Validation (Coyle and Hejazi 2018)- What? A generalized framework for flexible cross-validation.
- Why? Cross-validation is a key part of ensuring error estimates are honest and in preventing overfitting. It is an essential part of both the Super Learner ensemble modeling algorithm and in the construction of TML estimators.
-
delayed
: Parallelization Framework for Dependent Tasks- What? A framework for delayed computations (i.e., futures) based on task dependencies.
- Why? Efficient allocation of compute resources is essential when deploying computationally intensive algorithms at large scale.
A key principle of the tlverse
is extensibility. That is, the software
ecosystem aims to support the development of novel Targeted Learning estimators
as they reach maturity. To achieve this degree of flexibility, we follow the
model of implementing new classes of estimators, for distinct causal inference
problems in separate packages, all of which rely upon the core machinery
provided by sl3
and tmle3
. There are currently three examples:
-
tmle3mopttx
: Optimal Treatments in thetlverse
- What? Learn an optimal rule and estimate the mean outcome under the rule.
- Why? Optimal treatments are a powerful tool in precision healthcare and other settings where a one-size-fits-all treatment approach is not appropriate.
-
tmle3shift
: Stochastic Shift Interventions based on Modified Treatment Policies in thetlverse
- What? Stochastic shift interventions for evaluating changes in continuous-valued treatments.
- Why? Not all treatment variables are binary or categorical. Estimating the total effects of intervening on continuous-valued treatments provides a way to probe how an effect changes with shifts in the treatment variable.
-
tmle3mediate
: Causal Mediation Analysis in thetlverse
- What? Techniques for evaluating the direct and indirect effects of treatments through mediating variables.
- Why? Evaluating the total effect of a treatment does not provide information about the pathways through which it may operate. When mediating variables have been collected, one can instead evaluate direct and indirect effect parameters that speak to the action mechanism of the treatment.
Reproduciblity with the tlverse
The tlverse
software ecosystem is a growing collection of packages, several of
which are quite early on in the software lifecycle. The team does its best to
maintain backwards compatibility. Once this work reaches completion, the
specific versions of the tlverse
packages used will be archived and tagged to
produce it.
This book was written using bookdown, and the complete source is available on GitHub. This version of the book was built with R version 4.2.3 (2023-03-15), pandoc version 2.7.3, and the following packages:
package | version | source |
---|---|---|
bookdown | 0.32.2 | Github (rstudio/bookdown@d1d1a2c37e870e91003c589fe8faa6cec9058828) |
bslib | 0.4.2 | CRAN (R 4.2.3) |
dagitty | 0.3-1 | CRAN (R 4.2.3) |
data.table | 1.14.8 | CRAN (R 4.2.3) |
delayed | 0.4.0 | CRAN (R 4.2.3) |
devtools | 2.4.5 | CRAN (R 4.2.3) |
downlit | 0.4.2 | CRAN (R 4.2.3) |
dplyr | 1.1.0 | CRAN (R 4.2.3) |
forecast | 8.21 | CRAN (R 4.2.3) |
future | 1.31.0 | CRAN (R 4.2.3) |
ggdag | 0.2.7 | CRAN (R 4.2.3) |
ggfortify | 0.4.15 | CRAN (R 4.2.3) |
ggplot2 | 3.4.1 | CRAN (R 4.2.3) |
here | 1.0.1 | CRAN (R 4.2.3) |
kableExtra | 1.3.4 | CRAN (R 4.2.3) |
knitr | 1.42 | CRAN (R 4.2.3) |
mvtnorm | 1.1-3 | CRAN (R 4.2.3) |
origami | 1.0.7 | Github (tlverse/origami@2c4476fefd80cf125e942a6f8ab98600b52955e8) |
randomForest | 4.7-1.1 | CRAN (R 4.2.3) |
readr | 2.1.4 | CRAN (R 4.2.3) |
rmarkdown | 2.20 | CRAN (R 4.2.3) |
skimr | 2.1.5 | CRAN (R 4.2.3) |
sl3 | 1.4.5 | Github (tlverse/sl3@62f645445da298fc9acc65a6ff060ba428ef8453) |
stringr | 1.5.0 | CRAN (R 4.2.3) |
tibble | 3.1.8 | CRAN (R 4.2.3) |
tidyr | 1.3.0 | CRAN (R 4.2.3) |
tidyverse | 2.0.0 | CRAN (R 4.2.3) |
tmle3 | 0.2.0 | Github (tlverse/tmle3@ed72f8a20e64c914ab25ffe015d865f7a9963d27) |
tmle3mediate | 0.0.3 | Github (tlverse/tmle3mediate@70d1151c4adb54d044f355d06d07bcaeb7f8ae07) |
tmle3mopttx | 1.0.0 | Github (tlverse/tmle3mopttx@3c0e8437af88ca8c54fcec1e953652feaf6c9003) |
tmle3shift | 0.2.1 | Github (tlverse/tmle3shift@2fa7308412af354bc73d4bdc6050e5076f10788a) |