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.0448 0.0254 0.201 0.204 -0.127 -0.201
#> 2 1 -8.54 0.145 0.138 0.114 0.168 -0.552 -0.0758
#> 3 2 -9.03 0.149 0.0984 0.0485 0.186 -0.425 -0.104
#> 4 3 -9.25 0.131 0.122 -0.0694 0.188 -0.213 0.0109
#> 5 4 -9.36 0.0948 0.136 -0.173 0.190 -0.0672 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.0396 0.243 -0.295 0.252 0.0309
#> 2 2012 1 0.325 0.276 0.0792 1.14 -0.00480 -0.0689
#> 3 2013 1 0.138 0.240 0.669 0.470 -0.0590 0.130
#> 4 2014 1 -0.853 0.164 0.651 -0.155 0.418 -0.0758
#> 5 2015 1 -0.601 -0.0655 0.797 -0.385 -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.83 + 27.94 + 19.04 + 14.39 + 2.91 + 1.14 = 98.25%
autoplot(hu)