Make a new vital from means and differences of a measured variable by a key variable. The most common use case of this function is for computing migration numbers by sex, from the sex differences and mean of the numbers.
undo_sd(.data, .var, key = Sex, times =2000)
Arguments
.data: A vital object
.var: A bare variable name of the measured variable to use.
key: A bare variable name specifying the key variable to use. This key variable must include the value geometric_mean.
times: When the variable is a distribution, the product must be computed by simulation. This argument specifies the number of simulations to use.
Returns
A vital object
Examples
# Make sums and differencesmig <- net_migration(norway_mortality, norway_births)|> dplyr::filter(Sex !="Total")sd <- mig |> make_sd(NetMigration)# Undo products and ratiossd |> undo_sd(NetMigration)
References
Hyndman, R.J., Booth, H., & Yasmeen, F. (2013). Coherent mortality forecasting: the product-ratio method with functional time series models. Demography, 50(1), 261-283.