risksets: Finds the compositions and sizes of risk sets

risksetsR Documentation

Finds the compositions and sizes of risk sets

Description

Focus is on the risk set composition just prior to a failure.

Usage

risksets(
  x,
  strata = NULL,
  max.survs = NULL,
  members = TRUE,
  collate_sets = FALSE
)

Arguments

x

A Surv object.

strata

Stratum indicator.

max.survs

Maximum number of survivors in each risk set. If smaller than the 'natural number', survivors are sampled from the present ones. No sampling if missing.

members

If TRUE, all members of all risk sets are listed in the resulting list, see below.

collate_sets

logical. If TRUE, group information by risk sets in a list. Only if members = TRUE.

Details

If the input argument max.survs is left alone, all survivors are accounted for in all risk sets.

Value

A list with components (if collate_sets = FALSE)

antrs

No. of risk sets in each stratum. The number of strata is given by length(antrs).

risktimes

Ordered distinct failure time points.

eventset

If 'members' is TRUE, a vector of pointers to events in each risk set, else NULL.

riskset

If 'members' is TRUE, a vector of pointers to the members of the risk sets, in order. The 'n.events' first are the events. If 'members' is FALSE, 'riskset' is NULL.

size

The sizes of the risk sets.

n.events

The number of events in each risk set.

sample_fraction

If 'members' is TRUE, the sampling fraction of survivors in each risk set.

Note

Can be used to "sample the risk sets".

Author(s)

Göran Broström

See Also

table.events, coxreg.

Examples


 enter <- c(0, 1, 0, 0)
 exit <- c(1, 2, 3, 4)
 event <- c(1, 1, 1, 0)
 risksets(Surv(enter, exit, event))


eha documentation built on Oct. 7, 2024, 1:17 a.m.