Skip to content

SEQTaRget

1.4.5Package record

Sequential Trial Emulation

0packages depend
5.2Kdownloads / year
93.2%test coverage
13/13flavors OK

Overview

About

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).

Changes in 1.4.5
  • Drop the unused doFuture and doRNG dependencies.
  • Give an informative error when a model term is undefined for some rows (e.g. log() of a non-positive value), naming the term, instead of NROW(y) == nrow(x) is not TRUE. Such rows were silently dropped from the model matrix, despite na.action = na.pass, which model.matrix() ignores.
  • Fix the end-of-follow-up Trial-periods (Eligible) count including trial-periods that start too late to reach the window before the data end, which also inflated Censored and % Censored. Estimates are unchanged.
  • Fix deviation.excused_cols excusing deviations in every arm; column i now excuses only deviations by people following treat.level[[i]]. Deviation analyses are currently disabled, so no results change.
  • Fix the expansion reading excused.cols the opposite way to the weight models. Column i now excuses a switch away from treat.level[[i]] throughout (e.g. excusedZero = 1 excuses a switch from 0 to 1), which changes every excused = TRUE analysis.
  • Run the post-expansion excused-censoring coefficient test without weight.upper = 1 truncation.
  • Leave each subject's first row out of the pre-expansion treatment weight models. It has no previous treatment, so it was fitted under the first level of treat.level, making estimates depend on that order. This shifts pre-expansion weighted estimates, most for excused censoring.
  • Fix subgroup risks, survival curves and hazard ratios being standardized over the whole population rather than the subgroup; each subgroup's results now equal an analysis of that subgroup alone. Results without subgroup are unchanged.
  • Fix subgroup bootstrap results being matched by position rather than by name, which mixed up subgroups when a resample missed one. Such resamples are now left out of that subgroup's confidence intervals, with a warning.
  • Fix the excused-censoring weights, which depended on the order of treat.level and, for post-expansion weights, were wrong by default (only the first arm was converted to the probability of remaining uncensored).
  • SEQuential() now restores the caller's future plan on exit, including on error, rather than resetting it to "sequential", and no longer registers a global foreach backend.
  • Fix SEQuential() converting a data.frame passed as data into a data.table in the caller's environment.
