How causal-lda/trialemulation works
TrialEmulation is an R package for conducting a sequence of target-trial analyses. The likely workflow is to prepare and extend observational data into trial-period records, fit outcome and weighting models, then estimate and predict trial outcomes. The tree also shows censoring, robust calculations, and CSV/DuckDB storage capabilities. Only the README and C++ sources were provided as excerpts; the R-level stages and their connections are inferred from filenames and are therefore shown as unverified.
Main entry points: te_outcome_model.R Outcome models · expand_trials.R Trial expansion · calculate_weights.R Weight calculation · modelling.R Model fitting
Components 19
Trial data
- Trial sequence
R/trial_sequence.R - Data preparation
R/data_preparation.R - Data manipulation
R/data_manipulation.R - Data extension
R/data_extension.R - Trial expansion
R/expand_trials.R - Artificial censoring
src/code.cpp
Analysis
- Weight calculation
R/calculate_weights.R - Case-control sampling
R/sampling.R - Robust calculations
R/robust.R - Predictions
R/predict.R
Models and weights
- Model fitting
R/modelling.R - Outcome models
R/te_outcome_model.R - Weight models
R/te_weights.R - Parsnip integration
R/te_parsnip.R - GLM logit
R/te_stats_glm_logit.R
Data storage
- Data store
R/te_datastore.R - CSV store
R/te_datastore_csv.R - DuckDB store
R/te_datastore_duckdb.R
Other components
- Analyst
Connections 17
- Analyst → Trial sequence: defines trials
- Trial sequence → Data preparation: sets up data
- Data preparation → Data manipulation: prepares records
- Data manipulation → Data extension: extends data
- Data extension → Trial expansion: expands trials
- Trial expansion → Artificial censoring: applies censoring
- Trial expansion → Weight calculation: supports weighting
- Weight calculation → Weight models: fits weights
- Model fitting → Outcome models: fits outcomes
- Model fitting → Weight models: fits weights
- Parsnip integration → Outcome models: integrates models
- GLM logit → Outcome models: provides model
- Outcome models → Predictions: supports prediction
- Weight calculation → Case-control sampling: informs sampling
- Predictions → Robust calculations: supports inference
- Data store → CSV store: uses backend
- Data store → DuckDB store: uses backend