# get_risk_obj

##### Risk Set on an Equidistant Distant Grid

Get the risk set at each bin over an equidistant distant grid.

##### Usage

```
get_risk_obj(Y, by, max_T, id, is_for_discrete_model = T,
n_threads = 1, min_chunk = 5000)
```

##### Arguments

- Y
vector of outcome variable returned from

`Surv`

.- by
length of each bin.

- max_T
last observed time.

- id
vector with ids where entries match with outcomes

`Y`

.- is_for_discrete_model
`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.- n_threads
set to a value greater than one to use

`mclapply`

to find the risk object.- min_chunk
minimum chunk size of ids to use when parallel version is used.

##### Value

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.

##### Examples

```
# NOT RUN {
# 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))
# }
```

*Documentation reproduced from package dynamichazard, version 0.6.6, License: GPL-2*