Skip to content

Estimate Inverse Probability Weights

0packages dependsuggested by 1
19.9Kdownloads / year
42.2%test coverage
12/13flavors OK

Overview

About

Functions to estimate the probability to receive the observed treatment, based on individual characteristics. The inverse of these probabilities can be used as weights when estimating causal effects from observational data via marginal structural models. Both point treatment situations and longitudinal studies can be analysed. The same functions can be used to correct for informative censoring.

Changes in 1.3.0
  • **New Maintainer**: Hung Thai Tran (Research Assistant, OUCRU Biostatistics Group).
  • **Documentation Infrastructure**: Converted all package documentation to roxygen2.
  • **Testing**: Integrated a comprehensive suite of 22 unit tests using testthat to verify math for ipwpoint and ipwtm.
  • **Data Documentation**: Updated haartdat variables and fixed documentation for datasets to resolve CRAN warnings.
  • **Examples**: Corrected example line widths in .Rd files to prevent truncation in PDF manuals.
  • **UI**: Added a README.Rmd with updated simulation examples for point-treatment and time-varying causal inference workflows.

From NEWS.md in the release

Install

Health

CRAN checks
1ERROR12OK
Check messages
ERRORexamplesr-devel-linux-x86_64-debian-gcc
Running examples in ‘ipw-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: ipwtm
> ### Title: Estimate Inverse Probability Weights (Time Varying)
> ### Aliases: ipwtm
> ### Keywords: htest models
> 
> ### ** Examples
> 
> ########################################################################
> #EXAMPLE 1
> 
> #Load longitudinal data from HIV positive individuals.
> data(haartdat)
> 
> #CD4 is confounder for the effect of initiation of HAART therapy on mortality.
> #Estimate inverse probability weights to correct for confounding.
> #Exposure allocation model is Cox proportional hazards model.
> temp <- ipwtm(
+   exposure = haartind,
+   family = "survival",
+   numerator = ~ sex + age,
+   denominator = ~ sex + age + cd4.sqrt,
+   id = patient,
+   tstart = tstart,
+   timevar = fuptime,
+   type = "first",
+   data = haartdat)
Error in a$specials[[i]] : subscript out of bounds
Calls: ipwtm ... survfit.coxph -> model.matrix.coxph -> delete.response -> off
Execution halted
ERRORtestsr-devel-linux-x86_64-debian-gcc
Running ‘testthat.R’ [3s/4s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional test configuration?
  > # Learn more about the roles of various files in:
  > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
  > # * https://testthat.r-lib.org/articles/special-files.html
  > 
  > library(testthat)
  > library(ipw)
  > 
  > test_check("ipw")
  Saving _problems/test-ipwtm-20.R
  [ FAIL 1 | WARN 0 | SKIP 0 | PASS 18 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-ipwtm.R:10:3'): ipwtm correctly calculates cumulative weights for survival family ──
  <subscriptOutOfBoundsError/error/condition>
  Error in `a$specials[[i]]`: subscript out of bounds
  Backtrace:
      ▆
   1. └─ipw::ipwtm(...) at test-ipwtm.R:10:3
   2.   └─survival::basehaz(mod1, centered = TRUE)
   3.     ├─survival::survfit(fit, se.fit = FALSE)
   4.     └─survival:::survfit.coxph(fit, se.fit = FALSE)
   5.       └─survival:::model.matrix.coxph(object, data = mf)
   6.         └─stats::delete.response(object$terms)
   7.           └─stats (local) off(a$specials[[i]])
  
  [ FAIL 1 | WARN 0 | SKIP 0 | PASS 18 ]
  Error:
  ! Test failures.
  Execution halted

CRAN check page ↗

Slowest check: 2.2 min · r-oldrel-windows-x86_64
Status changes
  • ERROR12 OK, 1 ERROR2026-10-24
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK13 OK2026-06-09
  • ERROR12 OK, 1 ERROR2026-06-08
Show 1 earlier changeHide 1 earlier change
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 1.3.0
READMEYes · 272 wordsVignettesNoNEWSYes · 67% structured · mentions 1.3.0Citation fileYes · cites a publicationWebsitenot declared in DESCRIPTION
Cites a JSS article
Help pages
8
Examples that run
38%3 run in a plain check · 5 hold no code
Exported functions with examples
100%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
100%

Downloads

19.9K
CRAN downloads in the past year
Rank #3,231 · ~55/day · ~1.7K/mo
Daily download trend is not available in this view yet.
1.3K30 days
3.7K90 days
19.9K1 year
Compare downloads with other packages →
Also on141 r2u130 c2d4u

Repository

1Stars
2Forks
3Open issues
0Open PRs
0Releases
12Commits
1Commit identities
12 commits · Last activity 2026-01-27 · 0% stars, 30d
Responsiveness
How these are sampled
PRs merged (all time)
not measured
Median days to close, 50 most recently updated closed issues
0
Median days to close, 50 most recently updated closed PRs
not measured

Stars over time

2026-04-20 · 12026-07-07 · 1
PracticesBeta

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

Checks run against github.com/tranhung93/ipw on 2026-10-21.

Continuous integration (1)
GitHub Actions
Docs source (1)
README.Rmd
CRAN release process (3)
cran-comments.mdrevdep/CRAN-SUBMISSION
Lint, format, editor (1)
RStudio project
Show all practicesHide 1 practice
Git structural (1)
.gitattributes
How this is detected·Detection ruleset v4 (2026-10-20)

Dependencies

Declared dependencies
3 external dependencies (excludes base and recommended)

Installing ipw adds 23 packages (14 with compiled code, 18 MB of source tarballs). Heaviest: stringi 11 MB, vctrs 1.0 MB, dplyr 902 KB.

Depends (1)
R >= 3.2.0
Imports (7)
MASSnnetsurvivalgeepackgraphicsmethodsstats
LinkingTo (0)
none
Suggests (4)
Enhances (0)
none
Reverse dependencies
0direct
0indirect
Suggested by 1
Suggests, most downloaded first

Datasets

People & History

People (3)
Author, Maintainer since 1.2.2 (2025)
Author
maintainer 2011-2022

Previously maintained by Willem M. van der Wal (1.2 to 1.2.1.1) and Ronald B. Geskus (1.0 to 1.0-11).

Listed in earlier versions (3)
Show 3 peopleHide 3 people
Ronald B.
no longer listed · 1.0-11 to 1.3.0
Willem M.
no longer listed · 1.0-11 to 1.3.0
Hung Thai
no longer listed · 1.2.2 to 1.3.0
Releases (17)

Pick two releases to compare their code metrics.

  • R
    R 4.6.0 released · 2026-04-24
  • 1.3.0Latest
    record
    2026-01-27 · current release · diff ↗
  • 1.2.2
    record
    2025-12-08 · diff ↗
  • 1.2.1.1
    record
    2025-07-28 · diff ↗
  • R
    R 4.5.0 released · 2025-04-11
  • R
    R 4.4.0 released · 2024-04-24
  • 1.2.1
    record
    2023-12-11 · diff ↗
  • R
    R 4.3.0 released · 2023-04-21
  • unarchivedReturned to CRAN
    2023-01-07
  • 1.2
    record
    2023-01-07 · diff ↗
  • archivedRemoved from CRAN
    2022-10-07
    email to the maintainer is undeliverable
  • R
    R 4.2.0 released · 2022-04-22
  • R
    R 4.1.0 released · 2021-05-18
  • R
    R 4.0.0 released · 2020-04-24
  • R
    R 3.6.0 released · 2019-04-26
  • R
    R 3.5.0 released · 2018-04-23
Show 24 earlier eventsHide 24 earlier events
  • R
    R 3.4.0 released · 2017-04-21
  • R
    R 3.3.0 released · 2016-05-03
  • 1.0-11
    record
    2015-08-18 · diff ↗
  • R
    R 3.2.0 released · 2015-04-16
  • R
    R 3.1.0 released · 2014-04-10
  • orphanedOrphaned by its maintainer
    2013-12-21
    maintainer address <w.m.vd.wal@umcutrecht.nl> bounced
  • R
    R 3.0.0 released · 2013-04-03
  • R
    R 2.15.0 released · 2012-03-30
  • R
    R 2.14.0 released · 2011-10-31
  • 1.0-10
    record
    2011-09-11 · diff ↗
  • R
    R 2.13.0 released · 2011-04-13
  • 1.0-9
    record
    2011-04-04 · diff ↗
  • R
    R 2.12.0 released · 2010-10-15
  • 1.0-8
    record
    2010-09-30 · diff ↗
  • 1.0-7
    record
    2010-09-09 · diff ↗
  • 1.0-6
    record
    2010-08-20 · diff ↗
  • R
    R 2.11.0 released · 2010-04-22
  • 1.0-5
    record
    2010-03-25 · diff ↗
  • 1.0-4
    record
    2010-03-08 · diff ↗
  • 1.0-3
    record
    2010-03-05 · diff ↗
  • 1.0-2
    record
    2010-02-14 · diff ↗
  • 1.0-1
    record
    2010-02-08 · diff ↗
  • 1.0
    record
    2010-02-04
  • R
    R 2.10.0 released · 2009-10-26

Package metadata

First published
2010-02-04
Total releases
17 / 16 yrs
License
MIT + file LICENSE OSI · relicensed from GPL (>= 2) in 1.3.0
Minimum R
≥ 3.2.0
Bundled data
78 KB / 4 files
Download size
121 KB
Appears in task views

Cite

Cite this package

Run in R for the authors' entry:

citation("ipw")

The package provides a citation file, so citation() returns the authors' own entry.

It points to 10.18637/jss.v043.i13.

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 ipw version 1.3.0 [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