lt() constructs a life table based on a vector of age-specific mortality rates (mx), starting age, age group width, and specified sex. It calculates standard life table columns including the probability of dying (qx), number of survivors (lx), number of deaths (dx), person-years lived (Lx), total person-years remaining (Tx), and life expectancy (ex).

lt(mx, sage = 0, sep_zero = TRUE, age_width = 5, sex = "male")

Arguments

mx

Numeric vector of age-specific mortality rates.

sage

Integer. Starting age of the first age group (default is 0).

sep_zero

Logical. Indicates whether the age 0 group is separated from the 1–4 age group (default is TRUE).

age_width

Integer. Width of each age group in years; typically 1 or 5 (default is 5).

sex

Character string specifying the sex: "male", "female", or "total" (default is "male").

Value

A data frame with the following columns:

age

Starting age of each age group.

mx

Age-specific mortality rate.

qx

Probability of dying between age x and x+n.

lx

Number of survivors at exact age x, starting from a radix of 1.

dx

Number of deaths between ages x and x+n.

Lx

Person-years lived between ages x and x+n.

Tx

Total person-years remaining after age x.

ex

Life expectancy at exact age x.

Details

The function uses standard demographic formulas to compute life table values. The average number of person-years lived in the interval by those dying in the interval (ax) is estimated using the calc_ax() function, which applies formulas based on the specified sex and age group width. The calculations assume a radix (starting population) of 1.

Examples

# Example 1: Using mortality rates derived from death and population counts
px <- c(
  20005, 86920, 102502, 151494, 182932, 203107, 240289, 247076, 199665,
  163820, 145382, 86789, 69368, 51207, 39112, 20509, 12301, 6586, 1909
)
dx <- c(
  156, 58, 47, 49, 48, 68, 120, 162, 160, 294, 417, 522, 546, 628,
  891, 831, 926, 731, 269
)
mx <- dx / px
lt(mx, sage = 0, age_width = 5, sex = "male")
#>    age           mx          qx        lx          dx        Lx        Tx
#> 1    0 0.0077980505 0.007741661 1.0000000 0.007741661 0.9927687 75.668293
#> 2    1 0.0006672803 0.002664905 0.9922583 0.002644274 3.9627639 74.675524
#> 3    5 0.0004585276 0.002290013 0.9896141 0.002266229 4.9424048 70.712761
#> 4   10 0.0003234452 0.001615919 0.9873478 0.001595474 4.9327505 65.770356
#> 5   15 0.0002623926 0.001311103 0.9857524 0.001292423 4.9255308 60.837605
#> 6   20 0.0003347989 0.001672595 0.9844599 0.001646602 4.9181832 55.912075
#> 7   25 0.0004993986 0.002493880 0.9828133 0.002451018 4.9079391 50.993891
#> 8   30 0.0006556687 0.003272979 0.9803623 0.003208705 4.8937898 46.085952
#> 9   35 0.0008013422 0.003998700 0.9771536 0.003907345 4.8759997 41.192162
#> 10  40 0.0017946527 0.008933183 0.9732463 0.008694187 4.8444959 36.316163
#> 11  45 0.0028683056 0.014239420 0.9645521 0.013734663 4.7884238 31.471667
#> 12  50 0.0060145871 0.029627443 0.9508174 0.028170289 4.6836614 26.683243
#> 13  55 0.0078710645 0.038595846 0.9226471 0.035610347 4.5242098 21.999582
#> 14  60 0.0122639483 0.059495614 0.8870368 0.052774798 4.3032469 17.475372
#> 15  65 0.0227807323 0.107766180 0.8342620 0.089905227 3.9465469 13.172125
#> 16  70 0.0405187966 0.183959445 0.7443568 0.136931456 3.3794552  9.225578
#> 17  75 0.0752784326 0.316776136 0.6074253 0.192417840 2.5560819  5.846123
#> 18  80 0.1109930155 0.434420871 0.4150075 0.180287903 1.6243176  3.290041
#> 19  85 0.1409114720 1.000000000 0.2347196 0.234719559 1.6657236  1.665724
#>           ex
#> 1  75.668293
#> 2  75.258148
#> 3  71.454886
#> 4  66.613156
#> 5  61.716926
#> 6  56.794667
#> 7  51.885632
#> 8  47.009102
#> 9  42.155258
#> 10 37.314464
#> 11 32.628271
#> 12 28.063477
#> 13 23.843982
#> 14 19.700842
#> 15 15.788955
#> 16 12.394028
#> 17  9.624431
#> 18  7.927667
#> 19  7.096654

