lyl_checkplot: Plot number of persons at risk at each specific age.

View source: R/lyl_plot.R

lyl_checkplotR Documentation

Plot number of persons at risk at each specific age.

Description

Given a lyl_range-class object, lyl_checkplot draws numbers of persons at risk of dying at each specific age from age_begin until age \tau.

Usage

lyl_checkplot(x)

Arguments

x

An object of class lyl_range obtained with the lyl_range function.

Value

A plot with the number of persons at risk at each specific age.

References

  • Plana-Ripoll et al. lillies – An R package for the estimation of excess Life Years Lost among patients with a given disease or condition. PLoS ONE. 2020;15(3):e0228073.

See Also

lyl_range for estimation of Life Years Lost for a range of different ages.

Examples

# Load simulated data as example
data(simu_data)

# Estimate remaining life expectancy and Life Years
# Lost after each age from 0 to 94 years and before age 95 years
lyl_estimation <- lyl_range(data = simu_data, t = age_death, status = death,
                            age_begin = 45, age_end = 50, tau = 95)

# Check whether small numbers could compromise the results
lyl_checkplot(lyl_estimation)

# The plot can be modified with a usual ggplot2 format
lyl_checkplot(lyl_estimation) +
  ggplot2::geom_hline(yintercept = 10, linetype = "dashed", color = "red") +
  ggplot2::xlab("Age [in years]") +
  ggplot2::ggtitle("Persons at risk of dying at each age 0-94 years")


lillies documentation built on Aug. 7, 2023, 5:09 p.m.