Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

StMoMoData

Create StMoMoData object from demogdata object


Description

Create StMoMoData object suitable for fitting a Stochastic Mortality Model using function fit.StMoMo.

Usage

StMoMoData(data, series = names(data$rate)[1], type = c("central",
  "initial"))

Arguments

data

demogdata object of type "mortality". It is either the output from functions read.demogdata or hmd.mx of package demography.

series

name of series within data to use.

type

the type of exposure that should be included in the output. The alternatives are "central" (default) and "initial". "central" exposures are suitable for fitting models under a log-Poisson framework while "initial" exposures are suitable under a logit-Binomial framework.

Value

A list with class "StMoMoData" with components:

Dxt

matrix of deaths data.

Ext

matrix of observed exposures.

ages

vector of ages corresponding to rows of Dxt and Ext.

years

vector of years corresponding to rows of Dxt and Ext.

type

the type of exposure in the data.

series

name of the extracted series.

label

label of the data.

Examples

## Not run: 
library(demography)
NZdata <- hmd.mx(country = "NZL_NP", username = username, password = password, 
label = "New Zealand")
NZStMoMo <- StMoMoData(NZdata, series = "male")
summary(NZStMoMo)

## End(Not run)

StMoMo

Stochastic Mortality Modelling

v0.4.1
GPL (>= 2)
Authors
Andres Villegas <andresmauriciovillegas@gmail.com>, Pietro Millossovich <Pietro.Millossovich.1@city.ac.uk>, Vladimir Kaishev <Vladimir.Kaishev.1@city.ac.uk>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.