# Example 2: Using predefined mortality rates
mx <- c(
  0.01685, 0.00085, 0.00044, 0.00045, 0.00064, 0.00086, 0.00103,
  0.00136, 0.00195, 0.00291, 0.00429, 0.00672, 0.00985, 0.01596,
  0.02605, 0.04536, 0.07247, 0.12078, 0.17957, 0.25938, 0.25989
)
lt(mx, sage = 0, age_width = 5, sex = "total")
#>    age      mx          qx         lx          dx         Lx          Tx
#> 1    0 0.01685 0.016596965 1.00000000 0.016596965 0.98498311 72.42819568
#> 2    1 0.00085 0.003392934 0.98340303 0.003336622 3.92543737 71.44321257
#> 3    5 0.00044 0.002197583 0.98006641 0.002153777 4.89494762 67.51777520
#> 4   10 0.00045 0.002247472 0.97791264 0.002197831 4.88406860 62.62282758
#> 5   15 0.00064 0.003194888 0.97571481 0.003117300 4.87078078 57.73875898
#> 6   20 0.00086 0.004290775 0.97259751 0.004173197 4.85255453 52.86797820
#> 7   25 0.00103 0.005136773 0.96842431 0.004974576 4.82968510 48.01542367
#> 8   30 0.00136 0.006776958 0.96344973 0.006529259 4.80092552 43.18573856
#> 9   35 0.00195 0.009702699 0.95692047 0.009284712 4.76139059 38.38481305
#> 10  40 0.00291 0.014444913 0.94763576 0.013688516 4.70395752 33.62342246
#> 11  45 0.00429 0.021222390 0.93394725 0.019820593 4.62018475 28.91946493
#> 12  50 0.00672 0.033044847 0.91412665 0.030207175 4.49511533 24.29928019
#> 13  55 0.00985 0.048066366 0.88391948 0.042486797 4.31338040 19.80416486
#> 14  60 0.01596 0.076738148 0.84143268 0.064569986 4.04573844 15.49078446
#> 15  65 0.02605 0.122286117 0.77686270 0.094999522 3.64681467 11.44504601
#> 16  70 0.04536 0.203700377 0.68186317 0.138895786 3.06207640  7.79823134
#> 17  75 0.07247 0.306770800 0.54296739 0.166566540 2.29842059  4.73615493
#> 18  80 0.12078 0.463842697 0.37640085 0.174590785 1.44552728  2.43773434
#> 19  85 0.17957 0.619666304 0.20181006 0.125054896 0.69641308  0.99220707
#> 20  90 0.25938 0.786739058 0.07675517 0.060386288 0.23281012  0.29579399
#> 21  95 0.25989 1.000000000 0.01636888 0.016368879 0.06298387  0.06298387
#>           ex
#> 1  72.428196
#> 2  72.648965
#> 3  68.891020
#> 4  64.037241
#> 5  59.175856
#> 6  54.357510
#> 7  49.580977
#> 8  44.824070
#> 9  40.112856
#> 10 35.481378
#> 11 30.964774
#> 12 26.581962
#> 13 22.404942
#> 14 18.410010
#> 15 14.732392
#> 16 11.436651
#> 17  8.722724
#> 18  6.476432
#> 19  4.916539
#> 20  3.853734
#> 21  3.847782