Description Usage Arguments Details Value Author(s) See Also Examples
This function draws a single time-series plot on the active graphics device.
1 2 |
d |
data.frame. Observations, where the first and second column is of class Date and Surv, respectively. The Surv component is of type interval and should not contain right-censored data. |
model |
survreg. Survival regression model |
plim |
numeric. Percentile limits defining the confidence band of the regression model. |
xlim |
Date. The x limits of plot. |
ylim |
numeric. The y limits of plot. |
main |
character. Main plot title |
ylab |
character. Label for y axis. |
Uncensored data is drawn as points. Left- and interval-censored data is drawn as vertical lines with short-horizontal lines at the interval bounds. Note that the lower bound of left-censored data is placed at zero. The 50th percentile of the regression model is drawn as a curved line. The confidence band is drawn as a solid polygon.
Used for the side-effect of a new plot generated.
J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # Create time-series data set with uncensored, left-censored, and interval-censored data
n <- 30
x <- as.Date(sort(sample(1:1000, n)), origin = as.Date("1992-02-15"))
time1 <- runif(n, min = 0, max = 100)
time2 <- time1 + runif(n, min = 0, max = 10)
time1[sample(1:n, 10)] <- NA
idxs <- sample(1:n, 10)
time1[idxs] <- time2[idxs]
y <- survival::Surv(time1, time2, type = "interval2")
d <- data.frame(x, y)
# Fit the data with a regression model
model <- survival::survreg(y ~ x, data = d)
# Plot the data and regression model
DrawPlot(d, model, plim = c(NA, 0.8), main = "Title", ylab = "Value")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.