Package 'beers'

Title: Calculate Beers Ordinary Interpolation
Description: Calculate Beers Interpolation (both Ordinary and Modified method); a six-term formula which minimizes the fifth differences of the interpolated results. See p877 of The Methods and Materials of Demography, Volume 2, referring to Beers, The Record of the American Institute of Actuaries, 34, Part I (69):59-60, June 1945.
Authors: Wes Hinsley [aut, cre]
Maintainer: Wes Hinsley <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2024-11-14 06:14:57 UTC
Source: https://github.com/mrc-ide/beers

Help Index


beers: A package for computing Beers ordinary and modified interpolation

Description

beers: A package for computing Beers ordinary and modified interpolation


Beers interpolation, using ordinary or modified method.

Description

Create 4 interpolated points between each pair of given values. With the ordinary method, the given data points given will be included unchanged in the interpolated list. With the modified method, some smoothing occurs, and only the first and last points given are guaranteed to appear unchanged in the interpolated list.

Usage

beers_int_ordinary(points)

beers_int_modified(points)

Arguments

points

A list of at least 6 numbers, eg, populations over time.

Value

A list with four extra interpolated points between each pair of given points.

Examples

# Interpolate population of UK (1950, 1955, 1960, 1965, 1970, 1975) to yearly points

beers_int_ordinary(c(50616014, 51123707, 52433157, 54303107, 55634935, 56211947))
beers_int_modified(c(50616014, 51123707, 52433157, 54303107, 55634935, 56211947))

Beers subdivision, using ordinary or modified method.

Description

With the ordinary method, each set of 5 subdivided values will always sum to the original data point given. With the modified method, some smoothing occurs, and this property is only true for the first and last given data point.

Usage

beers_sub_ordinary(points)

beers_sub_modified(points)

Arguments

points

A list of at least 5 numbers, eg, populations by 5-year age-band.

Value

For subdivision: a list 5 times as long as the original, with each point subdivided into 5.

Examples

# Subdivide population of UK (2015), ages 0-4, 5-9, 10-14, 15-19, 20-24 into single years.

beers_sub_ordinary(c(4042918, 3927745, 3529200, 3779712, 4174572))
beers_sub_modified(c(4042918, 3927745, 3529200, 3779712, 4174572))