extrapolate | R Documentation |
Extrapolate to dimensions beyond the range of those which exist in your data.table. Uses linear, rate of change, or uniform extrapolation.
extrapolate(
dt,
id_cols,
extrapolate_col,
value_col,
extrapolate_vals,
method,
n_groups_fit,
n_groups_bin = NULL
)
dt |
[ |
id_cols |
[ |
extrapolate_col |
[ |
value_col |
[ |
extrapolate_vals |
[ |
method |
[ |
n_groups_fit |
[ |
n_groups_bin |
[ |
For reference on rate of change, see page 12 of the Preston Demography book, or, https://www.un.org/esa/sustdev/natlinfo/indicators/methodology_sheets/demographics/population_growth_rate.pdf
Consider log transforming your data prior to extrapolation if appropriate.
[data.table()
] dt
with added rows for extrapolated values.
dt <- data.table::data.table(
group = c(rep("a", 5), rep("b", 5)),
x = rep(c(1:5), 2),
y = rep(seq(10, 50, 10), 2)
)
dt <- extrapolate(dt, id_cols = c("group", "x"), extrapolate_col = "x",
value_col = "y", extrapolate_vals = c(1:10),
method = "linear", n_groups_fit = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.