ipd: IPD

View source: R/ipd.R

ipdR Documentation

IPD

Description

Generate individual patient data (IPD) from digitized survival curve data using the method described by Guyot (2012).

Usage

ipd(
  time,
  prob,
  t.atrisk,
  n.atrisk,
  total = NA,
  arm = "arm",
  tau = max(time, t.atrisk),
  interpolate = FALSE
)

Arguments

time, prob

vectors of survival time and probabilities

t.atrisk, n.atrisk

vectors of times and number at-risk

total

(optional) total number of events

arm

(optional) arm label

tau

maximum follow-up time

interpolate

logical or integer; if TRUE or an integer, constant interpolation will be performed for the time-probability vectors; this may be helpful in situations with a small number of digitized points or if the censoring distribution is difficult to estimate

References

Guyot, Patricia, et al. Enhanced secondary analysis of survival data: reconstructing the data from published Kaplan-Meier survival curves. BMC Medical Research Methodology 2012, 12:9.

Examples

## Not run: 
xy <- system.file(
  'etc', 'init', 'Checkmate_067_S3A_Nivolumab.csv',
  package = 'kmdata'
)
ar <- system.file(
  'etc', 'init', 'Checkmate_067_At_Risk.csv',
  package = 'kmdata'
)
dd <- read.csv(xy)
ar <- read.csv(ar)

## generate the patient-level censored data
ipd1 <- ipd(dd$T, dd$S, ar$trisk, ar$nrisk, arm = 'Nivo')
with(ipd1, tapply(time, event, summary))

## convenience function to plot
kmplot(ipd1, xaxis.at = ar$trisk)

## overlay raw coordinates from digitization
lines(dd$T, dd$S, col = 2)

## End(Not run)


raredd/kmdata documentation built on June 15, 2025, 9:33 a.m.