life_tables
Produces population and cohort life tables.
Synopsis
#include <imsls.h>
float *imsls_f_life_tables (int n_classes, float age[], float a[], int n_cohort[], …, 0)
The type double function is imsls_d_life_tables.
Required Arguments
int n_classes (Input)
Number of age classes.
float age[] (Input)
Array of length n_classes + 1 containing the lowest age in each age interval, and in age[n_classes], 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[n_classes] need not be specified when getting a cohort table.
float a[] (Input)
Array of length n_classes 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 n_cohort[] (Input)
Array of length n_classes containing the cohort sizes during each interval. If the IMSL_POPULATION_LIFE_TABLE option is used, then n_cohort[i] contains the size of the population at the midpoint of interval i. Otherwise, n_cohort[i] contains the size of the cohort at the beginning of interval i. When requesting a population table, the population sizes in n_cohort may need to be adjusted to correspond to the number of deaths in n_deaths. See the Description section for more information.
Return Value
Pointer to an array of length n_classes by 12 containing the life table. The function returns a cohort table by default. If the IMSL_POPULATION_LIFE_TABLE 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. |
Synopsis with Optional Arguments
#include <imsls.h>
float *imsls_f_life_tables (int n_classes, float age[], float a[], int n_cohort[],
IMSLS_RETURN_USER, float table[],
IMSLS_PRINT_LEVEL, int iprint,
IMSLS_POPULATION_SIZE, int initial_pop,
IMSLS_POPULATION_LIFE_TABLE, int *n_deaths,
0)
Optional Arguments
IMSLS_RETURN_USER, float table[] (Output)
If specified, table is an user-specified array of length n_classes×12 containing the life table.
IMSLS_PRINT_LEVEL, int iprint (Input)
Printing option.
iprint |
Action |
0 |
No printing is performed. |
1 |
The life table is printed. |
Default: iprint = 0.
IMSLS_POPULATION_SIZE, int initial_pop (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 n_cohorts and n_deaths when numbers are available as percentages.
Default: initial_pop = 10000.
IMSLS_POPULATION_LIFE_TABLE, int *n_deaths (Input)
Compute a population table. n_deaths is an array of length n_classes containing the number of deaths in each age interval.
Description
Function imsls_f_life_tables 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 userspecified 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 = ti - ti−1, t0 = 0. The number of individuals alive at the beginning of the interval may be estimated by Pi = Mi + (1 - ai)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 ti−1 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
For population table, the number of individuals alive in the middle of the time interval (input in n_cohort[i]) must be adjusted to correspond to the number of deaths observed in the interval. Function imsls_f_life_tables 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 ui ≠ di, then n_cohort[i] must be adjusted to correspond to di by multiplication by ui/hi, i.e., the value Mi input into imsls_f_life_tables as n_cohort[i] is computed as
Let Si denote the number of survivors at time ti from a hypothetical (for population table) or observed (for cohort table) population. Then, S0 = initial_pop for population table, and S0 = n_cohort[0] for cohort table, and Si is given by Si = Si−1 - δi−1 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.
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)
where var(en) = 0.0.
Finally, the total number of time units lived by all survivors in the time interval can be estimated as:
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 IMSLS_PRINT_LEVEL option is used, imsls_f_life_tables prints the life table.
#include <imsls.h>
#define N_CLASSES 13
int main ()
{
int iprint = 1;
int n_cohort[] =
{ 270, 268, 264, 261, 254, 251, 248, 232, 166, 130, 76, 34, 13 };
float age[N_CLASSES + 1], a[N_CLASSES];
float *result;
age[0] = -5.0;
a[0] = -1.0;
result = imsls_f_life_tables (N_CLASSES, age, a, n_cohort,
IMSLS_PRINT_LEVEL, iprint, 0);
}
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.63
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 1313
4 0.594 1288
5 0.5403 1263
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