pySEQTarget - Sequential Target Trial Emulation
Implementation of sequential trial emulation for the analysis of
observational databases. The pySEQTarget software accommodates
time-varying treatments and confounders, as well as binary and failure
time outcomes. pySEQTarget 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.
Installation
You can install the development version of pySEQTarget from github with:
pip install git+https://github.com/CausalInference/pySEQTarget
Or from pypi iwth
pip install pySEQTarget
Setting up your Analysis
The primary API, SEQuential uses a dataclass system to handle function input. You can then recover elements as they are built by interacting with the SEQuential object you create.
From the user side, this amounts to creating a dataclass, SEQopts, and then feeding this into SEQuential. If you forgot to add something at class instantiation, you can, in some cases, add them when you call their respective class method.
from pySEQTarget import SEQuential, SEQopts
from pySEQTarget.data import load_data
data = load_data("SEQdata")
options = SEQopts(km_curves = True)
# Initiate the class
model = SEQuential(data,
id_col = "ID",
time_col = "time",
eligible_col = "eligible",
treatment_col = "tx_init",
outcome_col = "outcome",
time_varying_cols = ["N", "L", "P"],
fixed_cols = ["sex"],
method = "ITT",
parameters = options)
model.expand() # Construct the nested structure
model.bootstrap(bootstrap_nboot = 20) # Run 20 bootstrap samples
model.fit() # Fit the model
model.survival() # Create survival curves
model.plot() # Create and show a plot of the survival curves
model.collect() # Collection of important information
Assumptions
There are several key assumptions in this package -
- User provided
time_colbegins at 0 per uniqueid_col, we also assume this column contains only integers and continues by 1 for every time step, e.g. (0, 1, 2, 3, 4, ...) is allowed and (0, 1, 2, 2.5, ...) or (0, 1, 4, 5) are not- Provided
time_colentries may be out of order at intake as a sort is enforced at expansion.
- Provided
eligible_coland elements ofexcused_colnamesare once 1, only 1 (with respect totime_col) flag variables.
Metadata
Release files for pySEQTarget 0.14.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyseqtarget-0.14.2.tar.gz | 101.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyseqtarget-0.14.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 181.7 kB
Release files / pyseqtarget-0.14.2.tar.gz
| Download URL | pyseqtarget-0.14.2.tar.gz |
|---|---|
| Size | 101.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc6483de03ceefde4a57e992a0fca0490b548233f703c89ba789f800d002808e
|
|
BLAKE2b-256 checksum How to use checksums |
c1c7856fbc6d3552e8347fab98fb6f51ab2290da7da46560df3e3be9cdf99fa5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency logRelease files / pyseqtarget-0.14.2-py3-none-any.whl
| Download URL | pyseqtarget-0.14.2-py3-none-any.whl |
|---|---|
| Size | 79.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b429d665e0c721b55dbb483d7cef5149bbce7e84142f58d3c7bc3ad43f254571
|
|
BLAKE2b-256 checksum How to use checksums |
8d16237ae28b12be2b0e36deafb03cfdd60f451cfed1b86494696882a3746f74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.
Transparency log