Model mortality or fertility data using functional principal components as proposed by Hyndman & Ullah (2007) Missing rates are set to the geometric mean rate for the relevant age.
Arguments
- .data
A vital object including an age variable and a variable containing mortality or fertility rates.
- rates
Variable in `.data` containing mortality or fertility rates. If omitted, it will search for a variable with one of the following names: `mx`, `mortality`, `fx`, `fertility` or `rate` (not case sensitive).
- order
Number of principal components to fit.
References
Hyndman, R.J., and Ullah, S. (2007) Robust forecasting of mortality and fertility rates: a functional data approach. Computational Statistics & Data Analysis, 51, 4942-4956. https://robjhyndman.com/publications/funcfor/
Examples
# Compute Hyndman-Ullah model for Australian females, males and total
aus_hu <- aus_mortality |>
dplyr::filter(Code == "AUS") |>
fpc_model()
aus_hu
#> Functional data model
#>
#> Sub-groups:
#> # A tibble: 3 × 4
#> Sex State Code varprop
#> <chr> <chr> <chr> <dbl>
#> 1 female Australia AUS 0.980
#> 2 male Australia AUS 0.970
#> 3 total Australia AUS 0.984
autoplot(aus_hu) +
patchwork::plot_annotation("Hyndman-Ullah components for Australia")