Package: TrialEmulation 0.0.3.39

Isaac Gravestock

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:Roonak Rezvani [aut], Isaac Gravestock [aut, cre], Li Su [aut], Julia Moesch [aut], Medical Research Council [fnd], F. Hoffmann-La Roche AG [cph, fnd]

TrialEmulation_0.0.3.39.tar.gz
TrialEmulation_0.0.3.39.zip(r-4.5)TrialEmulation_0.0.3.39.zip(r-4.4)TrialEmulation_0.0.3.39.zip(r-4.3)
TrialEmulation_0.0.3.39.tgz(r-4.4-x86_64)TrialEmulation_0.0.3.39.tgz(r-4.4-arm64)TrialEmulation_0.0.3.39.tgz(r-4.3-x86_64)TrialEmulation_0.0.3.39.tgz(r-4.3-arm64)
TrialEmulation_0.0.3.39.tar.gz(r-4.5-noble)TrialEmulation_0.0.3.39.tar.gz(r-4.4-noble)
TrialEmulation_0.0.3.39.tgz(r-4.4-emscripten)TrialEmulation_0.0.3.39.tgz(r-4.3-emscripten)
TrialEmulation.pdf |TrialEmulation.html
TrialEmulation/json (API)
NEWS

# Install 'TrialEmulation' in R:
install.packages('TrialEmulation', repos = c('https://causal-lda.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/causal-lda/trialemulation/issues

Uses libs:
  • c++– GNU Standard C++ Library v3
Datasets:
  • 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

On CRAN:

causal-inferencelongitudinal-datasurvival-analysis

7.52 score 19 stars 24 scripts 261 downloads 31 exports 38 dependencies

Last updated 6 days agofrom:884edcf662. Checks:OK: 9. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 15 2024
R-4.5-win-x86_64OKNov 15 2024
R-4.5-linux-x86_64OKNov 15 2024
R-4.4-win-x86_64OKNov 15 2024
R-4.4-mac-x86_64OKNov 15 2024
R-4.4-mac-aarch64OKNov 15 2024
R-4.3-win-x86_64OKNov 15 2024
R-4.3-mac-x86_64OKNov 15 2024
R-4.3-mac-aarch64OKNov 15 2024

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:backportsbroomcheckmateclicpp11data.tableDBIdplyrduckdbfansiformula.toolsgenericsgluelatticelifecyclelmtestmagrittrMatrixmvtnormoperator.toolsparglmpillarpkgconfigpurrrR6RcppRcppArmadillorlangsandwichstringistringrtibbletidyrtidyselectutf8vctrswithrzoo

Extending-TrialEmulation

Rendered fromExtending-TrialEmulation.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-08-23
Started: 2024-08-23

Getting-Started

Rendered fromGetting-Started.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-01-08
Started: 2021-10-06

New Interface

Rendered fromnew-interface.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-11-13
Started: 2024-06-04

Readme and manuals

Help Manual

Help pageTopics
Calculate Inverse Probability of Censoring Weightscalculate_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 trialscase_control_sampling_trials
Example of longitudinal data for sequential trial emulation containing censoringdata_censored
Prepare data for the sequence of emulated target trialsdata_preparation
Expand trialsexpand_trials
Fit the marginal structural model for the sequence of emulated trialsfit_msm fit_msm,trial_sequence-method
Method for fitting weight modelsfit_weights_model
A wrapper function to perform data preparation and model fitting in a sequence of emulated target trialsinitiators
IPW Data Accessor and Setteripw_data ipw_data,trial_sequence-method ipw_data<- ipw_data<-,trial_sequence-method
Method to read, subset and sample expanded dataload_expanded_data load_expanded_data,trial_sequence-method
Outcome Data Accessor and Setteroutcome_data outcome_data,trial_sequence-method outcome_data<- outcome_data<-,trial_sequence-method
Fit outcome models using 'parsnip' modelsparsnip_model
Predict marginal cumulative incidences with confidence intervals for a target trial populationpredict predict,trial_sequence_ITT-method predict,trial_sequence_PP-method predict.TE_msm predict_marginal
Print a weight summary objectprint.TE_weight_summary
Method to read expanded dataread_expanded_data read_expanded_data,te_datastore_datatable-method
Internal method to sample expanded datasample_expanded_data sample_expanded_data,te_datastore-method
Method to save expanded datasave_expanded_data save_expanded_data,te_datastore_datatable-method
Save expanded data as CSVsave_to_csv
Save expanded data as a 'data.table'save_to_datatable
Save expanded data to 'DuckDB'save_to_duckdb
Set censoring weight modelset_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 dataset_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 optionsset_expansion_options set_expansion_options,trial_sequence_ITT-method set_expansion_options,trial_sequence_PP-method
Specify the outcome modelset_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 modelset_switch_weight_model set_switch_weight_model,trial_sequence-method set_switch_weight_model,trial_sequence_ITT-method
Show Weight Model Summariesshow_weight_models
Fit outcome models using 'stats::glm'stats_glm_logit
Summary methodssummary.TE_data_prep summary.TE_data_prep_dt summary.TE_data_prep_sep summary.TE_msm summary.TE_robust
Example of a prepared data objectte_data_ex
TrialEmulation Data Classte_data-class
te_datastorete_datastore-class
Example of a fitted marginal structural model objectte_model_ex
Outcome Model Fitter Classte_model_fitter-class
TrialEmulation Outcome Data Classte_outcome_data-class
Fitted Outcome Model Objectte_outcome_fitted-class
Fitted Outcome Model Objectte_outcome_model-class
Example of longitudinal data for sequential trial emulationtrial_example
Fit the marginal structural model for the sequence of emulated trialstrial_msm
Create a sequence of emulated target trials objecttrial_sequence
Trial Sequence classtrial_sequence-class trial_sequence_AT-class trial_sequence_ITT-class trial_sequence_PP-class
Example of expanded longitudinal data for sequential trial emulationvignette_switch_data
Data used in weight model fittingweight_model_data_indices