Function to compute the number of individuals at risk at certain time points, as used in the Kaplan-Meier estimator for instance, depending on stratification.

1 | ```
no.at.risk(formula.s, data.s, sub.s = "all", t.step, t.end)
``` |

`formula.s` |
formula composed of a |

`data.s` |
data frame composed of the variables used in the formula. |

`sub.s` |
vector of booleans specifying if only a subset of the data should be considered. |

`t.step` |
time step at which the number of individuals at risk is computed. |

`t.end` |
maximum time to be considered. |

The original version of this function was kindly provided by Dr Christos Hatzis (January, 17th 2006).

number of individuals at risk at each time step specified in `t.step`

up to `t.end`

.

Christos Hatzis, Benjamin Haibe-Kains

1 2 3 4 5 6 7 8 9 10 | ```
require(survival)
set.seed(12345)
stime <- rexp(100)
cens <- runif(100,.5,2)
sevent <- as.numeric(stime <= cens)
stime <- pmin(stime, cens)
strat <- sample(1:3, 100, replace=TRUE)
dd <- data.frame("surv.time"=stime, "surv.event"=sevent, "strat"=strat)
no.at.risk(formula.s=Surv(surv.time,surv.event) ~ strat, data.s=dd,
sub.s="all", t.step=0.05, t.end=1)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.