Get the risk set at each bin over an equidistant distant grid.
get_risk_obj(
Y,
by,
max_T,
id,
is_for_discrete_model = TRUE,
n_threads = 1,
min_chunk = 5000
)
a list with the following elements
list of lists with one for each bin. Each of the sub lists have indices that corresponds to the entries of Y
that are at risk in the bin.
start time of the first bin.
length of each bin.
number of bins.
indices for which bin an observation Y
is an event. -1
if the individual does not die in any of the bins.
value of is_for_discrete_model
argument.
vector of outcome variable returned from Surv
.
length of each bin.
last observed time.
vector with ids where entries match with outcomes Y
.
TRUE
if the model outcome is discrete. For example, a logit model is discrete whereas what is is referred to as the exponential model in this package is a dynamic model.
set to a value greater than one to use mclapply
to find the risk object.
minimum chunk size of ids to use when parallel version is used.
# small toy example with time-varying covariates
dat <- data.frame(
id = c(1, 1, 2, 2),
tstart = c(0, 4, 0, 2),
tstop = c(4, 6, 2, 4),
event = c(0, 1, 0, 0))
with(dat, get_risk_obj(Surv(tstart, tstop, event), by = 1, max_T = 6, id = id))
Run the code above in your browser using DataLab