crude_mx_sh2: Data frame(s) of crude estimates of quarterly (and annual)...

View source: R/crude_mx_sh2.R

crude_mx_sh2R Documentation

Data frame(s) of crude estimates of quarterly (and annual) central rates of mortality estimated using shortcut 2.

Description

Computes for a general/insured population crude estimates of quarterly (and annual) central rates of mortality by age (in a set of integer ages) for each combination of age and calendar quarter, using age aggregated data of population stocks and age-season quarterly counts of deaths by employing shortcut 2, based on equation (2.7), proposed in Pavia and Lledo (2023).

Usage

crude_mx_sh2(pop.start, pop.end, events.death, annual = FALSE)

Arguments

pop.start

A data frame, corresponding to the target population/portfolio, containing the stock of population/portfolio by age collected at the beginning of the year. This data frame must have two columns. The first column refers to age and the second to the number of people in the population/portfolio corresponding to each age.

pop.end

A data frame, corresponding to the target population/portfolio, containing the stock of population/portfolio by age collected at the end of the year. This data frame must have two columns. The first column refers to age and the second to the number of people in the population/portfolio corresponding to each age.

events.death

A data frame with the number of deaths recorded in the population/portfolio during the target year in a set of integer ages for each combination of age and season/calendar quarter. Typically, this is an output of the function count_events_quarter or a data frame with the same structure. If the range of ages in 'events.death' does not cover the range of ages in the intersection of ages defined by 'pop.start' and 'pop.end', zeros are imputed for the missing ages.

annual

A character string informing whether the annual crude central rates of mortality should also be computed. Default, 'FALSE'.

Value

When 'annual = FALSE' a data frame with estimated crude central rates of mortality for each combination of age and calendar quarter in the set of integer ages determined by the intersection of ages of 'pop.start' and 'pop.end'. The data frame has the following components:

age

Integer age to which the crude central rate of mortality corresponds.

quarter.age

Age quarter to which the crude central rate of mortality corresponds.

quarter.calendar

Calendar (time, season) quarter to which the crude central rate of mortality corresponds.

exposed

Total exposure-at-risk times in the target population, calulated according to shortcut 2, for each combination of 'age', 'quarter.age' and 'quarter.calendar'.

deaths

Number of deaths in the target population for each combination of 'age', 'quarter.age' and 'quarter.calendar'.

mx

Estimated crude central rate of mortality corresponding to the combination of 'age', 'quarter.age' and 'quarter.calendar'.

When 'annual = TRUE' the output is a list with two data frames 'mx.quarterly' and 'mx.annual'. 'mx.quarterly' is a data frame with the estimated quarterly crude central rates of mortality as just described and 'mx.annual' is the corresponding data frame with the estimated annual crude central rates of mortality.

Note

It is the responsibility of the user to assure that both stocks of population (which determine the ages for which estimates are computed) and number of events correspond to the same year.

Author(s)

Jose M. Pavia pavia@uv.es

Josep Lledo josep.lledo@uv.es

References

Pavia, JM and Lledo, J (2023). Shortcuts for the construction of sub-annual life tables. *ASTIN Bulletin: The Journal of the International Actuarial Association*, 53(2), 332-350. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1017/asb.2023.16")}

See Also

crude_mx, crude_mx_sh3.

Examples


# This can take a while
 pop <- 2005 - as.numeric(substr(pop_2006$date.birth, 1 , 4))
 pop <- as.data.frame(table(pop))
 pop[, 1] <- as.numeric(as.character(pop[, 1]))
 temp <- quarterly_variables(death_2006$date.birth, death_2006$date.death)
 e.death <- count_events_quarter(temp)
 out <- crude_mx_sh2(pop, pop, e.death)


# Fast example
pop.1 <- data.frame(age = c(40, 41), people = c(4134, 4353))
pop.2 <- data.frame(age = c(40, 41), people = c(4250, 4213))
dates.b <- c("1980-04-12")
dates.d <- c("2020-08-23")
x <- quarterly_variables(dates.b, dates.d)
e.death <- count_events_quarter(x)
out <- crude_mx_sh2(pop.1, pop.2, e.death)

qlifetable documentation built on June 28, 2024, 9:11 a.m.