MyNixOS website logo
Description

Bayesian Mortality Modelling with 'Stan'.

Implementation of popular mortality models using the 'rstan' package, which provides the R interface to the 'Stan' C++ library for Bayesian estimation. The package supports well-known models proposed in the actuarial and demographic literature including the Lee-Carter (1992) <doi:10.1080/01621459.1992.10475265> and the Cairns-Blake-Dowd (2006) <doi:10.1111/j.1539-6975.2006.00195.x> models. By a simple call, the user inputs deaths and exposures and the package outputs the MCMC simulations for each parameter, the log likelihoods and predictions. Moreover, the package includes tools for model selection and Bayesian model averaging by leave future-out validation.

R-CMD-check CRAN_Status_Badge

Package Website

StanMoMo

The StanMoMo package performs Bayesian Mortality Modeling with Stan, which is a C++ package for performing full Bayesian inference (see https://mc-stan.org/). The current package supports a variety of popular mortality models: the Lee-Carter (LC) model, the Renshaw-Haberman model (LC with cohort effect), the Age-Period-Cohort (APC) model, the Cairns-Blake-Dowd (CBD) model and the M6 model (CBD with cohort effect). By a simple function call, the user obtains the MCMC simulations for each parameter, the log likelihoods and death rates predictions. Moreover, the package includes tools for model selection and Bayesian model averaging by leave-future-out validation.

Installation

To install the stable version on CRAN:

install.packages("StanMoMo")

To install the source package from Github:

install.packages("devtools")
devtools::install_github('kabarigou/StanMoMo')

The installation of the source package may take a few minutes (models need to be compiled). For this reason, we recommend to install the binary package instead. Once the package is installed, you can perform Bayesian mortality forecasting in a matter of seconds.

After installing the package, you have to load the package via:

library(StanMoMo)

Comments if you install from source (install_github)

The main purpose of this package is to provide users high-level functions for estimating and forecasting mortality models in a Bayesian setting without requiring any knowledge of the Stan modeling language. This package depends on the rstan package, which translates the Stan model to C++ code, which is compiled into a dynamic shared object (DSO). If you install the binary package (what we recommend), the mortality models are already pre-compiled. If you install the source package, the models are compiled during the installation and therefore you need a C++ compiler on your machine (for instance, Rtools for Windows or Xcode on Mac, see here for more details).

Feedback is greatly appreciated

If you have any comments, suggestions for improvements or if you are motivated to contribute to the package, feel free to email [email protected]

Citation

This package is related to our paper. When referring to this package, please cite as

Barigou, K., Goffard, P. O., Loisel, S., & Salhi, Y. (2023). Bayesian model averaging for mortality forecasting using leave-future-out validation. International Journal of Forecasting, 39(2), 674-690.

Metadata

Version

1.2.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows