-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
96 lines (79 loc) · 4.12 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
92
93
94
95
96
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(comment = NA, prompt = TRUE, collapse = TRUE)
```
# The qris package
<!-- badges: start -->
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/ibq7asah7tmym46b/branch/master?svg=true)](https://ci.appveyor.com/project/stc04003/qris-shjbv/branch/master)
[![R-CMD-check](https://github.com/Kyuhyun07/qris/workflows/R-CMD-check/badge.svg)](https://github.com/Kyuhyun07/qris/actions)
<!-- badges: end -->
The __qris__ package implements estimation procedures for a regression model of the quantiles of residual life, remaining lifetime at a specific time, subject to right censoring. For estimation of regression parameters, we consider an induced smoothed method that solves smoothed weighted estimating equations. We also consider the estimation method that solves the original non-smooth weighted estimating equations via a L1 minimization method. To handle data subject to right censoring, inverse probabilities of censoring are incorporated as weights. For standard errors estimation, a robust sandwich-type covariance estimator aided by an efficient resampling method, and a full multiplier bootstrap approach are considered for the induced smoothed estimator (“smooth”) and non-smooth estimator (“nonsmooth”), respectively. Furthermore, an iterative procedure that simultaneously estimates regression parameters and their standard errors is implemented.
## Installation
You can install the released version of qris from [GitHub](https://github.com/Kyuhyun07/qris) with:
```{r github, eval = FALSE}
## install.packages("devtools")
devtools::install_github("Kyuhyun07/qris")
library(qris)
```
```{r, include = FALSE}
library(qris)
```
## Example
There are two examples to get started.
Here is a simulated data.
```{r example}
data.gen <- function(n) {
r0 <- .2 * sqrt(log(2))
r1 <- .1 * sqrt(log(2))
dat <- data.frame(censoring = runif(n, 0, 24.35),
Time0 = sqrt(-log(1 - runif(n))),
X = rbinom(n, 1, .5))
dat$Time0 <- ifelse(dat$X > 0, dat$Time0 / r1, dat$Time0 / r0)
dat$Time <- pmin(dat$Time0, dat$censoring)
dat$status <- 1 * (dat$Time0 < dat$censoring)
subset(dat, select = c(Time, status, X))
}
library(survival)
set.seed(1)
dat <- data.gen(200)
fm <- Surv(Time, status) ~ X
fit1 <- qris(fm, data = dat, t0 = 1, Q = 0.5, nB = 200, "smooth", "pmb", c(1,1))
fit2 <- qris(fm, data = dat, t0 = 1, Q = 0.5, nB = 200, "nonsmooth", "fmb", "rq")
fit3 <- qris(fm, data = dat, t0 = 1, Q = 0.5, nB = 200, "iterative", "fmb", "rq",
control = qris.control(maxit = 20, tol = 1e-3, trace = TRUE))
summary(fit1)
summary(fit2)
summary(fit3)
coef(fit1)
summary(fit2)
vcov(fit3)
plot(fit1, Qs = 4:6 / 10)
```
Here is a real data application.
```{r example2}
## Load "retinopathy" data from R survival package
library(survival)
## Real data application
data(cancer, package = "survival")
lung2 <- subset(lung, select = c(time, status, age, sex))
## tidy up the data
lung2$status <- lung2$status - 1
lung2$sex <- lung2$sex - 1
fm <- Surv(time, status) ~ age + sex
fit1 <- qris(fm, data = lung2, t0 = 0, Q = 0.5, nB = 200, "iterative", "pmb", "rq")
fit2 <- qris(fm, data = lung2, t0 = 30, Q = 0.5, nB = 200, "nonsmooth", "fmb", c(1, 0, 1))
fit3 <- qris(fm, data = lung2, t0 = 100, Q = 0.5, nB = 200,"smooth", "pmb", "rq")
summary(fit1)
summary(fit2)
summary(fit3)
plot(fit2, Qs = 4:6 / 10)
```
## Reference
Kim, K., and Kang, S., (2022). "Smoothed quantile regression for censored residual life". *Upcoming*
Chiou, S., Kang, S., and Yan, J. (2014). "Fitting accelerated failure time model in routine survival analysis with R package aftgee".
*Journal of Statistical Software*, **61**(11): 1--23.
Li, R., Huang, X., & Cortes, J. (2016). "Quantile residual life regression with longitudinal biomarker measurements for dynamic prediction". *Journal of the Royal Statistical Society*. **Series C** (Applied Statistics), 755-773.
Jung, S. H., Jeong, J. H., & Bandos, H. (2009). "Regression on quantile residual life". *Biometrics*, **65**(4), 1203-1212.