Package: TrialEmulation 0.0.4.11
TrialEmulation: Causal Analysis of Observational Time-to-Event Data
Implements target trial emulation methods to apply randomized clinical trial design and analysis in an observational setting. Using marginal structural models, it can estimate intention-to-treat and per-protocol effects in emulated trials using electronic health records. A description and application of the method can be found in Danaei et al (2013) <doi:10.1177/0962280211403603>.
Authors:
TrialEmulation_0.0.4.11.tar.gz
TrialEmulation_0.0.4.11.zip(r-4.7)TrialEmulation_0.0.4.11.zip(r-4.6)TrialEmulation_0.0.4.11.zip(r-4.5)
TrialEmulation_0.0.4.11.tgz(r-4.6-x86_64)TrialEmulation_0.0.4.11.tgz(r-4.6-arm64)TrialEmulation_0.0.4.11.tgz(r-4.5-x86_64)TrialEmulation_0.0.4.11.tgz(r-4.5-arm64)
TrialEmulation_0.0.4.11.tar.gz(r-4.7-arm64)TrialEmulation_0.0.4.11.tar.gz(r-4.7-x86_64)TrialEmulation_0.0.4.11.tar.gz(r-4.6-arm64)TrialEmulation_0.0.4.11.tar.gz(r-4.6-x86_64)
TrialEmulation_0.0.4.11.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
card.svg |card.png
TrialEmulation/json (API)
NEWS
| # Install 'TrialEmulation' in R: |
| install.packages('TrialEmulation', repos = c('https://remlapmot.r-universe.dev', 'https://cloud.r-project.org')) |
Bug tracker:https://github.com/causal-lda/trialemulation/issues
Pkgdown/docs site:https://causal-lda.github.io
- data_censored - Example of longitudinal data for sequential trial emulation containing censoring
- te_data_ex - Example of a prepared data object
- te_model_ex - Example of a fitted marginal structural model object
- trial_example - Example of longitudinal data for sequential trial emulation
- vignette_switch_data - Example of expanded longitudinal data for sequential trial emulation
causal-inferencelongitudinal-datasurvival-analysiscpp
Last updated from:6964cf73ee. Checks:13 OK. Indexed: no.
| Target | Result | Time | Files | Syslog |
|---|---|---|---|---|
| linux-devel-arm64 | OK | 414 | ||
| linux-devel-x86_64 | OK | 402 | ||
| source / vignettes | OK | 286 | ||
| linux-release-arm64 | OK | 400 | ||
| linux-release-x86_64 | OK | 394 | ||
| macos-release-arm64 | OK | 260 | ||
| macos-release-x86_64 | OK | 576 | ||
| macos-oldrel-arm64 | OK | 311 | ||
| macos-oldrel-x86_64 | OK | 746 | ||
| windows-devel | OK | 423 | ||
| windows-release | OK | 449 | ||
| windows-oldrel | OK | 441 | ||
| wasm-release | OK | 135 |
Exports:calculate_weightscase_control_sampling_trialsdata_preparationexpand_trialsfit_msmfit_outcome_modelfit_weights_modelinitiatorsipw_dataipw_data<-load_expanded_dataoutcome_dataoutcome_data<-parsnip_modelpredictread_expanded_datasample_expanded_datasave_expanded_datasave_to_csvsave_to_datatablesave_to_duckdbset_censor_weight_modelset_dataset_expansion_optionsset_outcome_modelset_switch_weight_modelshow_weight_modelsstats_glm_logittrial_msmtrial_sequenceweight_model_data_indices
Dependencies:backportsbroomcheckmateclicodetoolscpp11data.tableDBIdigestdplyrduckdbformula.toolsfuturefuture.applygenericsglobalsgluelatticelifecyclelistenvlmtestmagrittrmvtnormoperator.toolsparallellypillarpkgconfigpurrrR6Rcpprlangsandwichstringistringrtibbletidyrtidyselectutf8vctrswithrzoo
Extending-TrialEmulation
Rendered fromExtending-TrialEmulation.Rmdusingknitr::rmarkdownon May 27 2026.Last update: 2024-08-23
Started: 2024-08-23
Getting-Started
Rendered fromGetting-Started.Rmdusingknitr::rmarkdownon May 27 2026.Last update: 2025-11-18
Started: 2021-10-06
New Interface
Rendered fromnew-interface.Rmdusingknitr::rmarkdownon May 27 2026.Last update: 2026-04-27
Started: 2024-06-04
Readme and manuals
Help Manual
| Help page | Topics |
|---|---|
| Calculate Inverse Probability of Censoring Weights | calculate_weights calculate_weights,trial_sequence_AT-method calculate_weights,trial_sequence_ITT-method calculate_weights,trial_sequence_PP-method |
| Case-control sampling of expanded data for the sequence of emulated trials | case_control_sampling_trials |
| Example of longitudinal data for sequential trial emulation containing censoring | data_censored |
| Prepare data for the sequence of emulated target trials | data_preparation |
| Expand trials | expand_trials |
| Fit the marginal structural model for the sequence of emulated trials | fit_msm fit_msm,trial_sequence-method |
| Method for fitting weight models | fit_weights_model |
| A wrapper function to perform data preparation and model fitting in a sequence of emulated target trials | initiators |
| IPW Data Accessor and Setter | ipw_data ipw_data,trial_sequence-method ipw_data<- ipw_data<-,trial_sequence-method |
| Method to read, subset and sample expanded data | load_expanded_data load_expanded_data,trial_sequence-method |
| Outcome Data Accessor and Setter | outcome_data outcome_data,trial_sequence-method outcome_data<- outcome_data<-,trial_sequence-method |
| Fit outcome models using 'parsnip' models | parsnip_model |
| Predict marginal cumulative incidences with confidence intervals for a target trial population | predict predict,trial_sequence_ITT-method predict,trial_sequence_PP-method predict.TE_msm predict_marginal |
| Print a weight summary object | print.TE_weight_summary |
| Method to read expanded data | read_expanded_data read_expanded_data,te_datastore_datatable-method |
| Internal method to sample expanded data | sample_expanded_data sample_expanded_data,te_datastore-method |
| Method to save expanded data | save_expanded_data save_expanded_data,te_datastore_datatable-method |
| Save expanded data as CSV | save_to_csv |
| Save expanded data as a 'data.table' | save_to_datatable |
| Save expanded data to 'DuckDB' | save_to_duckdb |
| Set censoring weight model | set_censor_weight_model set_censor_weight_model,trial_sequence-method set_censor_weight_model,trial_sequence_AT-method set_censor_weight_model,trial_sequence_ITT-method set_censor_weight_model,trial_sequence_PP-method |
| Set the trial data | set_data set_data,trial_sequence_AT,data.frame-method set_data,trial_sequence_ITT,data.frame-method set_data,trial_sequence_PP,data.frame-method |
| Set expansion options | set_expansion_options set_expansion_options,trial_sequence_ITT-method set_expansion_options,trial_sequence_PP-method |
| Specify the outcome model | set_outcome_model set_outcome_model,trial_sequence-method set_outcome_model,trial_sequence_AT-method set_outcome_model,trial_sequence_ITT-method set_outcome_model,trial_sequence_PP-method |
| Set switching weight model | set_switch_weight_model set_switch_weight_model,trial_sequence-method set_switch_weight_model,trial_sequence_ITT-method |
| Show Weight Model Summaries | show_weight_models |
| Fit outcome models using 'stats::glm' | stats_glm_logit |
| Summary methods | summary.TE_data_prep summary.TE_data_prep_dt summary.TE_data_prep_sep summary.TE_msm summary.TE_robust |
| Example of a prepared data object | te_data_ex |
| TrialEmulation Data Class | te_data-class |
| te_datastore | te_datastore-class |
| Example of a fitted marginal structural model object | te_model_ex |
| Outcome Model Fitter Class | te_model_fitter-class |
| TrialEmulation Outcome Data Class | te_outcome_data-class |
| Fitted Outcome Model Object | te_outcome_fitted-class |
| Fitted Outcome Model Object | te_outcome_model-class |
| Example of longitudinal data for sequential trial emulation | trial_example |
| Fit the marginal structural model for the sequence of emulated trials | trial_msm |
| Create a sequence of emulated target trials object | trial_sequence |
| Trial Sequence class | trial_sequence-class trial_sequence_AT-class trial_sequence_ITT-class trial_sequence_PP-class |
| Example of expanded longitudinal data for sequential trial emulation | vignette_switch_data |
| Data used in weight model fitting | weight_model_data_indices |
