Evaluate age structure

Indicators to evaluate the degreee of age heaping

check_heaping_bachi()

calculate Bachi's index of age heaping

check_heaping_coale_li()

Coale-Li age heaping index

check_heaping_jdanov()

Calculate Jdanov's old-age heaping index

check_heaping_kannisto()

Kannisto's age heaping index

check_heaping_myers()

Calculate Myer's blended index of age heaping

check_heaping_noumbissi()

calculate Noumbissi's digit heaping index

check_heaping_roughness()

Evaluate roughness of data in 5-year age groups

check_heaping_sawtooth()

Detect if heaping is worse on terminal digits 0s than on 5s

check_heaping_spoorenberg()

Spoorenberg's total modified Whipple index

check_heaping_whipple()

Calculate Whipple's index of age heaping

Evaluate consistency of age structures

Methods to assess the consistency of age structures

ageRatioScore()

Calculate the PAS age ratio score

sexRatioScore()

Calculate the PAS sex ratio score

ageSexAccuracy()

Calculate an age-sex accuracy index

IRD()

Index of relative difference.

ID()

Index of dissimilarity

survRatioError()

Census survival estimation

Evaluate patterns of heaping

Methods to assess in which ages heaping happens

check_heaping_sawtooth()

Detect if heaping is worse on terminal digits 0s than on 5s

check_heaping_roughness()

Evaluate roughness of data in 5-year age groups

Graduation

Functions to graduate demographic counts. Methods include Sprague, Beers ordinary, Beers modified, monotone spline, PCLM and uniform.

graduate()

Graduate grouped data

Smoothing

Functions to smooth demographic counts. Methods include Carrier-Farrag, KKN, Arriaga, United Nations, Strong, spencer, Zigzag, Zelnik, MAV.

smooth_age_5()

Smooth populations in 5-year age groups using various methods

agesmth1()

Generic smoother over age or time

Lifetable

Functions to construct a lifetable

lt_abridged()

Calculate an abridged-age lifetable.

lt_single_mx()

calculate a single age lifetable

lt_single_qx()

calculate a single age lifetable from qx

lt_single2abridged()

calculate an abridged life table that is consistent with a life table by single year of age

lt_abridged2single()

create a life table by single year of age by graduating an abridged life table

lt_ambiguous()

calculate an abridged or single age lifetable from abridged or single age data

lt_smooth_ambiguous()

Smooth and apply lt_ambiguous

Interpolation

Functions to interpolate counts

interp()

Interpolate between two population age distributions.

interp_coh()

Cohort component intercensal interpolation

Extrapolation

Functions to interpolate/extrapolate rates or counts

interp_lc_lim()

Lee-Carter method with limited data.

lt_rule_m_extrapolate()

Extrapolate old-age human mortality curve using mortality laws

OPAG()

Redistribute population over a specified age based on a stable standard fit to the data

Migration

Functions for migration models or estimation

mig_beta()

Estimate intercensal migration by comparing census population, by age and sex, to the results of a RUP projection.

mig_calculate_rc()

Calculate Rogers-Castro migration age schedule

mig_estimate_rc()

Estimate Rogers-Castro migration age schedule

mig_resid() mig_resid_stock() mig_resid_cohort() mig_resid_time()

Estimate net migration using residual methods: stock change, time even flow and cohort even flow

mig_un_fam()

Net migration by age for an UN family

mig_un_families

Proportion of net migrants by age and sex for considered migration profiles

mig_un_params

Parameters for considered migration profiles

Miscelaneous data operations

groupAges()

Group single ages into equal age groups of arbitrary width

rescaleAgeGroups()

rescale counts in age groups to match counts in different age groups

Internal graduation

graduate_beers()

The ordinary modified Beers splitting methods

graduate_beers_expand()

Create the Beers ordinary or modified coefficient matrix

graduate_beers_johnson()

Adjust ages under 10 using a modification of Beers

graduate_grabill()

The basic Grabill age-splitting method

graduate_grabill_expand()

Create the Grabill coefficient matrix.

graduate_mono()

Graduate age groups using a monotonic spline.

graduate_mono_closeout()

blend the Sprague upper boundary age estimates into monotonic spline estimates

graduate_pclm()

