Implementation of sequential trial emulation for the analysis of observational databases. The 'SEQTaRget' software accommodates time-varying treatments and confounders, as well as binary and failure time outcomes. 'SEQTaRget' allows to compare both static and dynamic strategies, can be used to estimate observational analogs of intention-to-treat and per-protocol effects, and can adjust for potential selection bias induced by losses-to-follow-up. (Paper to come).

Implementation of sequential trial emulation for the analysis of
observational databases. The ‘SEQTaRget’ software accommodates
time-varying treatments and confounders, as well as binary and failure
time outcomes. ‘SEQTaRget’ allows to compare both static and dynamic
strategies, can be used to estimate observational analogs of
intention-to-treat and per-protocol effects, and can adjust for
potential selection bias
You can install the release version of SEQTaRget from CRAN with:
install.packages("SEQTaRget")
You can install the development version of SEQTaRget from GitHub with:
install.packages("remotes")
remotes::install_github("CausalInference/SEQTaRget", subdir = "SEQTaRget")
SEQuential uses R’s S4 object class system to handle function
input/output. From the user side, this amounts to calling a helpful
constructor SEQopts and then feeding that into SEQuential.
SEQestimate can also take the provided options and return a (very
rough) estimated time for analysis.
library(SEQTaRget)
data <- SEQdata
model <- SEQuential(data, id.col = "ID", time.col = "time",
eligible.col = "eligible", treatment.col = "tx_init",
outcome.col = "outcome",
time_varying.cols = c("N", "L", "P"),
fixed.cols = "sex",
method = "ITT",
options = SEQopts(km.curves = TRUE))
outcome(model) # Returns a list of all outcome models as S3 fastglm objects over the course of bootstrapping
diagnostics <- diagnostics(model) # Returns a list of diagnostic tables
diagnostics$outcome.unique[[1]] # Returns a table of unique outcomes
diagnostics$outcome.nonunique[[1]] # Returns a table of nonunique outcomes
# Plotting
km_curve(model)[[1]] # Returns the Survival curve
km_data(model)[[1]] # Returns a dataframe of survival data in long-format for other analysis/plotting
This package places several assumptions onto the input data and unexpected results and errors may arise if these are not followed:
time.col begins at 0 per unique id.col entries, we
also assume that the column contains only integers and continues by
1 for every time step. e.g. (0, 1, 2, 3, …) is allowed and (0, 1, 2,
2.5, …) or (0, 1, 2, 4, 5, …) are not.
time.col entries may be out of order as a sort is
enforced at the beginning of the function, e.g. (0, 2, 1, 4, 3, …)
is valid because it begins at 0 and is continuously increasing by
increments of 1, even though it is not ordered.eligible and column names provided to excused.cols are binary
(0/1) flag variables (with respect to time.col)The primary function, SEQuential, returns an S4 object of class
SEQoutput with slots:
These can be easily printed to the terminal by calling the object as
model (if continuing the example above). While this is the shape of
the output object, not all slots will always be filled, e.g. if a user
provides hazard = TRUE, then the survival curves, data, and associated
risks will return NA.
Further information on utilizing this package or developing it further is available with the SEQTaRget Pages as a part of this repository. If you are unable to find solutions or answers there, please feel free to open a discussion.
Community members are welcome to contribute to this package through several different avenues: