plot.qris: Draw 95% confidence interval by a quantile regression...

View source: R/plot.R

plot.qrisR Documentation

Draw 95% confidence interval by a quantile regression estimator of residual lifetime from survival data

Description

Draw 95% confidence interval by a quantile regression estimator of residual lifetime from survival data

Usage

## S3 method for class 'qris'
plot(
  x,
  t0s = NULL,
  Qs = NULL,
  nB = NULL,
  vari = NULL,
  byQs = FALSE,
  ggextra = NULL,
  ...
)

Arguments

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 t_0

Qs

is a vector of range of Q to plot; when not specified, the default value is from 5% to presently defined Q

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 Q's on x-axis; only used when both t0's and Q's are specified.

ggextra

is a list that contains additional components to apply to the ggplot output. The ggplot2 library must be loaded in order to utilize this feature.

...

for future extension

Value

A list contains ggplot object and the information to generate it.

Examples

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"))

qris documentation built on May 29, 2024, 8 a.m.