lyl_diff: Summarize differences in Life Years Lost.

Description Usage Arguments Value References See Also Examples

View source: R/lyl_diff.R

Description

lyl_diff summarizes differences in estimated Life Years Lost in two different populations: lyl_estimation compared to lyl_estimation0.

Usage

1
2
3
4
5
6
7
lyl_diff(
  lyl_population1,
  lyl_population0,
  decimals = 2,
  level = 0.95,
  weights = NA
)

Arguments

lyl_population1

Population of interest: An object of class lyl or lyl_range (obtained with functions lyl or lyl_range). Alternatively, an object of class lyl_ci can be provided for bootstrapped confidence intervals.

lyl_population0

Reference population: An object of class lyl or lyl_range (obtained with functions lyl or lyl_range). Alternatively, an object of class lyl_ci can be provided for bootstrapped confidence intervals.

decimals

Number of decimals to be reported (default is 2).

level

Confidence level if lyl_population1 or lyl_population0 is obtained with the lyl_ci function (default is 0.95 for 95% confidence intervals)

weights

Vector with age distribution of disease/condition onset to be used when Life Years Lost are estimated over a range of ages (with lyl_range function). If weights are not provided (dafault is weights = NA), then the differences in Life Years Lost at each age is provided. If weights are provided, then a weighted average is provided.

Value

A table with the summary of the differences between two populations.

References

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Load simulated data as example
data(simu_data)

### For the overall population and for those with a disease
diseased <- simu_data[!is.na(simu_data$age_disease), ]

# Estimate remaining life expectancy and Life Years
# Lost due to specific causes of death after age 45
# years and before age 95 years
lyl_estimation0 <- lyl(data = simu_data, t = age_death, status = cause_death,
                       age_specific = 45, tau = 95)
lyl_estimation1 <- lyl(data = diseased, t0 = age_disease,
                       t = age_death, status = cause_death,
                       age_specific = 45, tau = 95)
lyl_diff(lyl_estimation1, lyl_estimation0)
lyl_compare_plot(list(lyl_estimation1, lyl_estimation0))


# Calculate bootstrapped confidence interval (3 iterations to test)
lyl_estimation1_ci <- lyl_ci(lyl_estimation1, niter = 3)

lyl_estimation0_ci <- lyl_ci(lyl_estimation0, niter = 3)
lyl_diff(lyl_estimation1_ci, lyl_estimation0_ci)

# It is also possible to assume no uncertainty for one of the estimates
lyl_diff(lyl_estimation1_ci, lyl_estimation0)

# Estimate remaining life expectancy and Life Years
# Lost due to specific causes of death after each age
# from 0 to 94 years and before age 95 years
lyl_estimation2 <- lyl_range(data = simu_data, t = age_death, status = cause_death,
                             age_begin = 0, age_end = 94, tau = 95)
lyl_estimation3 <- lyl_range(data = diseased, t0 = age_disease,
                             t = age_death, status = cause_death,
                             age_begin = 0, age_end = 94, tau = 95)
lyl_diff(lyl_estimation3, lyl_estimation2)
lyl_diff(lyl_estimation3, lyl_estimation2, weights = diseased$age_disease)

# Calculate bootstrapped confidence interval (3 iterations to test)
lyl_estimation3_ci <- lyl_ci(lyl_estimation3, niter = 3)
lyl_diff(lyl_estimation3_ci, lyl_estimation2, weights = diseased$age_disease)

lillies documentation built on Feb. 17, 2021, 1:07 a.m.

Related to lyl_diff in lillies...