Description Usage Arguments Details Value Author(s) See Also Examples

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 | ```
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)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.