convertToMx: Convert life table function into mortality rates.

Description Usage Arguments Details Value References See Also Examples

View source: R/convertToMx.R

Description

Given the column of a life table (eg "qx"), calculate the implied mortality rates ("mx").

Usage

1
2
3
4
5
6
convertToMx(
  object,
  from = c("qx", "px", "dx", "lx", "Lx", "Tx", "ex"),
  ax,
  radix = 1e+05
)

Arguments

object

An object of class DemographicArray.

from

The name of a life table function.

ax

An object of class DemographicArray specifying 'separation factors'.

radix

A positive number, defaulting to 100000.

Details

convertToMx is needed when calculating a life table from values other than 'mx', since function LifeTable constructs the life table from 'mx' values.

object must have a dimension with dimtype "age". from must be one of "qx", "px", "dx", "lx", "Lx", "Tx", or "ex". See LifeTable for definitions of these functions.

Demographers typically obtain the 'lx' column of a life table by multiplying the probability of surviving to age 'x' by a 'radix', which is usually 100000. The 'dx', 'Lx', and 'Tx' columns are also scaled by the radix.

See the documentation for LifeTable for a discussion of how to specify separation factor ax.

Life table functions qx, px, dx, lx, effectively contain no information about mortality conditions in the final age group if, as is normally the case, the final age group is open (that is, has no upper limit.) With qx, the final value is always 1. With px the final value is always 0. With dx the final value is always the radix minus deaths in earlier age groups. With lx, the final value describes mortality up to age x, but says nothing about mortality beyond age x. (In contrast to the other life table functions, the first value of lx contains no information, since it always equals radix.) Because life table functions qx, px, dx, and lx, contain no information on the final age group, when from is one of these functions, the return value from convertToMx drops the final age group. See below for an example.

Value

An object of class Values.

References

Preston S, Heuveline P, Guillot M. 2000. Demography: Measuring and Modeling Population Processes. Blackwell.

See Also

convertToMx may be needed to prepare the mx argument for function LifeTable.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Lx <- dembase::Counts(array(c(1800000, 1650000, 1500000, 900000, 100000,
                     1700000, 1500000, 1400000, 800000,  50000),
                   dim = c(5, 2),
                   dimnames = list(age = c("0-19", "20-39", "40-59",
                                           "60-79", "80+"),
                                   sex = c("Female", "Male"))))
ax <- dembase::Values(array(c(8.3, 5),
                   dim = c(1, 2),
                   dimnames = list(age = "0-19",
                                   sex = c("Female", "Male"))))
convertToMx(Lx, from = "Lx", ax = ax)


ax <- dembase::ValuesOne(3, labels = "0-19", name = "age")

lx <- dembase::CountsOne(c(100000, 90000, 70000, 30000, 5000),
                labels = c(0, 20, 40, 60, 80),
                name = "age")
ax <- dembase::ValuesOne(5, labels = "0-19", name = "age")
convertToMx(lx, from = "lx", ax = ax)

qx <- dembase::ValuesOne(c(0.1, 0.05, 0.15, 0.25, 1),
                labels = c("0-19", "20-39", "40-59", "60-79", "80+"),
                name = "age")
ax <- dembase::ValuesOne(5, labels = "0-19", name = "age")
convertToMx(qx, from = "qx", ax = ax)

StatisticsNZ/demlife documentation built on April 27, 2021, 10:02 p.m.