Skip to main content

Sequentially Nested Target Trial Emulation

Project description

pySEQTarget - Sequentially Nested 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyseqtarget-0.13.6.tar.gz (55.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyseqtarget-0.13.6-py3-none-any.whl (54.0 kB view details)

Uploaded Python 3

File details

Details for the file pyseqtarget-0.13.6.tar.gz.

File metadata

  • Download URL: pyseqtarget-0.13.6.tar.gz
  • Upload date:
  • Size: 55.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyseqtarget-0.13.6.tar.gz
Algorithm Hash digest
SHA256 37a615128ebe2287c0a4cf23e5cd661ecf934016e059a9f1e1912561bc2645ed
MD5 c4e88074e7b55bbba76de20aa35a8fa8
BLAKE2b-256 81c2dde475b738eb94600fa4135a6f13835c5ab69155dbd67c6a90da82c93975

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyseqtarget-0.13.6.tar.gz:

Publisher: publish.yml on CausalInference/pySEQTarget

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyseqtarget-0.13.6-py3-none-any.whl.

File metadata

  • Download URL: pyseqtarget-0.13.6-py3-none-any.whl
  • Upload date:
  • Size: 54.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyseqtarget-0.13.6-py3-none-any.whl
Algorithm Hash digest
SHA256 51ea38385f1816ced98ebfac14d7ce90475cb2a3ffb17c34339f8ae19a07ffec
MD5 9285d0bdd1430eddfad75d65cf2a304e
BLAKE2b-256 2970a40bb9c56473a6751c5c16778ccce0b924896081666cf74576964f1a7c02

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyseqtarget-0.13.6-py3-none-any.whl:

Publisher: publish.yml on CausalInference/pySEQTarget

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page