Learn R Programming

TrialEmulation

This package implements algorithms to conduct a sequence of target trials analysis.

Installation

The package is available on CRAN:

install.packages('TrialEmulation')

To install the latest development version from github:

remotes::install_github("Causal-LDA/TrialEmulation")

Getting Started

Please see our Getting Started vignette for information on how to work with this package.

A manuscript is in preparation to fully describe the methodology.

Copy Link

Version

Install

install.packages('TrialEmulation')

Monthly Downloads

339

Version

0.0.4.2

License

Apache License (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Isaac Gravestock

Last Published

February 21st, 2025

Functions in TrialEmulation (0.0.4.2)

internal-methods

Internal Methods
expand_trials

Expand trials
fit_msm

Fit the marginal structural model for the sequence of emulated trials
initiators

A wrapper function to perform data preparation and model fitting in a sequence of emulated target trials
save_expanded_data

Method to save expanded data
save_to_datatable

Save expanded data as a data.table
save_to_duckdb

Save expanded data to DuckDB
parsnip_model

Fit outcome models using parsnip models
predict_marginal

Predict marginal cumulative incidences with confidence intervals for a target trial population
te_data-class

TrialEmulation Data Class
select_data_cols

Select Data Columns
set_outcome_model

Specify the outcome model
te_outcome_fitted-class

Fitted Outcome Model Object
sample_expanded_data

Internal method to sample expanded data
robust_calculation

Robust Variance Calculation
summary.TE_data_prep

Summary methods
set_censor_weight_model

Set censoring weight model
te_outcome_model-class

Fitted Outcome Model Object
set_switch_weight_model

Set switching weight model
save_to_csv

Save expanded data as CSV
te_outcome_data-class

TrialEmulation Outcome Data Class
set_data

Set the trial data
te_data_ex

Example of a prepared data object
te_model_fitter-class

Outcome Model Fitter Class
trial_sequence

Create a sequence of emulated target trials object
te_datastore-class

te_datastore
set_expansion_options

Set expansion options
vignette_switch_data

Example of expanded longitudinal data for sequential trial emulation
te_model_ex

Example of a fitted marginal structural model object
te_parsnip_model-class

Fit Models using parsnip
te_stats_glm_logit-class

Fit Models using logistic stats::glm
load_expanded_data

Method to read, subset and sample expanded data
weight_model_data_indices

Data used in weight model fitting
print.TE_weight_summary

Print a weight summary object
outcome_data

Outcome Data Accessor and Setter
trial_sequence-class

Trial Sequence class
stats_glm_logit

Fit outcome models using stats::glm
show_weight_models

Show Weight Model Summaries
te_datastore_csv-class

te_datastore_csv, functions and methods
read_expanded_data

Method to read expanded data
trial_msm

Fit the marginal structural model for the sequence of emulated trials
te_datastore_duckdb-class

te_datastore_duckdb, functions and methods
trial_example

Example of longitudinal data for sequential trial emulation
censor_func

Censoring Function in C++
data_preparation

Prepare data for the sequence of emulated target trials
calculate_weights

Calculate Inverse Probability of Censoring Weights
case_control_sampling_trials

Case-control sampling of expanded data for the sequence of emulated trials
data_censored

Example of longitudinal data for sequential trial emulation containing censoring
TrialEmulation-package

TrialEmulation Package
check_newdata

Check Data used for Prediction
data_manipulation

Data Manipulation Function
expand

Expand Function
calculate_predictions

Calculate and transform predictions
fit_outcome_model

Method for fitting outcome models
ipw_data

IPW Data Accessor and Setter
expand_until_switch

Check Expand Flag After Treatment Switch
fit_weights_model

Method for fitting weight models