check_mx_ax_qx: Check two of mx, ax, qx

View source: R/validate_lifetable.R

check_mx_ax_qxR Documentation

Check two of mx, ax, qx

Description

Helper function to check a data.table for two of mx, ax, and qx and compute the missing parameter if one is missing.

Usage

check_mx_ax_qx(dt)

Arguments

dt

[data.table()]
Data to check for mx, ax, and/or qx. Must also have 'age_length' column.

Details

Uses mx_ax_to_qx(), qx_ax_to_mx(), or mx_qx_to_ax() function to complete the set of three life table parameters.

Value

dt with input columns plus any of 'mx', 'ax', and 'qx' that is missing in input. Or, returns error if input has fewer than two of these parameters.

Examples

dt <- data.table::data.table(
  age_start = c(0, 1, 5, 10),
  age_length = c(1, 4, 5, 5),
  mx = c(0.009, 0.0004, 0.00015, 0.00019),
  ax = c(0.068, 1.626, 2.5, 2.5)
)
dt <- check_mx_ax_qx(dt)


ihmeuw-demographics/demCore documentation built on Feb. 24, 2024, 11:05 p.m.