lifeTables

Produces population and cohort life tables.

Synopsis

lifeTables (age, a, nCohort)

Required Arguments

float age[] (Input)
Array of length nClasses + 1 containing the lowest age in each age interval, and in age[nClasses], the endpoint of the last age interval. Negative age[0] indicates that the age intervals are all of length |age[0]| and that the initial age interval is from 0.0 to |age[0]|. In this case, all other elements of age need not be specified. age[nClasses] need not be specified when getting a cohort table.
float a[] (Input)
Array of length nClasses containing the fraction of those dying within each interval who die before the interval midpoint. A common choice for all a[i] is 0.5. This choice may also be specified by setting a[0] to any negative value. In this case, the remaining values of a need not be specified.
int nCohort[] (Input)
Array of length nClasses containing the cohort sizes during each interval. If the populationLifeTable option is used, then nCohort[i] contains the size of the population at the midpoint of interval i. Otherwise, nCohort[i] contains the size of the cohort at the beginning of interval i. When requesting a population table, the population sizes in nCohort may need to be adjusted to correspond to the number of deaths in nDeaths. See the Description section for more information.

Return Value

An array of length nClasses by 12 containing the life table. The function returns a cohort table by default. If the populationLifeTable option is used, a population table is returned. Entries in the ith row are for the age interval defined by age[i]. Column definitions are described in the following table.

Column Description
0 Lowest age in the age interval.
1 Fraction of those dying within the interval who die before the interval midpoint.
2 Number surviving to the beginning of the interval.
3 Number of deaths in the interval.
4 Death rate in the interval. For cohort table, this column is set to NaN (not a number).
5 Proportion dying in the interval.
6 Standard error of the proportion dying in the interval.
7 Proportion of survivors at the beginning of the interval.
8 Standard error of the proportion of survivors at the beginning of the interval.
9 Expected lifetime at the beginning of the interval.
10 Standard error of the expected life at the beginning of the interval.
11 Total number of time units lived by all of the population in the interval.

Optional Arguments

printLevel, int (Input)

Printing option.

printLevel Action
0 No printing is performed.
1 The life table is printed.

Default: printLevel = 0.

populationSize, int (Input)

The population size at the beginning of the first age interval in requesting population table. A default value of 10,000 is used to allow easy entry of nCohorts and nDeaths when numbers are available as percentages.

Default: populationSize = 10000.

populationLifeTable, int (Input)
Compute a population table. nDeaths is an array of length nClasses containing the number of deaths in each age interval.

Description

Function lifeTables computes population (current) or cohort life tables based upon the observed population sizes at the middle (for population table) or the beginning (for cohort table) of some user specified age intervals. The number of deaths in each of these intervals must also be observed.

The probability of dying prior to the middle of the interval, given that death occurs somewhere in the interval, may also be specified. Often, however, this probability is taken to be 0.5. For a discussion of the probability models underlying the life table here, see the references.

Let ti, for i=0,1,,tn denote the time grid defining the n age intervals, and note that the length of the age intervals may vary. Following Gross and Clark (1975, page 24), let di denote the number of individuals dying in age interval i, where age interval i ends at time ti. For population table, the death rate at the middle of the interval is given by ri=di/(Mihi), where Mi is the number of individuals alive at the middle of the interval, and hi=titi1, t0=0. The number of individuals alive at the beginning of the interval may be estimated by Pi=Mi+(1ai)di where ai is the probability that an individual dying in the interval dies prior to the interval midpoint. For cohort table, Pi is input directly while the death rate in the interval, ri, is not needed.

The probability that an individual dies during the age interval from ti1 to ti is given by qi=di/Pi. It is assumed that all individuals alive at the beginning of the last interval die during the last interval. Thus, qn=1.0. The asymptotic variance of qi can be estimated by

σ2i=qi(1qi)/Pi

