Learn R Programming

KMsurv (version 0.1-2)

lifetab: Create cohort life table

Description

Create cohort life table.

Usage

lifetab(tis, ninit, nlost, nevent)

Arguments

tis
a vector of end points of time intervals, whose length is 1 greater than nlost and nevent.
ninit
the number of subjects initially entering the study.
nlost
a vector of the number of individuals lost follow or withdrawn alive for whatever reason.
nevent
a vector of the number of individuals who experienced the event

Value

  • A data.frame with the following columns:
  • nsubsthe number of subject entering the intervals who have not experienced the event.
  • nlostthe number of individuals lost follow or withdrawn alive for whatever reason.
  • nriskthe estimated number of individuals at risk of experiencing the event.
  • neventthe number of individuals who experienced the event.
  • survthe estimated survival function at the start of the intervals.
  • pdfthe estimated probability density function at the midpoint of the intervals.
  • hazardthe estimated hazard rate at the midpoint of the intervals.
  • se.survthe estimated standard deviation of survival at the beginning of the intervals.
  • se.pdfthe estimated standard deviation of the prbability density function at the midpoint of the intervals.
  • se.hazardthe estimated standard deviation of the hazard function at the midpoint of the intervals

Examples

Run this code
tis <- c(0, 2, 3, 5, 7, 11, 17, 25, 37, 53, NA)
nsubs <- c(927, 848, 774, 649, 565, 449, 296, 186, 112, 27)
nlost <- c(2, 3, 6, 9, 7, 5, 3, rep(0, 3))
nevent <- c(77, 71, 119, 75, 109, 148, 107, 74, 85, 27)

lifetab(tis, nsubs[1], nlost, nevent)

Run the code above in your browser using DataLab