Description Usage Arguments Details Value See Also Examples
View source: R/LifeTable-generators.R
Create an object of class LifeTable
holding the
information necessary to create the full suite of life table functions.
1 2 3 4 5 6 7 8 9 |
mx |
An object of class
|
ax |
An object of class
|
showFun |
A character vector with the names of the functions that are printed or plotted by default |
radix |
A positive number. Defaults to 100,000. |
showQuantiles |
Logical. If |
showTotal |
Logical. If |
prob |
Values used to calculate quantiles. Passed to function
|
For definitions of the life table functions, see the documentation for
lifeTableFun
.
mx
is a Values
object holding estimates of mortality rates, disaggregated by
ax
specifies "separation factors", that is, the average amount of time
lived during an age interval by people who die during that interval.
ax
can not include dimensions that object
does not. However,
object
can include dimensions that ax
does not. If it
does, then values for ax
are assumed to be identical across these
dimensions. For instance, if object
has a "region"
dimension,
but ax
does not, then the same values for ax
are used for all
regions. See below for examples.
When mx
and ax
share a dimension, all values for that
dimension that appear in mx
must also appear in ax
–except
for the age dimension. If mx
includes an age interval that
ax
does not, then ax
for that value is assumed to be
half the width of the age interval.
If ax
is not supplied, then LifeTable
imputes values.
The imputed values equal half the length of the corresponding age group,
except at ages 0 and 1-4. If mx
includes rates for age 0,
then LifeTables
obtains ax
values for ages 0 and 1-4
by applyin the formulas provided by Preston et al (2001: Table 3.3).
The arguments showFun
, showQuantiles
and prob
affect printing, plotting, and
as.data.frame
, but do not affect
the underlying data. This means, for instance, that lifeTableFun
can
be produce values for life table functions that are not included in
showFun
.
l0
, the first value of lx
is conventionally set to 100,000.
Alternative values can be supplied via the radix
argument. Changing
the value of radix
also affects the dx
, Lx
and
Tx
columns.
An object of class LifeTable
.
lifeTableFun
returns values for a life table
function. as.data.frame
converts a LifeTable
object to a (long form) data.frame,
typically as a step towards exporting the life table to a .csv file.
1 2 3 4 5 6 7 8 9 10 11 12 13 | mx <- dembase::ValuesOne(c(0.2, 0.05, 0.1, 0.4),
labels = c("0", "1-4", "5-9", "10+"),
name = "age")
LifeTable(mx)
LifeTable(mx, showTotal = TRUE)
al <- demdata::afghan.life
al <- dembase::Values(al)
mx <- dembase::subarray(al,
subarray = (fun == "mx") & (time == "2001-2005"))
ax <- dembase::subarray(al,
subarray = (fun == "ax") & (time == "2001-2005"))
LifeTable(mx = mx, ax = ax)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.