wrapper for ungroup::pclm method of splitting binned counts

graduate_sprague()

The basic Sprague age-splitting method.

graduate_sprague_expand()

Create the Sprague coefficient matrix.

graduate_uniform()

Convert arbitrary age groupings into single years of age.

splitOscillate()

An oscillatory average of age splits.

Internal smoothing

smooth_age_5()

Smooth populations in 5-year age groups using various methods

smooth_age_5_arriaga()

E. Arriaga's method of population count smoothing

smooth_age_5_cf()

The Carrier-Farrag method of population count smoothing

smooth_age_5_feeney()

Feeney'S formula on 9 years to correct for heaping on multiples of 5.

smooth_age_5_kkn()

Karup-King-Newton method of population count smoothing

smooth_age_5_mav()

Smooth in 5-year age groups using a moving average

smooth_age_5_strong()

A strong method of population count smoothing

smooth_age_5_un()

The old United Nations method of population count smoothing

smooth_age_5_zigzag()

G. Feeney's method of smoothing counts in 5-year age groups.

smooth_age_5_zigzag_inner()

G. Feeney's method of removing the zigzag from counts in 5-year age groups.

smooth_age_5_zigzag_min()

Objective function to minimize Feeney's zigzag method residual

smooth_age_5_zigzag_p()

Smooth population counts using Feeney's zigzag method and smoothing parameters.

agesmth1()

Generic smoother over age or time

loess_smth1()

Wrapper to LOESS using demographic data.

poly_smth1()

Fit a polynomial to demographic data

spencer()

Smoothing of an age structure by single years using Spencer's formula.

zelnik()

Zelnik 11-term moving average to adjust for digit preference.

Auxiliary lifetable functions

lt_a_closeout()

Life expectancy in the open age group.

lt_a_pas()

PAS a(x) rule of thumb.

lt_a_un()

UN a(x) estimates from either M(x), q(x), or both

lt_abridged()

Calculate an abridged-age lifetable.

lt_abridged2single()

create a life table by single year of age by graduating an abridged life table

lt_ambiguous()

calculate an abridged or single age lifetable from abridged or single age data

lt_id_L_T()

Derive lifetable total person years left to live from exposure.

lt_id_Ll_S()

Calculate survivor ratios

lt_id_d_l()

Derive survivorship from lifetable deaths

lt_id_d_q()

Derive death probabilities from lifetable deaths

lt_id_l_d()

Derive lifetable deaths from survivorship.

lt_id_l_q()

Derive lifetable death probabilities from survivorship.

lt_id_lda_L()

Derive lifetable exposure from lx, ndx and nax.

lt_id_ma_q()

Calculate conditional death probabilities from nMx and nax

lt_id_morq_a()

wrapper to invoke PAS or UN ax methods given qx or mx

lt_id_morq_a_greville()

UN version of the Greville formula for a(x) from M(x)

lt_id_q_l()

Derive lifetable survivorship (lx) from death probabilities.

lt_id_qa_m()

Derive nMx from nqx and nax.

lt_id_qm_a()

Derive nax from nqx and nMx.

lt_model_lq()

Estimate Wilmoth Model Life Table

lt_rule_1a0()

calculate a0 in different ways

lt_rule_1a0_ak()

Andreev-Kingkade approximation for a0

lt_rule_1a0_cd()

Coale-Demeny a(0) as function of m(0), region, and sex.

lt_rule_4a1_cd()

Coale-Demeny 4a1 as function of M(0), region, and sex.

lt_rule_4m0_D0()

rule of thumb for splitting infants from deaths under 5

lt_rule_4m0_m0()

rule of thumb for estimating infant mortality rate from under 5 mortality

lt_rule_ak_m0_a0()

estimates a0 using the Andreev-Kingkade rule of thumb starting with an event exposure rate

lt_rule_ak_q0_a0()

estimates a0 using the Andreev-Kingkade rule of thumb starting with IMR

lt_rule_m_extrapolate()

Extrapolate old-age human mortality curve using mortality laws

lt_single2abridged()

calculate an abridged life table that is consistent with a life table by single year of age

lt_single_mx()

calculate a single age lifetable

lt_single_qx()

calculate a single age lifetable from qx

