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

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).

Value

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

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.

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))
#> [1] NA 13.862944 4.462871
# 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)]
#> year val arc #> 1: 2000 10 NA #> 2: 2005 20 13.862944 #> 3: 2010 25 4.462871