autoplot.riskIDM | R Documentation |
Diplay state occupancy probability of an Illness Death Model
## 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,
...
)
object |
[riskIDM] output of the |
by |
[character] should the occupancy probabilities of all states be displayed on the same graphic, possibly using a different panel for each scenario ( |
scenario |
[character vector] name of the scenarios to be displayed. Use |
state |
[character vector] name of the states to be displayed. Use |
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 |
ci |
[logical] should pointwise confidence intervals be displayed.
Not available for |
stackplot |
[logical] should the occupancy probability be cumulated over states under a specific scenario?
Only relevant when |
linewidth |
[numeric, >0] thickness of the line used to display the occupancy probabilities.
Only relevant for |
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 |
A ggplot2 object.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.