Skip to content

gfoRmula

1.1.1

Parametric G-Formula

0packages depend
6.2Kdownloads / year
67.4%test coverage
12/13checks pass

Overview

About
Maintained by Sean McGrathFirst published 2019-08-2511 releasesCRAN page ↗GitHub ↗

Implements the non-iterative conditional expectation (NICE) algorithm of the g-formula algorithm (Robins (1986) doi:10.1016/0270-0255(86)90088-6, Hernán and Robins (2024, ISBN:9781420076165)). The g-formula can estimate an outcome's counterfactual mean or risk under hypothetical treatment strategies (interventions) when there is sufficient information on time-varying treatments and confounders. This package can be used for discrete or continuous time-varying treatments and for failure time outcomes or continuous/binary end of follow-up outcomes. The package can handle a random measurement/visit process and a priori knowledge of the data structure, as well as censoring (e.g., by loss to follow-up) and two options for handling competing events for failure time outcomes. Interventions can be flexibly specified, both as interventions on a single treatment or as joint interventions on multiple treatments. See McGrath et al. (2020) doi:10.1016/j.patter.2020.100008 for a guide on how to use the package.

Install

Health

CRAN checks
1ERROR12OK
Failing flavors
  • ERROR r-release-macos-x86_64
Slowest check: 30.1 min · r-release-macos-x86_64
Code health
Yes
Tests · ratio 0.02
67.4%
Coverage · measured lines
100%
Documentation · exports
13
Dependencies · direct
Check history
  • ERROR2026-05-02
    12 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE
  • OK2026-03-10
    14 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE

Documentation

Documentation
READMEYes · 101 wordsVignettesYes · dynamicpkgdown siteNoNEWSYes · 100% structuredCode of conductNoContributing guideNo
Examples that run
100%
Documented parameters
100%
Return-value docs
100%
References docs
9%

Downloads

6.2K
CRAN downloads in the past year
Rank #6,675 · ~17/day · ~518/mo
Daily download trend is not available in this view yet.
47930 days
1.4K90 days
6.2K1 year
Compare downloads with other packages →
Also on139 r2u7 autocran41 c2d4u

Repository

Repository
186Stars
73Forks
4Open issues
3Open PRs
0Releases
84Commits
3Contributors
84 commits · Last activity 2025-11-03 · +1.1% stars, 30d

Stars over time

2025-07-18 · 1762026-07-10 · 186

Repository practices

Upstream repositoryBeta

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

Checks run against github.com/causalinference/gformula on 2026-07-26.

Continuous integration (1)
GitHub Actions
Docs source (1)
README.Rmd
Lint, format, editor (1)
RStudio project
How this is detected·Detection ruleset v1 (2026-07-18)

Dependencies

Declared dependencies
12 external dependencies (excludes base and recommended)
Depends (1)
R >= 3.5.0
Imports (13)
data.tableggplot2ggpubrgrDevicesnnetparallelprogressstatsstringrsurvivaltruncnormtruncregutils
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

Code & Tests

People & History

People (11)
Maintainer (1)
Author, Maintainer
Authors (10)
Author, Maintainer
Author · added in 1.1.0
Author · added in 1.1.0
Author · added in 1.0.2
Copyright holders (1)
Package Timeline

11 releases. Pick two to compare their code metrics. R releases are shown for context.

  • R
    R 4.6.0 released · 2026-04-24
  • R
    R 4.5.0 released · 2025-04-11
  • 1.1.1Latest
    2025-03-24 · current release · diff ↗
  • 1.1.0
    2024-10-01 · diff ↗
  • R
    R 4.4.0 released · 2024-04-24
  • 1.0.4
    2024-01-30 · diff ↗
  • 1.0.3
    2023-05-18 · diff ↗
  • R
    R 4.3.0 released · 2023-04-21
  • 1.0.2
    2023-02-27 · diff ↗
  • 1.0.1
    2023-01-12 · diff ↗
  • R
    R 4.2.0 released · 2022-04-22
  • 1.0.0
    2022-04-09 · diff ↗
  • 0.3.2
    2021-07-13 · diff ↗
  • R
    R 4.1.0 released · 2021-05-18
  • R
    R 4.0.0 released · 2020-04-24
  • 0.3.1
    2020-03-23 · diff ↗
Show 3 earlier events
  • 0.3.0
    2020-01-30 · diff ↗
  • 0.2.1
    2019-08-25
  • R
    R 3.6.0 released · 2019-04-26

Package metadata

First published
2019-08-25
Total releases
11 / 7 yrs
License
GPL-3 OSI
Minimum R
≥ 3.5.0
Bundled data
1.8 MB / 6 files
Download size
1.9 MB
Installed size
not tracked yet
With dependencies
not tracked yet
Appears in task views
Report a problem with this page →