Signature
n_e = n - w / 2; q = d / n_e; p = 1 - q; S = S_prev * p; n_next = n - d - w
| Inputs | Definition | Unit |
|---|---|---|
n | People alive and under observation at the start of the interval; above 0 | people |
w | People withdrawn alive during the interval, whether lost to follow-up or still alive when follow-up closed; zero or above | people |
d | Deaths or other events in the interval; zero or above, with d plus w at most n | people |
S_prev | Estimated survival at the start of the interval, S of the previous interval and 1 for the first | probability |
n_e | Number entering the interval less half of those withdrawn during it; the article's n prime | people |
|---|---|---|
q | Estimated probability of dying in the interval for someone alive at its start; at least 0 and at most 1 | probability |
p | Estimated probability of surviving the interval for someone alive at its start, 1 minus q | probability |
S | Estimated probability of surviving to the end of the interval, the article's S hat at the end of interval k | probability |
n_next | People alive and under observation at the start of the following interval | people |
Function
Actuarial life table function from interval counts of deaths and withdrawals
Maps the counts of a follow-up table, the number entering each fixed interval with its deaths and withdrawals, to the effective number at risk, the conditional probabilities and the running survival (HE-FM-LTM-001) and Greenwood's standard error with a log-log interval (HE-FM-LTM-002). It also runs the relation backwards, taking numbers at risk and survival read off a published curve and returning estimated events and censorings (HE-FM-LTM-003). The Computational Function HE-CF-LTM-001 runs a whole table. The product step takes the form of the Kaplan-Meier step HE-FM-ADMC-002, whose n_j is the number under observation just before an event time (HE-VR-ADMC-010); the half count of withdrawals in grouped data is what differs here. Kaplan and Meier's two bounds on the factor are the HE-FM-ADMC-002 factor with n_j set to n or to n minus w (derived). Converting a one-year interval probability to another cycle length is HE-CF-TP-002, and the rescaling HE-FM-TP-003 covers any interval length. Using a rate is HE-FM-TP-001, the trapezoid area under the yearly survival points is the LY output of HE-CF-PSM-001 with its discount rate d of 0, and reading conditional probabilities back from a survival curve is HE-CF-MKA-001. Notation follows the Life Table Method article, with n_e for its n prime and S_prev for the survival carried into the interval.
Computational function
Computational function for a whole actuarial life table from interval counts
Takes the first entering count and the deaths and withdrawals of any number of fixed intervals, as a registry table or older trial report holds them, and returns the whole life table with the two timing bounds, the Greenwood standard error and the area under the survival points. Each row applies HE-FM-LTM-001. The bounds are running products of the HE-FM-ADMC-002 factor with n_j of n and of n minus w, Kaplan and Meier's equation 4a. The standard error is HE-FM-LTM-002. The area joins the survival points with straight lines, the LY output of HE-CF-PSM-001 with its discount rate d of 0, the rule Kaplan and Meier name for grouped data. The calculator line writes five intervals out term by term; the loops over rows are in the Excel, R and Python code. Probabilities per model cycle then come from HE-CF-TP-002, with the q column as p_annual when intervals are years, and from HE-FM-TP-003 for other widths.
Inputs and outputs:
n_1is the number entering the first interval;d_1tod_5are deaths andw_1tow_5withdrawals in each interval;n_2ton_5are the numbers entering later intervals;n_e_1ton_e_5are the effective numbers at risk;S_1toS_5are survival at the end of each interval;S_dfandS_wfare survival at the end of interval 5 with all deaths first and with all withdrawals first;G_5is the Greenwood sum;SE_5is the standard error ofS_5;A_5is the area to the end of interval 5 in interval widths, a restricted mean. In the coded,wandbare vectors with one entry per interval,bbeing the widths, and the outputs addn,neandqby interval.Assumption: The assumptions of HE-FM-LTM-001 hold (HE-AS-LTM-001 to HE-AS-LTM-004). The calculator line and the Excel area use intervals of width one; the R and Python code take other widths through
b. The area is restricted to the observed period, because 44% of the kidney cohort are still alive at five years in the example.Worked example (Kidney cancer table to five years): Stata's Example 5 data, historical and used for the method only, give the printed survival column, the standard error 0.0602 and the article's bounds 0.4926 and 0.3770, with an area of 2.802 life-years per patient, given in the article as 2.80.
n_1 = 126; d_1 = 47; w_1 = 19; d_2 = 5; w_2 = 17; d_3 = 2; w_3 = 15; d_4 = 2; w_4 = 9; d_5 = 0; w_5 = 6; S_1 = 0.5966; S_2 = 0.5386; S_3 = 0.5033; S_4 = 0.4423; S_5 = 0.4423; S_df = 0.4926; S_wf = 0.377; SE_5 = 0.0602; A_5 = 2.802Worked example (No withdrawals with illustrative counts): With 100 entering, 10 deaths a year and no withdrawals, both bounds equal the actuarial value of 0.5, the standard error is 0.05 as HE-FM-BINOM-004 gives for 50 survivors of 100 (derived), and the area is 3.75.
n_1 = 100; d_1 = 10; w_1 = 0; d_2 = 10; w_2 = 0; d_3 = 10; w_3 = 0; d_4 = 10; w_4 = 0; d_5 = 10; w_5 = 0; S_1 = 0.9; S_2 = 0.8; S_3 = 0.7; S_4 = 0.6; S_5 = 0.5; S_df = 0.5; S_wf = 0.5; SE_5 = 0.05; A_5 = 3.75Excel: One row per interval from row 2 with intervals of width one. B2 holds the first entering count and B3 down
=B2-C2-D2; column C holds deaths and column D withdrawals. E2 down=B2-D2/2; F2 down=1-C2/E2; G2=F2and G3 down=G2*F3; H2=IF(E2-C2>0,C2/(E2*(E2-C2)),0)and H3 down=H2+IF(E3-C3>0,C3/(E3*(E3-C3)),0); I2 down=G2*SQRT(H2); J2=(B2-C2)/B2and J3 down=J2*(B3-C3)/B3; K2=IF(B2-D2>0,(B2-D2-C2)/(B2-D2),1)and K3 down=K2*IF(B3-D3>0,(B3-D3-C3)/(B3-D3),1). For five intervals, cells named FiveYearSurvival, FiveYearStdError, DeathsFirstSurvival and WithdrawalsFirstSurvival hold=G6,=I6,=J6and=K6, and FiveYearArea holds=(1+G2)/2+SUMPRODUCT((G2:G5+G3:G6)/2). Blank deaths or withdrawals count as 0. A row with no one entering returns #DIV/0! in columns F and J.R:
life_table <- function(n1, d, w, b = rep(1, length(d))) { k <- length(d); n <- n1-c(0, cumsum(d+w))[seq_len(k)]; stopifnot(all(d+w <= n)); ne <- n-w/2; q <- ifelse(ne > 0, d/ne, 0); S <- cumprod(1-q); Sd <- cumprod(ifelse(n > 0, (n-d)/n, 1)); Sw <- cumprod(ifelse(n-w > 0, (n-w-d)/(n-w), 1)); G <- cumsum(ifelse(ne-d > 0, d/(ne*(ne-d)), 0)); se <- S*sqrt(G); area <- sum(b*(c(1, S)[seq_len(k)]+S)/2); list(table = data.frame(n, ne, q, S, Sd, Sw, se), area = area) }Called aslife_table(126, c(47, 5, 2, 2, 0), c(19, 17, 15, 9, 6))it returns S 0.5966, 0.5386, 0.5033, 0.4423 and 0.4423, se 0.0602 in the last row and area 2.802. Counts with d plus w above n stop with an error. A row with no one left returns q of 0 and carries S. An interval in which all die returns S of 0 and se of 0. An empty table returns no rows and area 0.Python:
def life_table(n1, d, w, b=None): import itertools as it; prod = lambda v: list(it.accumulate(v, lambda a, c: a*c)); b = b or [1]*len(d); n = list(it.accumulate([n1]+[-(x+y) for x, y in zip(d, w)]))[:len(d)]; assert all(x+y <= m for x, y, m in zip(d, w, n)); ne = [m-y/2 for m, y in zip(n, w)]; q = [x/e if e > 0 else 0 for x, e in zip(d, ne)]; S = prod(1-x for x in q); Sd = prod((m-x)/m if m > 0 else 1 for m, x in zip(n, d)); Sw = prod((m-y-x)/(m-y) if m-y > 0 else 1 for m, x, y in zip(n, d, w)); G = list(it.accumulate(x/(e*(e-x)) if e-x > 0 else 0 for x, e in zip(d, ne))); se = [s*g**0.5 for s, g in zip(S, G)]; area = sum(y*(s0+s1)/2 for y, s0, s1 in zip(b, [1]+S, S)); return n, ne, q, S, Sd, Sw, se, areaStandard library only;life_table(126, [47, 5, 2, 2, 0], [19, 17, 15, 9, 6])returns the same values in lists, with area 2.802. Counts with d plus w above n raise AssertionError. A row with no one left, an interval in which all die and an empty table behave as in the R code.Test (Five-year survival matches Stata): With the kidney table in rows 2 to 6, FiveYearSurvival is compared with Stata's printed 0.4423. Expected result TRUE. FALSE shows column E without the half count, which gives 0.4926, and a doubled (0.8846) or halved (0.2212) cell. Excel check
=ABS(FiveYearSurvival-0.4423)<0.0001Test (Five-year standard error matches Stata): With the same table, FiveYearStdError is compared with Stata's printed 0.0602. Expected result TRUE. FALSE shows a sum without the Greenwood term for year 4, which gives 0.0447, and a doubled (0.1205) or halved (0.0301) cell. Excel check
=ABS(FiveYearStdError-0.0602)<0.0001Test (Five-year survival sits within its bounds): FiveYearSurvival is compared with the bounds in DeathsFirstSurvival and WithdrawalsFirstSurvival, 0.4926 and 0.3770 on the kidney table. Expected result TRUE. FALSE shows a doubled (0.8846) or halved (0.2212) survival cell. With no withdrawals the three values are equal, and the tolerance keeps the result TRUE. Excel check
=AND(FiveYearSurvival>=WithdrawalsFirstSurvival-1E-9,FiveYearSurvival<=DeathsFirstSurvival+1E-9)Test (Five-year area matches the article): FiveYearArea is compared with the article's sum of 5.6039 over 2. Expected result TRUE. FALSE shows a step-function area of the end-of-interval values alone, 2.5232, and a doubled (5.6040) or halved (1.4010) cell. Excel check
=ABS(FiveYearArea-5.6039/2)<0.001Test (Standard error equals the binomial value with no withdrawals): With 100 entering, 10 deaths a year and no withdrawals, FiveYearStdError is compared with HE-FM-BINOM-004 on FiveYearSurvival and the first entering count, a different route (derived). Expected result TRUE. FALSE shows a doubled (0.1) or halved (0.025) cell. Excel check
=ABS(FiveYearStdError-SQRT(FiveYearSurvival*(1-FiveYearSurvival)/B2))<1E-9Common error (Restricted mean read as lifetime survival): The 2.802 is an area to five years with 44% still alive, so it is a restricted mean. Latimer's Technical Support Document 14 says only a restricted mean can be estimated directly when patients remain alive at the end of follow-up and that parametric models should be used unless data are almost entirely complete, so a lifetime horizon needs a fitted curve and extrapolation.
Common error (Step-function area on a grouped table): Summing survival times width, as HE-FM-ADMC-003 does for the steps of a Kaplan-Meier curve, gives 3.0809 on the kidney table with start-of-interval values and 2.5232 with end-of-interval values, against 2.802 from the straight lines (derived). Grouped points have no steps between them, and Kaplan and Meier refer to actuarial-type assumptions such as the trapezoidal rule for this case.
Source: StataCorp. Stata Survival Analysis and Epidemiological Tables Reference Manual, Release 13. College Station, TX: Stata Press; 2013. Entry ltable, Example 5 and Methods and formulas. Kaplan EL, Meier P. Nonparametric estimation from incomplete observations. Journal of the American Statistical Association. 1958;53(282):457-481. Section 2.3 on the trapezoidal rule for grouped data, section 4.1 for equation 4a. Latimer N. NICE DSU Technical Support Document 14: Survival analysis for economic evaluations alongside clinical trials, extrapolation with patient-level data. Sheffield: Decision Support Unit, ScHARR, University of Sheffield; 2011, last updated March 2013. Sections 2 and 5.
n_e_1 = n_1 - w_1 / 2; S_1 = 1 - d_1 / n_e_1; n_2 = n_1 - d_1 - w_1; n_e_2 = n_2 - w_2 / 2; S_2 = S_1 * (1 - d_2 / n_e_2); n_3 = n_2 - d_2 - w_2; n_e_3 = n_3 - w_3 / 2; S_3 = S_2 * (1 - d_3 / n_e_3); n_4 = n_3 - d_3 - w_3; n_e_4 = n_4 - w_4 / 2; S_4 = S_3 * (1 - d_4 / n_e_4); n_5 = n_4 - d_4 - w_4; n_e_5 = n_5 - w_5 / 2; S_5 = S_4 * (1 - d_5 / n_e_5); S_df = (1 - d_1 / n_1) * (1 - d_2 / n_2) * (1 - d_3 / n_3) * (1 - d_4 / n_4) * (1 - d_5 / n_5); S_wf = (1 - d_1 / (n_1 - w_1)) * (1 - d_2 / (n_2 - w_2)) * (1 - d_3 / (n_3 - w_3)) * (1 - d_4 / (n_4 - w_4)) * (1 - d_5 / (n_5 - w_5)); G_5 = d_1 / (n_e_1 * (n_e_1 - d_1)) + d_2 / (n_e_2 * (n_e_2 - d_2)) + d_3 / (n_e_3 * (n_e_3 - d_3)) + d_4 / (n_e_4 * (n_e_4 - d_4)) + d_5 / (n_e_5 * (n_e_5 - d_5)); SE_5 = S_5 * sqrt(G_5); A_5 = (1 + S_1) / 2 + (S_1 + S_2) / 2 + (S_2 + S_3) / 2 + (S_3 + S_4) / 2 + (S_4 + S_5) / 2
Try this function
Implementations
Excel
Actuarial interval survival from named counts
The counts are in cells named EnteringCount, DeathsInInterval and WithdrawnInInterval and the survival carried in is in SurvivalAtIntervalStart. A cell named EffectiveAtRisk holds
=EnteringCount-WithdrawnInInterval/2, and the formula shown fills SurvivalAtIntervalEnd. A blank WithdrawnInInterval counts as 0, which gives the deaths-first factor with no warning. A blank SurvivalAtIntervalStart also counts as 0 and returns 0, so the first interval needs a typed 1. A blank EnteringCount with no withdrawals returns #DIV/0!.=SurvivalAtIntervalStart*(1-DeathsInInterval/EffectiveAtRisk)
Excel
Conditional death probability and next entering count in a life table
IntervalDeathProb holds the first formula, the article's q hat, and NextEntering holds the second, which feeds EnteringCount of the next row when the table is laid out in columns.
=DeathsInInterval/EffectiveAtRisk; =EnteringCount-DeathsInInterval-WithdrawnInInterval
Assumptions
Withdrawals spread evenly through each life-table interval
The half count treats withdrawals as occurring at a constant rate within the interval, so that a withdrawn person was observed for half of it on average (derived). Stata's manual suggests coding grouped deaths and withdrawals at interval midpoints because those values correspond to the assumptions behind its calculations. If withdrawals bunch late in an interval, the factor for that timing lies nearer the deaths-first bound, the HE-FM-ADMC-002 factor with n_j of n (derived).
Withdrawal independent of the risk of death in a life table
Kaplan and Meier state the usual assumption that lifetime is independent of the potential loss time and add that in practice it deserves careful scrutiny. Patients lost to follow-up because they are sicker break it, and the half count does not correct for that.
Fixed intervals and one survival experience across pooled cohorts
Interval limits are set in advance. Kaplan and Meier note that actuarial estimates generally depend somewhat on the selection of the intervals, and Ranstam and Robertsson note that the interval length is subjectively defined. Pooling cohorts that entered in different calendar years, as in the kidney cancer example, assumes survival did not change across those years.
Counts of one life-table interval are consistent
d plus w is at most n, so n_e is above 0 whenever n is, and q is at most 1 (derived). A table is run in time order, with n_next of one row as n of the next.
Worked examples
First year of the kidney cancer life table
Stata's manual reproduces follow-up data from Cutler and Ederer on six cohorts of kidney cancer patients, pooled by year since diagnosis. The data are historical and illustrate the method only. In the first year 126 patients enter, 47 die and 19 are withdrawn, which gives 0.5966, the value Stata prints, and leaves 60 to enter the second year.
n = 126; d = 47; w = 19; S_prev = 1; n_e = 116.5; q = 0.4034; p = 0.5966; S = 0.5966; n_next = 60
Second year of the kidney cancer life table
Sixty patients enter the second year, 5 die and 17 are withdrawn. Survival is carried in at six decimals because the product of the rounded 0.5966 and 0.9029 would show 0.5387, whereas the article and Stata print 0.5386 from unrounded values.
n = 60; d = 5; w = 17; S_prev = 0.596567; n_e = 51.5; q = 0.0971; p = 0.9029; S = 0.5386; n_next = 38
Fifth year of the kidney cancer life table with no deaths
Ten patients enter the fifth year, none die and 6 are withdrawn. The factor is 1, so survival stays at the 0.4423 that Stata prints as the five-year rate, and 4 patients enter the sixth year.
n = 10; d = 0; w = 6; S_prev = 0.44232; n_e = 7; q = 0; p = 1; S = 0.4423; n_next = 4
Limiting case of a life-table interval with no withdrawals
With illustrative counts of 100 entering, 20 deaths and no withdrawals, the effective number equals the number entering and the factor is 0.8, the HE-FM-ADMC-002 factor with n_j of 100. The case checks an implementation.
n = 100; d = 20; w = 0; S_prev = 1; n_e = 100; q = 0.2; p = 0.8; S = 0.8; n_next = 80
Common errors
Leaving all withdrawals in or taking all of them out of the life-table denominator
Dividing by n with no halving assumes every death came before every withdrawal. The article's kidney cancer table then gives a five-year survival of 0.4926 in place of 0.4423, about 5 percentage points too high. Stata's noadjust option describes this denominator as the standard Kaplan-Meier assumption, and it is the upper bound of Kaplan and Meier's equation 4a. Removing every withdrawal first, dividing by n minus w, is the lower bound and gives 0.3770, about 6.5 percentage points too low.
Removing half of the deaths from the life-table denominator
Deaths stay in the denominator of q in full, and only withdrawals are halved. Dividing by n_e minus d over 2 gives a first-year factor of 0.4946 on the kidney table in place of 0.5966 (derived).
Reading a start-of-interval survival column as end-of-interval
Stata's manual notes that Selvin's table prints survival at the start of each interval whereas its own prints survival at the end, a shift of one row. On the kidney table, reading the 0.5966 that a start-of-interval table shows in the row for year 1 to 2 as survival at two years overstates it by 0.058 against 0.5386 (derived).
Dividing an annual life-table probability by the number of cycles
An interval probability fits a model directly only when the cycle length equals the interval. Dividing the first-year 0.4034 by four gives 0.1009, whereas HE-CF-TP-002 with p_annual of 0.4034 and L_months of 3 gives 0.1211, as in the article.
Using a grouped life table when exact event times are available
Grouping discards timing that a product-limit analysis would use. Ranstam and Robertsson report accuracy slightly lower than with Kaplan-Meier, and Ranstam and colleagues state that Kaplan-Meier is usually preferred when exact revision times are known. With patient-level times the step is HE-FM-ADMC-002.
Sources
Stata manual on the adjusted number at risk in ltable
StataCorp. Stata Survival Analysis and Epidemiological Tables Reference Manual, Release 13. College Station, TX: Stata Press; 2013. Entry ltable. Methods and formulas, which defines n_j as N_j minus m_j over 2, the adjusted number at risk at the start of the interval, with the product of (n_k minus d_k) over n_k as the survivor function. Option noadjust, the number at risk as the total at the start, corresponding to the standard Kaplan-Meier assumption. Example 5, the Cutler and Ederer kidney cancer data as presented by Selvin, with printed survival 0.5966, 0.5386, 0.5033, 0.4423 and 0.4423, the start and end of interval presentation, and the suggestion to code times at midpoints.
SAS documentation on the effective sample size in PROC LIFETEST
SAS Institute Inc. SAS/STAT 14.2 User's Guide. The LIFETEST Procedure. Cary, NC: SAS Institute Inc.; 2016. Section Details, Computational Formulas, subsection Life-Table Method, which defines the effective sample size of an interval as the number entering less half of the number censored, the conditional probability of an event as d_i over the effective size and the survival estimate as a product of the complements. The Overview calls the life-table estimator a grouped-data analog of the Kaplan-Meier estimator.
Kaplan and Meier on actuarial estimates and their bounds
Kaplan EL, Meier P. Nonparametric estimation from incomplete observations. Journal of the American Statistical Association. 1958;53(282):457-481. doi:10.1080/01621459.1958.10501452. Abstract, on actuarial estimates as products with the number of factors reduced by grouping and on independence of lifetime and potential loss time. Section 4.1, equation 4a, the two factors for all deaths before all losses and all losses before all deaths; equation 4b, the adjusted-observed estimate with losses counted as half, described as well known, an intermediate value; the statement that the estimates depend somewhat on the selection of intervals. The scan hosted by Stanford University was read.
Ranstam and Robertsson on the Cutler-Ederer actuarial life table method
Ranstam J, Robertsson O. Statistical analysis of arthroplasty register data. Acta Orthopaedica. 2010;81(1):10-14. doi:10.3109/17453671003587168. Background, which names the Cutler-Ederer actuarial life table method (Cutler and Ederer 1958) as based on a series of fixed time intervals, easy to tabulate, with the interval length subjectively defined and accuracy slightly lower than with the Kaplan-Meier method.
Ranstam and colleagues on preferring Kaplan-Meier with exact times
Ranstam J, Kärrholm J, Pulkkinen P, Mäkelä K, Espehaug B, Pedersen AB, Mehnert F, Furnes O; NARA study group. Statistical analysis of arthroplasty data. I. Introduction and background. Acta Orthopaedica. 2011;82(3):253-257. doi:10.3109/17453674.2011.588862. Section Life table and Kaplan-Meier estimates, which names the life table (actuarial) approach after Cutler and Ederer 1958 and states that the Kaplan-Meier method is usually preferred if the exact times of revision are known.
Canonical Identity
Stable URI · Machine-readable · Resolvable · CC BY 4.0
