| add_inspections | R Documentation |
Convenience helper to manufacture interval-censored (panel) data from exact
simulated survival times (e.g.\ the output of sim_pexp), for
coverage studies and examples. Each subject is "inspected" at a sequence of
times; the true event time is then only known to lie between the last clean
and the first positive inspection. The exact time is retained (by default in
column true_time) so that coverage can be scored against the truth.
add_inspections(
data,
time_var = "time",
status_var = "status",
mechanism = c("random", "fixed", "mixed"),
rate = 1,
schedule = NULL,
max_time = NULL,
terminal_exam = TRUE,
keep_truth = TRUE,
L = "L",
R = "R"
)
data |
A data frame with one row per subject containing an exact event
time and a status indicator (as produced by |
time_var, status_var |
Names of the (exact) event-time and status columns.
|
mechanism |
Inspection mechanism: |
rate |
Inspection rate for |
schedule |
Numeric vector of inspection times for
|
max_time |
Inspection horizon. Defaults to |
terminal_exam |
Logical; if |
keep_truth |
Logical; keep the exact event time in |
L, R |
Names of the created lower/upper bound columns. |
data augmented with interval bounds in columns L and
R (and true_time). Use
Surv(L, R, type = "interval2") on the result.
pamm_ic, sim_pexp
set.seed(1)
df <- data.frame(x = runif(100, -1, 1))
sdf <- sim_pexp(~ -2 + 0.4 * x, df, cut = seq(0, 10, by = 0.5))
icd <- add_inspections(sdf, rate = 1)
fit <- pamm_ic(Surv(L, R, type = "interval2") ~ x, icd, m = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.