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

Description Usage Arguments Value References See Also Examples

View source: R/lyl_plot.R

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 τ.

Usage

1

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

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# 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 Feb. 17, 2021, 1:07 a.m.