Title: | Quantile Regression Model for Residual Lifetime Using an Induced Smoothing Approach |
---|---|
Description: | A collection of functions is provided by this package to fit quantiles regression models for censored residual lifetimes. It provides various options for regression parameters estimation: the induced smoothing approach (smooth), and L1-minimization (non-smooth). It also implements the estimation methods for standard errors of the regression parameters estimates based on an efficient partial multiplier bootstrap method and robust sandwich estimator. Furthermore, a simultaneous procedure of estimating regression parameters and their standard errors via an iterative updating procedure is implemented (iterative). For more details, see Kim, K. H., Caplan, D. J., & Kang, S. (2022), "Smoothed quantile regression for censored residual life", Computational Statistics, 1-22 <doi:10.1007/s00180-022-01262-z>. |
Authors: | Kyu Hyun Kim [aut, cre], Sangwook Kang [aut], Sy Han Chiou [aut] |
Maintainer: | Kyu Hyun Kim <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.1.1 |
Built: | 2024-11-21 04:35:59 UTC |
Source: | https://github.com/kyuhyun07/qris |
This package offers a collection of functions to fit quantiles regression models for censored residual lifetimes. It provides various options for regression parameters estimation: the induced smoothing approach (smooth), and L1-minimization (non-smooth). It also implements the estimation methods for standard errors of the regression parameters estimates based on an efficient partial multiplier bootstrap method and robust sandwich estimator. Furthermore, a simultaneous procedure of estimating regression parameters and their standard errors via an iterative updating procedure is implemented (iterative). See Kim, K. (2022) "Smoothed quantile regression for censored residual life", <arXiv:2205.00413>.
Maintainer: Kyu Hyun Kim [email protected]
Authors:
Sangwook Kang
Sy Han Chiou
Useful links:
Surv
function imported from survival
This function is imported from the survival
package. See
Surv
.
An object of class Surv
. There are methods for print
, is.na
, and subscripting survival objects.
Surv
objects are implemented as a matrix of 2 or 3 columns that has further attributes.
These include the type (left censored, right censored, counting process, etc.) and labels for the states for multi-state objects.
Any attributes of the input arguments are also preserved in inputAttributes
.
This may be useful for other packages that have attached further information to data items such as labels;
none of the routines in the survival package make use of these values, however.
In the case of is.Surv
, a logical value TRUE
if x
inherits from class "Surv"
, otherwise an FALSE
.
Draw 95% confidence interval by a quantile regression estimator of residual lifetime from survival data
## S3 method for class 'qris' plot( x, t0s = NULL, Qs = NULL, nB = NULL, vari = NULL, byQs = FALSE, ggextra = NULL, ... )
## S3 method for class 'qris' plot( x, t0s = NULL, Qs = NULL, nB = NULL, vari = NULL, byQs = FALSE, ggextra = NULL, ... )
x |
is an " |
t0s |
is a vector of range of |
Qs |
is a vector of range of |
nB |
is the number of multiplier bootstrapping for standard error estimation. |
vari |
is a character string to choose variables to draw the regression coefficient. |
byQs |
put |
ggextra |
is a list that contains additional components to apply to the |
... |
for future extension |
A list contains ggplot
object and the information to generate it.
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 library(qris) fm <- Surv(time, status) ~ age + sex fit <- qris(fm, data = lung2, t0 = 30, Q = 0.5, nB = 50, "nonsmooth", "fmb") ## Plot with default values; Qs <- 1:9 / 10 and t0s = fit2$para$t0 (in this case 30) plot(fit) ## Plot with without 95% CI is much faster plot(fit, nB = 0) ## Plot feature can update qris calls fit <- plot(fit, Qs = 3:6 / 10, t0s = 1:6 * 10) ## Faster after updating the qris call plot(fit, byQs = FALSE) plot(fit, byQs = TRUE) plot(fit, byQs = FALSE, vari = c("sex", "age")) plot(fit, byQs = TRUE, vari = c("sex", "age")) ## Extra ggplot components library(ggplot2) plot(fit, byQs = FALSE, vari = c("sex", "age"), ggextra = theme(legend.position = "none"))
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 library(qris) fm <- Surv(time, status) ~ age + sex fit <- qris(fm, data = lung2, t0 = 30, Q = 0.5, nB = 50, "nonsmooth", "fmb") ## Plot with default values; Qs <- 1:9 / 10 and t0s = fit2$para$t0 (in this case 30) plot(fit) ## Plot with without 95% CI is much faster plot(fit, nB = 0) ## Plot feature can update qris calls fit <- plot(fit, Qs = 3:6 / 10, t0s = 1:6 * 10) ## Faster after updating the qris call plot(fit, byQs = FALSE) plot(fit, byQs = TRUE) plot(fit, byQs = FALSE, vari = c("sex", "age")) plot(fit, byQs = TRUE, vari = c("sex", "age")) ## Extra ggplot components library(ggplot2) plot(fit, byQs = FALSE, vari = c("sex", "age"), ggextra = theme(legend.position = "none"))
Prediction based on fitted quantile regression model
## S3 method for class 'qris' predict(object, newdata, ...)
## S3 method for class 'qris' predict(object, newdata, ...)
object |
is a qris object |
newdata |
is a data frame for an optional new data to do predictions. If omitted, the fitted values based on the original data and fit will be returned. |
... |
for future extension |
A vector of prediction
Using three estimation methods (1) L1-minimization(non-smooth estimating equation (2) Induced smoothing approach (smooth estimating equation (3) Iterative procedure with induced smoothing approach (smooth estimating equation
qris( formula, data, t0 = 0, Q = 0.5, nB = 100, method = c("smooth", "iterative", "nonsmooth"), se = c("fmb", "pmb"), init = c("rq", "noeffect"), verbose = FALSE, control = qris.control() )
qris( formula, data, t0 = 0, Q = 0.5, nB = 100, method = c("smooth", "iterative", "nonsmooth"), se = c("fmb", "pmb"), init = c("rq", "noeffect"), verbose = FALSE, control = qris.control() )
formula |
is a formula expression, of the form |
data |
is an optional |
t0 |
is the follow-up time (or basetime of analysis). The default followup time is set to 0. |
Q |
is the quantile. The default quantile is set to 0.5. |
nB |
is number of multiplier bootstrapping for V matrix estimation. The default number of bootstrapping is set to 100. |
method |
is an option for specifying the methods of parameters estimation;
|
se |
is an option for specifying the methods of standard errors estimation;
The available options are |
init |
is an option for specifying the initial values of the parameters estimates.
Available options are |
verbose |
Shows computation status. |
control |
controls maximum number of iteration, tolerance of convergence and whether to display output for each iteration when
|
An object of class "qris
" contains model fitting results.
The "qris
" object is a list containing at least the following components:
a vector of point estimates
a vector of standard error of point estimates
a matrix of the estimated variance-covariance matrix
a number of iteration until convergence (only for iterative procedure)
## ######################################### ## Simulated data ## ######################################### 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)) } set.seed(1) dat <- data.gen(200) fm <- Surv(Time, status) ~ X fit1 <- qris(fm, data = dat, t0 = 1, Q = 0.5, nB = 100, "smooth", "pmb", c(1,1)) fit2 <- qris(fm, data = dat, t0 = 1, Q = 0.5, nB = 100, "nonsmooth", "fmb", "rq") fit3 <- qris(fm, data = dat, t0 = 1, Q = 0.5, nB = 100, "iterative", "fmb", "rq", control = qris.control(maxit = 20, tol = 1e-3, trace = TRUE)) summary(fit1) summary(fit2) summary(fit3) ## ######################################### ## 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 = 100, "iterative", "pmb", "rq") fit2 <- qris(fm, data = lung2, t0 = 30, Q = 0.5, nB = 100, "nonsmooth", "fmb", c(1, 0, 1)) fit3 <- qris(fm, data = lung2, t0 = 100, Q = 0.5, nB = 100,"smooth", "pmb", "rq") summary(fit1) summary(fit2) summary(fit3) plot(fit2, Qs = 4:6 / 10)
## ######################################### ## Simulated data ## ######################################### 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)) } set.seed(1) dat <- data.gen(200) fm <- Surv(Time, status) ~ X fit1 <- qris(fm, data = dat, t0 = 1, Q = 0.5, nB = 100, "smooth", "pmb", c(1,1)) fit2 <- qris(fm, data = dat, t0 = 1, Q = 0.5, nB = 100, "nonsmooth", "fmb", "rq") fit3 <- qris(fm, data = dat, t0 = 1, Q = 0.5, nB = 100, "iterative", "fmb", "rq", control = qris.control(maxit = 20, tol = 1e-3, trace = TRUE)) summary(fit1) summary(fit2) summary(fit3) ## ######################################### ## 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 = 100, "iterative", "pmb", "rq") fit2 <- qris(fm, data = lung2, t0 = 30, Q = 0.5, nB = 100, "nonsmooth", "fmb", c(1, 0, 1)) fit3 <- qris(fm, data = lung2, t0 = 100, Q = 0.5, nB = 100,"smooth", "pmb", "rq") summary(fit1) summary(fit2) summary(fit3) plot(fit2, Qs = 4:6 / 10)
Auxiliary function as user interface for qris
fitting.
qris.control(maxiter = 10, tol = 0.001, trace = FALSE)
qris.control(maxiter = 10, tol = 0.001, trace = FALSE)
maxiter |
max number of iteration. |
tol |
tolerance of convergence |
trace |
a binary variable, determine whether to save output for each iteration. |
When trace
is TRUE, output for each iteration is printed to the screen.
A list with the arguments as components.
qris
" object to a specified range of
or
values.Extend a "qris
" object to a specified range of or
values.
qris.extend(x, t0s = NULL, Qs = NULL, nB = NULL, vari = NULL)
qris.extend(x, t0s = NULL, Qs = NULL, nB = NULL, vari = NULL)
x |
is an qris object or a data.frame returned by plot.qris |
t0s |
is a vector of range of t0 to plot; when not specified, the default value is from 0 to presently defined |
Qs |
is a vector of range of Q to plot; when not specified, the default value is from 5% to presently defined |
nB |
is the number of multiplier bootstrapping for standard error estimation. |
vari |
is a character string to choose variables to draw the regression coefficient. |
Residual based on fitted quantile regression model
## S3 method for class 'qris' residuals(object, newdata, ...)
## S3 method for class 'qris' residuals(object, newdata, ...)
object |
is a qris object |
newdata |
is a data frame for an optional new data to do predictions. If omitted, the fitted values based on the original data and fit will be returned. |
... |
for future extension |
A vector of residual