Functional data model of mortality or fertility rates as a function of age.
FDM()
returns a functional data model applied to the formula's response
variable as a function of age.
Usage
FDM(formula, order = 6, ts_model_fn = fable::ARIMA, coherent = FALSE, ...)
Arguments
- formula
Model specification.
- order
Number of principal components to fit.
- ts_model_fn
Univariate time series modelling function for the coefficients. Any model that works with the fable package is ok. Default is
fable::ARIMA()
.- coherent
If TRUE, fitted models are stationary, other than for the case of a key variable taking the value
geometric_mean
. This is designed to work with vitals produced usingmake_pr()
. Default is FALSE. It only works whents_model_fn
isARIMA()
.- ...
Not used.
References
Hyndman, R. J., and Ullah, S. (2007) Robust forecasting of mortality and fertility rates: a functional data approach. Computational Statistics & Data Analysis, 5, 4942-4956. https://robjhyndman.com/publications/funcfor/
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. https://robjhyndman.com/publications/coherentfdm/
Examples
hu <- norway_mortality |>
dplyr::filter(Sex == "Female", Year > 2010) |>
smooth_mortality(Mortality) |>
model(hyndman_ullah = FDM(log(.smooth)))
report(hu)
#> Series: .smooth
#> Model: FDM
#> Transformation: log(.smooth)
#>
#> Basis functions
#> # A tibble: 111 × 8
#> Age mean phi1 phi2 phi3 phi4 phi5 phi6
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 0 -6.27 -0.0449 0.0255 0.201 0.204 -0.127 -0.201
#> 2 1 -8.55 0.145 0.138 0.114 0.168 -0.552 -0.0761
#> 3 2 -9.03 0.149 0.0988 0.0483 0.186 -0.425 -0.105
#> 4 3 -9.25 0.131 0.122 -0.0698 0.187 -0.213 0.0107
#> 5 4 -9.36 0.0949 0.136 -0.174 0.189 -0.0671 0.127
#> # ℹ 106 more rows
#>
#> Coefficients
#> # A tsibble: 12 x 8 [1Y]
#> Year mean beta1 beta2 beta3 beta4 beta5 beta6
#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2011 1 2.11 -0.0369 0.245 -0.295 0.252 0.0308
#> 2 2012 1 0.326 0.276 0.0759 1.14 -0.00489 -0.0688
#> 3 2013 1 0.137 0.241 0.668 0.472 -0.0588 0.130
#> 4 2014 1 -0.855 0.164 0.651 -0.153 0.418 -0.0757
#> 5 2015 1 -0.602 -0.0649 0.798 -0.383 -0.214 0.205
#> # ℹ 7 more rows
#>
#> Time series models
#> beta1 : ARIMA(0,0,0)
#> beta2 : ARIMA(0,0,0)
#> beta3 : ARIMA(1,0,0)
#> beta4 : ARIMA(0,0,0)
#> beta5 : ARIMA(0,0,0)
#> beta6 : ARIMA(1,0,0)
#>
#> Variance explained
#> 32.84 + 27.94 + 19.04 + 14.39 + 2.91 + 1.14 = 98.25%
autoplot(hu)