lt_smooth_ambiguous()

Smooth and apply lt_ambiguous

single2abridged()

Convert single age groups to five-year group abridged

Auxiliary checking functions

is_abridged()

Detect if a vector of lower age bounds is plausibly of abridged ages.

is_age_coherent()

check for coherence within Age and between Age and AgeInt

is_age_redundant()

check for redundant age specification

is_age_sequential()

is Age sorted sequentially?

is_single()

Logical checking of whether age classes appear single.

Datasets

pop1m_ind

Indian male population 1971

pop1m_pasex

Male population by 1 year age groups

pop1m_rus2002

Russian census 2002 male population by 1 year age groups

pop1m_rus2010

Russian census 2010 male population by 1 year age groups

pop5_mat

Matrix of population over 5 years

pop5m_pasex

Male population by 5 year age groups

popA_earlier

Abridged population from PAS AGEINT -- earlier

popA_later

Abridged population from PAS AGEINT -- later

pop_f_mat_five

Population matrix for females five year age groups between 1950 and 2050

pop_f_mat_single

Population matrix for females single ages between 1999 and 2019

pop_m_mat_five

Population matrix for males five year age groups between 1950 and 2050

pop_m_mat_single

Population matrix for males single ages between 1999 and 2019

Auxiliary population structure functions

basepop_five()

BPA and BPE methods for adjusting age groups under 10

calcAgeN()

Calculate which large age group single ages belong to.

shift_census_ages_to_cohorts()

shift census populations to match single year cohorts

dec.date()

Convert date to decimal year fraction.

dth5_zigzag

Deaths by 5 year age groups

fitted_logquad_b

LogQuad model for BOTH SEX fitted for all HMD life tables

fitted_logquad_f

LogQuad model for FEMALES fitted for all HMD life tables

fitted_logquad_m

LogQuad model for MALES fitted for all HMD life tables

Internal

Internal functions

OPAG_fit_stable_standard()

creates stable standard based on optimizing the growth rate

OPAG_nLx_warp_r()

Warps a given stationary population into a stable population

OPAG_r_min()

calculates residual for optimizing growth rate r for OPAG family

OPAG_simple()

redistribute an open age group count over higher ages proportional to an arbitrary standard

downloadSRB()

Extract SRB estimates from WPP2019

downloadnLx()

Extract Lx estimates from WPP2019. Mainly an util function for other ones.

ADM()

Mean absolute difference in survival rates.

age2ageN()

repeat age lower bounds once for each single age

age2int()

Infer age class intervals from lower age bounds.

AGEN()

Trim two age vectors to matching N-year age groups.

ageSexAccuracyDasGupta()

Calculate Das Gupta's (1995) age sex accuracy index

age_abridge_force()

force a (count) vector to abridged ages

avg_adj()

calculate average of vector elements adjacent to and excluding the index element

birthCohorts()

Create the historical birth cohorts for a census.

calcAgeAbr()

Calculate which abridged age group single ages belong to.

getModelLifeTable()

Wrapper to provide a single location to reference all model life tables.

groupAges()

Group single ages into equal age groups of arbitrary width

groupOAG()

Group down to a new open age class.

heapify()

Induce heaping on terminal digits 0 and 5

inferAgeIntAbr()

Infer abridged age groups widths.

int2age()

Infer lower age bounds from age class intervals.

int2ageN()

repeat age lower bounds once for each single age

interpolatePop()

Interpolate between two population age distributions.

ma()

A simple centered moving average function.

mav()

Calculate the moving average (mav) over 3 or 5 years.

maxA2abridged()

Determine abridged ages up to a given maximum age group.

names2age()

detect ages from names of vector(s)

ratx()

Take consecutive ratios of a vector.

rescale_vector()

Rescale a vector proportionally to a new sum.

RDM()

Mean absolute difference in age-ratios of survival rates.

rlog()

Logging that does not cause jams.

shift.vector()

Shift a vector left or right.

simplify.text()

convert strings to concatenation of lower case alphabet

surv10()

Estimate survival curve from censuses spaced 10 years apart.

surv5()

Estimate survival curve from censuses spaced 5 years apart.

survN()

Estimate survival curve from censuses spaced N years apart.