For population table, the number of individuals alive in the middle of the time interval (input in nCohort[i]) must be adjusted to correspond to the number of deaths observed in the interval. Function lifeTables assumes that the number of deaths observed in interval hi occur over a time period equal to hi. If di is measured over a period ui, where uidi, then nCohort[i] must be adjusted to correspond to di by multiplication by ui/hi, i.e., the value Mi input into lifeTables as nCohort[i] is computed as

Mi=Miui/hi

Let Si denote the number of survivors at time ti from a hypothetical (for population table) or observed (for cohort table) population. Then, S0 = populationSize for population table, and S0 = nCohort[0] for cohort table, and Si is given by Si=Si1δi1 where δi=Siqi is the number of individuals who die in the i-th interval. The proportion of survivors in the interval is given by Vi=S/S0 while the asymptotic variance of Vi can be estimated as follows.

var(Vi)=V2ii1j=1σ2j(1qj)2

The expected lifetime at the beginning of the interval is calculated as the total lifetime remaining for all survivors alive at the beginning of the interval divided by the number of survivors at the beginning of the interval. If ei denotes this average expected lifetime, then the variance of ei can be estimated as (see Chiang 1968)

var(ei)=n1j=1P2jσ2j[ej+1+hj+1(1aj)]2P2j

where var(en)=0.0.

Finally, the total number of time units lived by all survivors in the time interval can be estimated as:

Ui=hi[Siδi(1ai)]

Example

This example is taken from Chiang (1968). The cohort life table has thirteen equally spaced intervals, so age[0] is set to -5.0. Similarly, the probabilities of death prior to the middle of the interval are all taken to be 0.5, so a[0] is set to -1.0. Since printLevel option is used, lifeTables prints the life table.

from numpy import *
from pyimsl.stat.lifeTables import lifeTables

n_classes = 13
iprint = 1
n_cohort = array([270, 268, 264, 261, 254, 251, 248, 232,
                  166, 130, 76, 34, 13])
age = zeros(n_classes + 1, dtype=double)
a = zeros(n_classes, dtype=double)
age[0] = -5.0
a[0] = -1.0

result = lifeTables(age, a, n_cohort,
                    printLevel=iprint)

Output

 
                             Life Table
Age Class         Age      PDHALF       Alive      Deaths  Death Rate
        1           0         0.5         270           2  ..........
        2           5         0.5         268           4  ..........
        3          10         0.5         264           3  ..........
        4          15         0.5         261           7  ..........
        5          20         0.5         254           3  ..........
        6          25         0.5         251           3  ..........
        7          30         0.5         248          16  ..........
        8          35         0.5         232          66  ..........
        9          40         0.5         166          36  ..........
       10          45         0.5         130          54  ..........
       11          50         0.5          76          42  ..........
       12          55         0.5          34          21  ..........
       13          60         0.5          13          13  ..........
 
Age Class        P(D)   Std(P(D))        P(S)   Std(P(S))    Lifetime
        1    0.007407    0.005218           1           0       43.19
        2     0.01493    0.007407      0.9926    0.005218       38.49
        3     0.01136    0.006523      0.9778    0.008971       34.03
        4     0.02682        0.01      0.9667     0.01092        29.4
        5     0.01181    0.006779      0.9407     0.01437       25.14
        6     0.01195    0.006859      0.9296     0.01557       20.41
        7     0.06452      0.0156      0.9185     0.01665       15.62
        8      0.2845     0.02962      0.8593     0.02116       11.53
        9      0.2169     0.03199      0.6148     0.02962       10.12
       10      0.4154     0.04322      0.4815     0.03041       7.231
       11      0.5526     0.05704      0.2815     0.02737       5.592
       12      0.6176     0.08334      0.1259     0.02019       4.412
       13           1           0     0.04815     0.01303         2.5
 
Age Class   Std(Life)  Time Units
        1      0.6993        1345
        2      0.6707        1330
        3       0.623        1312
        4       0.594        1288
        5      0.5403        1262
        6      0.5237        1248
        7      0.5149        1200
        8      0.4982         995
        9      0.4602         740
       10      0.4328         515
       11      0.4361         275
       12      0.4167       117.5
       13           0        32.5