arc: Calculate annualized rate of change (ARC)

View source: R/change.R

arcR Documentation

Calculate annualized rate of change (ARC)

Description

Calculate annualized rate of change from one vector which includes numeric year and another vector which includes values of some measure for those years.

Usage

arc(years, values, denominator = 100)

Arguments

years

[numeric()]
Years corresponding to input values

values

[numeric()]
Input values for some measure evaluated over time

denominator

[numeric()]
Default to 100 for percent (ex: 20%). Specify denominator = 1 to get annualized rate of change as a decimal (ex: 0.20).

Details

ARC for the period between years i and j is calculated as:

arc[i,j] = 100 * ln(value_j / value_i) / (year_j - year_i)

Index is such that for index i, output[i] is arc for period years[i - 1] to years[i] and the first entry in the output is NA. This function does not sort years so users should check inputs are ordered correctly.

Value

[numeric()]
Annualized rate of change for the intervals between elements of years.

See Also

  • Preston Demography textbook Chapter 1

  • https://www.un.org/esa/sustdev/natlinfo/indicators/methodology_sheets/demographics/population_growth_rate.pdf

Examples

# vectors
arc(years = c(2000, 2005, 2010), values = c(10, 20, 25))

# data.table
library(data.table)
dt <- data.table(
  year = c(2000, 2005, 2010),
  val = c(10, 20, 25)
)
dt[, arc := arc(years = year, values = val)]


ihmeuw-demographics/demUtils documentation built on Feb. 27, 2024, 1:25 p.m.