SEQuential

class pySEQTarget.SEQuential

Primary class initializer for SEQuentially nested target trial emulation

Parameters:
  • data (DataFrame) – Data for analysis

  • id_col (str) – Column name for unique patient IDs

  • time_col (str) – Column name for observational time points

  • eligible_col (str) – Column name for analytical eligibility

  • treatment_col (str) – Column name specifying treatment per time_col

  • outcome_col (str) – Column name specifying outcome per time_col

  • time_varying_cols (Optional[List[str]]) – Time-varying column names as covariates (BMI, Age, etc.)

  • fixed_cols (Optional[List[str]]) – Fixed column names as covariates (Sex, YOB, etc.)

  • method (Literal['ITT', 'dose-response', 'censoring']) – Method for analysis [‘ITT’, ‘dose-response’, or ‘censoring’]

  • parameters (Optional[SEQopts]) – Parameters to augment analysis, specified with pySEQTarget.SEQopts

__init__(data, id_col, time_col, eligible_col, treatment_col, outcome_col, time_varying_cols=None, fixed_cols=None, method='ITT', parameters=None)
bootstrap(**kwargs)

Internally sets up bootstrapping - creating a list of IDs to use per iteration

Return type:

None

collect()

Collects all results currently created into SEQoutput class

Return type:

SEQoutput

expand()

Creates the sequentially nested, emulated target trial structure. If expand_only is set in parameters, returns the expanded dataset as a polars.DataFrame and skips all subsequent analysis steps.

fit()

Fits weight models (numerator, denominator, censoring) and outcome models (outcome, competing event)

Return type:

None

hazard()

Uses fit outcome models (outcome, competing event) to estimate hazard ratios

Return type:

None

plot(**kwargs)

Shows a plot specific to plot_type

Return type:

None

survival(**kwargs)

Uses fit outcome models (outcome, competing event) to estimate risk, survival, and incidence curves

Return type:

None