Learn R Programming

demography (version 1.22)

hmd: Summary for functional demographic model or Lee-Carter model

Description

hmd.mx reads "Mx" (1x1) data from the Human Mortality Database (HMD http://www.mortality.org) and constructs a demogdata object suitable for plotting using plot.demogdata and fitting an LC or BMS model using lca or an FDA model using fdm. hmd.pop reads "Population" (1x1) data from the HMD and constructs a demogdata object suitable for plotting using plot.demogdata. hmd.e0 reads life expectancy at birth from the HMD and returns the result as a ts object.

Usage

hmd.mx(country, username, password, label = country)

hmd.e0(country, username, password)

hmd.pop(country, username, password, label = country)

Value

hmd.mx returns an object of class demogdata with the following components:

year

Vector of years

age

Vector of ages

rate

A list containing one or more rate matrices with one age group per row and one column per year.

pop

A list of the same form as rate but containing population numbers instead of demographic rates.

type

Type of object: “mortality”, “fertility” or “migration”.

label

label

hmd.pop returns a similar object but without the rate component. hmd.e0 returns an object of class ts with columns male, female and total.

Arguments

country

Directory abbreviation from the HMD. For instance, Australia = "AUS". See below for other countries.

username

HMD username (case-sensitive)

password

HMD password (case-sensitive)

label

Character string giving name of country from which the data are taken.

Author

Rob J Hyndman

Details

In order to read the data, users are required to create their account via the HMD website (http://www.mortality.org), and obtain a valid username and password.

The country codes (as at 23 December 2016) are as follows.

AustraliaAUS
AustriaAUT
BelarusBLR
BelgiumBEL
BulgariaBGR
CanadaCAN
ChileCHL
Czech RepublicCZE
DenmarkDNK
EstoniaEST
FinlandFIN
France-- France total population
FRATNP-- France civilian population
FRACNPGermany
-- Germany total populationDEUTNP
-- West GermanyDEUTFRG
-- East GermanyDEUTGDR
GreeceGRC
HungaryHUN
IcelandISL
IrelandIRL
IsraelISR
ItalyITA
JapanJPN
LatviaLVA
LithuaniaLTU
LuxembourgLUX
NetherlandsNLD
New Zealand-- NZ total population
NZL_NP-- NZ Maori
NZL_MA-- NZ non-Maori
NZL_NMNorway
NORPoland
POLPortugal
PRTRussia
RUSSlovakia
SVKSlovenia
SVNSpain
ESPSweden
SWESwitzerland
CHETaiwan
TWNUnited Kingdom
-- UK Total PopulationGBR_NP
-- England & Wales Total PopulationGBRTENW
-- England & Wales Civilian PopulationGBRCENW
-- ScotlandGBR_SCO
-- Northern IrelandGBR_NIR
U.S.A.USA
UkraineUKR

See Also

demogdata,read.demogdata,plot.demogdata, life.expectancy

Examples

Run this code
if (FALSE) {
norway <- hmd.mx("NOR", username, password, "Norway")
summary(norway)}

Run the code above in your browser using DataLab