-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathkmdata-ipd.Rmd
61 lines (48 loc) · 1.52 KB
/
kmdata-ipd.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
title: "kmdata - ipd"
output:
rmarkdown::html_vignette:
toc: true
vignette: >
%\VignetteIndexEntry{kmdata - ipd}
%\VignetteEngine{knitr::rmarkdown}
\usepackage[utf8]{inputenc}
---
```{r, include=FALSE}
library('knitr')
opts_chunk$set(
cache = FALSE, fig.align = 'center', dev = 'png',
fig.width=9, fig.height=7, echo = TRUE, message = FALSE
)
```
## Generating IPD
In addition to the recapitulated study data, the `kmdata` package contains
the algorithm to re-create patient-level time-to-event data from digitized
survival curves.
Digitized curves are simply the x- and y-coordinates of the Kaplan-Meier
curves which can be generated several ways including the \code{R} package
**`digitize`** or proprietary software such as
[DigitizeIt](https://digitizeit.soft112.com/).
```{r}
library('kmdata')
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)
aa <- read.csv(ar)
aa <- aa[aa$nrisk > 0, ]
pd <- ipd(dd$T, dd$S, aa$trisk, aa$nrisk, arm = 'Nivo')
kmplot(pd, conf.int = FALSE, median = FALSE)
points(S ~ T, dd, type = 's', col = 'red')
legend(
'topright', col = 1:2, lty = 1, bty = 'n', lwd = 2,
legend = c('Re-capitulated', 'Truth (no censoring\ndata available)')
)
```
## 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.