/
README.Rmd
91 lines (65 loc) · 3.32 KB
/
README.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
output:
github_document:
fig_width: 10
fig_height: 8
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
echo = TRUE,
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# hrcomprisk: Nonparametric Assessment of Differences Between Competing Risks Hazards
<!-- badges: start -->
<!-- badges: end -->
This package aims to estimate Nonparametric Cumulative-Incidence Based Estimation of the Ratios of Sub-Hazard Ratios to Cause-Specific Hazard Ratios.
## Installation
You can install the latest version of `hrcomprisk` in CRAN or the development version from [Github](https://github.com/AntiportaD/hrcomprisk):
``` r
# Install hrcomprisk from CRAN
install.packages("hrcomprisk")
# Or the development version from GitHub:
# install.packages("devtools")
devtools::install_github("AntiportaD/hrcomprisk")
```
## Using a formatted data set to apply the `hrcomprsk` package
You can use the dataset provided by the authors from the [CKiD study](https://statepi.jhsph.edu/ckid/), wich has the necessary variables to run the package.
```{r example}
library(hrcomprisk)
data <- hrcomprisk::dat_ckid
dim(data) #dimensions
names(data) #variable names
```
The package will create a `data.frame` object with the cumulative incidence of each competing risk for each exposure group. We can use the `CRCumInc` fuction.
```{r CRCumInc_example}
mydat.CIF<-CRCumInc(df=data, time=exit, event=event, exposed=b1nb0, print.attr=T)
```
## Using a the output to create Plots of CIFs and the Ratio of Hazard Ratios (Rk)
We can also obtain two different plots using the `plotCIF` function:
1. The Cumulative Incidence of both events of interest, overall and by exposure level, and
2. The ratios of Hazard ratios (sub-distribution Hazard Ratio and cause-specific Hazard Ratio) by event.
```{r plotCIF}
plots<-plotCIF(cifobj=mydat.CIF, maxtime = 20, eoi = 1)
```
## Bootstrapping the data to get 95% Confidence Intervals for the Ratio of Hazard Ratios (Rk)
In order to get confidence intervals to the ratio of Hazard Ratios (Rk), we can use the `bootCRCumInc` function:
```{r boot_example}
ciCIF<-bootCRCumInc(df=data, exit=exit, event=event, exposure=b1nb0, rep=100, print.attr=T)
```
Finally, we can use this new data to add the 95% Confidence Intervals to the previous plot using again the `plotCIF` function.
```{r plot_ci}
plotCIF(cifobj=mydat.CIF, maxtime= 20, ci=ciCIF)
```
## The wrapper function `npcrest`
The package also offers a wrapper function (`npcrest`) to do all these analyses in one step.
```{r npcrest}
npcrest(df=data, exit=exit, event=event, exposure=b1nb0,rep=100, maxtime=20, print.attr=T)
```
## References
1. Ng D, Antiporta DA, Matheson M, Munoz A. Nonparametric assessment of differences between competing risks hazard ratios: application to racial differences in pediatric chronic kidney disease progression. Clinical Epidemiology, 2020. [Link to Journal](https://doi.org/10.2147/CLEP.S225763)
2. Muñoz A, Abraham AG, Matheson M, Wada N. In: Risk Assessment and Evaluation of Predictions. Lee MLT, Gail M, Pfeiffer R, Satten G, Cai T, Gandy A, editor. New York: Springer; 2013. Non-proportionality of hazards in the competing risks framework; pp. 3–22. [Google Scholar](https://link.springer.com/chapter/10.1007/978-1-4614-8981-8_1)