Skip to main content

pySEQTarget - Sequential Target Trial Emulation

PyPI version Downloads codecovLicense: MIT versions Documentation Status

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 -

  1. User provided time_col begins at 0 per unique id_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
    1. Provided time_col entries may be out of order at intake as a sort is enforced at expansion.
  2. eligible_col and elements of excused_colnames are once 1, only 1 (with respect to time_col) flag variables.

Metadata

Release files for pySEQTarget 0.14.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pySEQTarget 0.14.4
File Size Uploaded Provenance Actions
pyseqtarget-0.14.4.tar.gz 114.1 kB With provenance Details for pyseqtarget-0.14.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pySEQTarget 0.14.4
File Interpreter ABI Platform Actions
pyseqtarget-0.14.4-py3-none-any.whl Python 3 none any Details for pyseqtarget-0.14.4-py3-none-any.whl

Total release size: 199.1 kB

Release files / pyseqtarget-0.14.4.tar.gz

Download URL pyseqtarget-0.14.4.tar.gz
Size 114.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2d48a64fb10f8cbfea4289cbaae228f200a573ee12614d2bf0aa4aa7e8222b0f
BLAKE2b-256 checksum
How to use checksums
8ebb064aa186c2a9a1c288b032230db609db30a0d1bec6514d6bd63fc5295f4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / pyseqtarget-0.14.4-py3-none-any.whl

Download URL pyseqtarget-0.14.4-py3-none-any.whl
Size 85.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06044f96da467bf7f2977260dcb320fb1a5a63e0d56d8fbcfb57a887db33d0cd
BLAKE2b-256 checksum
How to use checksums
b8cd19242ec4bd86605dff55e0cdb1edaacdd4e28a0ac76e0d7b4c0d971e8501
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Security for pySEQTarget 0.14.4

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyseqtarget-0.14.4.tar.gz

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 Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.14.4 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page