| Title: | Birth rate forecast based on the FSO methodology |
|---|---|
| Description: | First, model input data are calculated. Second, TFR (total fertility rate) and MAB (mean age of the mother at birth) are predicted. Third, TFR and MAB forecasts are used to predict the age-specific birth rates. |
| Authors: | Klemens Rosin [aut], Felix Lorenz [aut], Norah Efosa [aut, cre], Felix Luginbuhl [ctb] (ORCID: <https://orcid.org/0009-0008-6625-2899>) |
| Maintainer: | Norah Efosa <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.1.0 |
| Built: | 2026-06-05 07:17:52 UTC |
| Source: | https://github.com/statistik-aargau/propopbirth |
Create model input data
create_input_data( population, births, year_first, year_last, age_fert_min, age_fert_max, fert_hist_years, binational = TRUE, digits_tfr = 3, digits_mab = 3, digits_fer = 5 )create_input_data( population, births, year_first, year_last, age_fert_min, age_fert_max, fert_hist_years, binational = TRUE, digits_tfr = 3, digits_mab = 3, digits_fer = 5 )
population |
data frame, female population at 'fertile age'; columns: spatial_unit, year, age, pop, with or without nat (nationality). |
births |
data frame, births of females in the fertile age range; columns: spatial_unit, year, age, pop, with or without nat (nationality). |
year_first |
numeric, first year. |
year_last |
numeric, last year. |
age_fert_min |
numeric, minimum age (of 'fertile age'). |
age_fert_max |
numeric, minimum age (of 'fertile age'). |
fert_hist_years |
how many years are used to calculate age-specific fertility rates? |
binational |
boolean, |
digits_tfr |
numeric, number of digits for tfr (total fertility rate). |
digits_mab |
numeric, number of digits for mab (mean age of the mother at birth). |
digits_fer |
numeric, number of digits for the fertility rate. |
list with:
tfr (total fertility rate),
mab (mean age of the mother at birth),
fer (fertility rate of last year(s))
create_input_data( population = fso_pop, births = fso_birth |> dplyr::filter(spatial_unit %in% c("Stadt Zuerich", "Frauenfeld", "Aarau")), year_first = 2011, year_last = 2023, age_fert_min = 15, age_fert_max = 49, fert_hist_years = 1, binational = TRUE )create_input_data( population = fso_pop, births = fso_birth |> dplyr::filter(spatial_unit %in% c("Stadt Zuerich", "Frauenfeld", "Aarau")), year_first = 2011, year_last = 2023, age_fert_min = 15, age_fert_max = 49, fert_hist_years = 1, binational = TRUE )
Forecast age-specific fertility rates.
forecast_fertility_rate( fer_dat, tfr_dat, mab_dat, year_start, year_end, maxit = 1000, abstol = 0.001, digits_birth_rate = 5 )forecast_fertility_rate( fer_dat, tfr_dat, mab_dat, year_start, year_end, maxit = 1000, abstol = 0.001, digits_birth_rate = 5 )
fer_dat |
data frame, fertility data, tibble with variables |
tfr_dat |
tfr data, tibble with variables |
mab_dat |
mab data, tibble with variables |
year_start |
numeric, start of prediction. |
year_end |
numeric, end of prediction. |
maxit |
numeric, maximum iterations of optimization. |
abstol |
numeric, absolute tolerance of optimization. |
digits_birth_rate |
numeric, number of digits of the birth rate. |
birth rate, tibble with variables spatial_unit, nat, age, birth_rate.
Forecast total fertility rate (TFR) or mean age of the mother at birth (MAB)
forecast_tfr_mab( topic, topic_data, trend_model, temporal_model, temporal_end = NA, constant_model )forecast_tfr_mab( topic, topic_data, trend_model, temporal_model, temporal_end = NA, constant_model )
topic |
character, defines the parameter to calculate ( |
topic_data |
data frame, input data tailored to the topic with variables:
|
trend_model |
vector, specifies the model type ( |
temporal_model |
vector, model type ( |
temporal_end |
data frame, contains y-values at the end of the temporal
forecast period ( |
constant_model |
model type ( |
data frame, predictions for either tfr or mab.
Data was retrieved from the FSO.
fso_birthfso_birth
A data frame with 437054 rows and 5 variables:
year within the range 2010-2023
Swiss municipalities by name
Nationality; either "ch" = Swiss or "int" = international
Age in full years
number of births
dplyr::glimpse(fso_birth)dplyr::glimpse(fso_birth)
End year population from different spatial units.
fso_popfso_pop
An object of class tbl_df (inherits from tbl, data.frame) with 2940 rows and 5 columns.
Get FSO population (females at 'fertile' age)
get_population_data( number_fso, year_first, year_last, age_fert_min, age_fert_max, spatial_code, spatial_unit, binational = TRUE )get_population_data( number_fso, year_first, year_last, age_fert_min, age_fert_max, spatial_code, spatial_unit, binational = TRUE )
number_fso |
character, number of FSO table (STAT-TAB) |
year_first |
numeric, first year. |
year_last |
numeric, last year. |
age_fert_min |
numeric, minimum age (of 'fertile age'). |
age_fert_max |
numeric, maximum age (of 'fertile age'). |
spatial_code |
character, vector, official FSO codes. |
spatial_unit |
character, vector, spatial unit names (free choice). |
binational |
boolean, |
female population at 'fertile age' at the end of the year, tibble (spatial_unit, year, age, pop), with or without nat (nationality)
get_population_data( number_fso = "px-x-0102010000_101", year_first = 2020, year_last = 2023, age_fert_min = 15, age_fert_max = 49, spatial_code = c("0261", "4566", "4001"), spatial_unit = c("Stadt Zuerich", "Frauenfeld", "Aarau"), binational = TRUE )get_population_data( number_fso = "px-x-0102010000_101", year_first = 2020, year_last = 2023, age_fert_min = 15, age_fert_max = 49, spatial_code = c("0261", "4566", "4001"), spatial_unit = c("Stadt Zuerich", "Frauenfeld", "Aarau"), binational = TRUE )