Show all changes in 1.4.5Hide the rest of the changes in 1.4.5
  • Fix SEQuential() printing "Creating Survival Curves for 1" (or for each subgroup) with verbose = FALSE when km.curves = TRUE.
  • Fix the expansion failing on column names containing "_bas" or "_sq" other than at the end (e.g. bmi_baseline); the indicators are now matched only as a suffix.
  • Fix the multinomial treatment model (multinomial = TRUE), which was fit one-vs-rest but predicted with a softmax, biasing the weights; it is now fit as baseline-category logits. This changes weighted multinomial analyses with three or more treatment values.
  • Fix the treatment weights being inverted when treat.level is not c(0, 1) or when multinomial = TRUE. Binary analyses with the default treat.level are unchanged.
  • Fix transformed terms such as log(x) being replaced by the raw variable in the weight models and some outcome predictions; only formulas of bare variable names now take the fast model-matrix path.
  • Fix the default outcome model dropping every fixed covariate, not just the subgroup variable, when subgroup is set. This changes subgroup estimates that use the default outcome model.
  • Stop converting numeric fixed.cols to factors, so continuous covariates such as age enter the models as a single term (a 0/1 covariate's coefficient is now named e.g. sex rather than sex1). **Integer-coded categorical fixed covariates (e.g. region coded 1-5) must now be supplied as factor or character columns.**
  • Validate in SEQopts() that covariates, cense.numerator, cense.denominator, visit.numerator and visit.denominator are single formula strings, and that numerator/denominator are non-empty. These are scalar by construction - they are tested downstream with is.na() and ||, which errors with 'length = 2' in coercion to 'logical(1)' on a vector, or missing value where TRUE/FALSE needed on a zero-length value, several frames from the argument that caused it. The error now names the offending argument at the point it is supplied. numerator and denominator may still be a character vector with one formula per treat.level, which is validated against treat.level as before.
  • Allow a flexible function of time for the baseline hazard in the weight models through weight.spline and weight.spline.df in SEQopts(). The default weight models are quadratic in time - followup, followup_sq, trial and trial_sq when weight.preexpansion = FALSE, the time column and its square when weight.preexpansion = TRUE - which only allows the hazard of treatment to rise or flatten off. With weight.spline = TRUE each of those quadratics is replaced by a natural cubic spline basis (splines::ns()) with weight.spline.df degrees of freedom (default 4, i.e. 3 interior knots at quantiles), so the baseline hazard can take a flexible shape over follow-up. This covers the treatment weight models and, where specified, the cense and visit models, under both settings of weight.preexpansion. Weight models supplied through numerator, denominator, cense.numerator, cense.denominator, visit.numerator or visit.denominator are left as written, so ns() terms can also be placed by hand for finer control.
  • Fix ns(x, df = N) terms in any model formula silently using a different spline basis when fitting and when predicting. splines::ns() recomputes its knots from whatever rows it is passed, and the weight models are fit on one row subset (e.g. the denominator model excludes followup == 0) and then used to predict over another, so the knots - and hence the basis - differed between the two, and differed again in each bootstrap resample. Knots are now fixed from the full data the model is fit on before fitting, for the outcome, treatment weight, censoring and visit models alike, so the basis is identical at fit and prediction time and constant across resamples. Previously this affected only user-supplied ns() terms; a spline on followup in a post-expansion weight model changed weights by up to 0.21 in the package's own example data. Formulas that already give explicit knots/Boundary.knots are unchanged, as are terms whose variable is absent or non-numeric.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 16.6 min · r-release-macos-x86_64
Status changes
  • OK13 OK2026-09-08
  • ERROR12 OK, 1 ERROR2026-09-07
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 1.4.5
READMEYes · 715 wordsVignettesYes · 6 · evaluation depends on the environmentNEWSYes · 100% structured · mentions 1.4.5Citation fileNoWebsiteYes · pkgdown
Help pages
69 (49 internal)includes a package overview page
Examples that run
0%1 only when donttest examples are enabled (R CMD check --as-cran)
Exported functions with examples
7%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
0%

Downloads

5.2K
CRAN downloads in the past year
Rank #8,449 · ~14/day · ~435/mo
Daily download trend is not available in this view yet.
41130 days
1.1K90 days
5.2K1 year
Compare downloads with other packages →
Also on167 r2u3 autocran

Repository

9Stars
6Forks
0Open issues
0Open PRs
28Releases
754Commits
2Commit identities
biostatisticscausal-inferenceepidemiologyinitiatorsper-protocolas-treatedintention-to-treatr-package
License file reads as MIT · 754 commits · Last activity 2026-10-12 · 0% stars, 30d · Discussions: 1 post
Responsiveness
How these are sampled
PRs merged (all time)
97%
Median days to close, 50 most recently updated closed issues
1
Median days to close, 50 most recently updated closed PRs
0

Stars over time

2025-08-21 · 22026-09-23 · 9
PracticesBeta

8 development-tooling and community-health practices detected across 6 families in the upstream repository

Checks run against github.com/causalinference/seqtarget on 2026-10-21.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Governance and community (1)
Issue templates
Docs source (2)

GitHub Pages site last deployed 2026-10-13 · The repository has a site deploy workflow

pkgdown site last built 2026-10-13

Coverage (1)
Coverage reporting (Codecov)
Show all practicesHide 2 practices
Research and citation (1)
CITATION.cff
Git structural (1)
.gitattributes
How this is detected·Detection ruleset v4 (2026-10-20)

Dependencies

Declared dependencies
11 external dependencies (excludes base and recommended)

Installing SEQTaRget adds 42 packages (21 with compiled code, 53 MB of source tarballs). Heaviest: BH 14 MB, stringi 11 MB, ggplot2 6.0 MB.

Depends (1)
R >= 4.1
LinkingTo (0)
none
Suggests (2)
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

Datasets

People & History

People (6)
Author, Maintainer since 0.13.1 (2025)
Author · added in 1.4.4
Author · added in 1.4.1
Author · added in 1.0.0
Listed in earlier versions (2)
Miguel Hernan
no longer listed · 0.13.1 to 1.3.3
Miguel Hernán
no longer listed · 1.3.4 to 1.4.3
Releases (15)

Pick two releases to compare their code metrics.

Show 1 earlier eventHide 1 earlier event
  • R
    R 4.5.0 released · 2025-04-11

Package metadata

First published
2025-09-15
Total releases
15 / 1 yrs
License
MIT + file LICENSE OSI
Minimum R
≥ 4.1
Bundled data
1.6 MB / 3 files
Download size
1.9 MB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("SEQTaRget")
O'Dea, R., The President and Fellows of Harvard College, Hernán, M. A., Madley-Dowd, P., Palmer, T., & Szmulewicz, A. (2026). SEQTaRget: Sequential Trial Emulation (Version 1.4.5) [Computer software]. https://doi.org/10.32614/CRAN.package.SEQTaRget

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

The repository also keeps a CITATION.cff.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for SEQTaRget version 1.4.5 [Data set]. HJJB, LLC. Data release v2026-10-24. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-24, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy