autoplot.riskIDM: Graphical display for For Illness Death Model

autoplot.riskIDMR Documentation

Graphical display for For Illness Death Model

Description

Diplay state occupancy probability of an Illness Death Model

Usage

## S3 method for class 'riskIDM'
autoplot(
  object,
  by = "scenario",
  scenario = NULL,
  state = NULL,
  indiv = FALSE,
  ci = NULL,
  stackplot = NULL,
  metric = "difference",
  linewidth = 2,
  ci.alpha = 0.2,
  breaks = NULL,
  ...
)

Arguments

object

[riskIDM] output of the riskIDM function.

by

[character] should the occupancy probabilities of all states be displayed on the same graphic, possibly using a different panel for each scenario ("scenario"). Or should the occupancy probabilities for all scenarios be displayed on the same graphic, possibly using a different panel for each state ("state").

scenario

[character vector] name of the scenarios to be displayed. Use "all" to display all scenarios.

state

[character vector] name of the states to be displayed. Use "all" to display all states.

indiv

[logical or character vector] should the occupancy probabilities be displayed separately for each combination of covariates using a different type of line. Not available for stackplot=TRUE.

ci

[logical] should pointwise confidence intervals be displayed. Not available for stackplot=TRUE and require a non-parametric bootstrap has been performed when running the riskIDM function.

stackplot

[logical] should the occupancy probability be cumulated over states under a specific scenario? Only relevant when by equals "scenario".

linewidth

[numeric, >0] thickness of the line used to display the occupancy probabilities. Only relevant for type="curve" and type="stackcurve".

ci.alpha

[numeric, 0-1] transparency parameter for the pointwise confidence intervals.

breaks

[numeric vector, 0-1] labels used for the y-axis

...

not used

Value

A ggplot2 object.

Examples

library(survival)
library(mstate)
library(ggplot2)
library(riskRegression)

#### data (remove ties) ###
data(ebmt3)
set.seed(10)
noise <- sort(rnorm(NROW(ebmt3$prtime),sd = 0.00001))
ebmt3$prtime <- ebmt3$prtime/365.25 + noise
ebmt3$rfstime <- ebmt3$rfstime/365.25 + noise

#### fit IDM ####
e.riskPH <- riskIDM(~1, data = ebmt3, PH = FALSE,
                    var.id = "id", 
                    var.type = c("prstat", "rfsstat"),
                    var.time = c("prtime", "rfstime"))

e.riskPH2 <- riskIDM(~1, data = ebmt3, PH = FALSE, n.boot = 100,
                    var.id = "id", 
                    var.type = c("prstat", "rfsstat"),
                    var.time = c("prtime", "rfstime"))

#### graphical display ####
plot(e.riskPH)
plot(e.riskPH, scenario = "all")
plot(e.riskPH, stackplot = FALSE)
plot(e.riskPH2, stackplot = FALSE, scenario = "all")

plot(e.riskPH, by = "state")
plot(e.riskPH, by = "state", state = "all")
plot(e.riskPH2, by = "state", state = "all")

plot(e.riskPH, by = "contrast")

#### fit IDM with covariates ####
e.riskPH3 <- riskIDM(~age, data = ebmt3, PH = FALSE, 
                     var.id = "id", keep.indiv = TRUE,
                     var.type = c("prstat", "rfsstat"),
                     var.time = c("prtime", "rfstime"))

plot(e.riskPH3, by = "state", state = "all", indiv = TRUE)
plot(e.riskPH3, by = "state", state = "all", indiv = ">40")
plot(e.riskPH3, by = "state", state = "all", indiv = c(">40","<=20"))
plot(e.riskPH3, by = "state", state = "all", indiv = FALSE)

bozenne/butils documentation built on Oct. 14, 2023, 6:19 a.m.