Title: | Estimation of Life Years Lost |
---|---|
Description: | Estimation of life expectancy and Life Years Lost (LYL, or lillies for short) for a given population, for example those with a given disease or condition. In addition, the package can be used to compare estimates from different populations, or to estimate confidence intervals. Technical details of the method are available in Plana-Ripoll et al. (2020) <doi:10.1371/journal.pone.0228073> and Andersen (2017) <doi:10.1002/sim.7357>. |
Authors: | Oleguer Plana-Ripoll [aut, cre] |
Maintainer: | Oleguer Plana-Ripoll <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.12 |
Built: | 2024-12-06 06:42:10 UTC |
Source: | CRAN |
A dataset containing age-specific number of new cases, number of deaths and mortality rates for a simulated disease with onset after age 40 years. Data is available for ages 40-90 years.
aggreg_data
aggreg_data
A data frame with 50 rows and 4 variables:
age
number of new cases diagnosed at that specific age
number of deaths among the diagnosed at that specific age
age-specific mortality rates among the diagnosed
Simulated data
lyl
estimates remaining life expectancy and Life Years Lost for a given population
after a specific age age_speficic
and restrictied to a maximum theoretical age .
lyl( data, t0 = NULL, t, status, age_specific, censoring_label = "Alive", death_labels = "Dead", tau = 100 )
lyl( data, t0 = NULL, t, status, age_specific, censoring_label = "Alive", death_labels = "Dead", tau = 100 )
data |
A dataframe, where each raw represents a person. The dataframe will
have a time-to-event format with at least two variables: age at end of follow-up ( |
t0 |
Age at start of the follow-up time. Default is |
t |
Age at the end of the follow-up time (death or censoring). |
status |
Status indicator, normally 0=alive, 1=dead. Other choices are
TRUE/FALSE (TRUE = death) or 1/2 (2=death). For multiple causes of death (competing risks
analysis), the status variable will be a factor, whose first level is treated as censoring; or
a numeric variable, whose lowest level is treated as censoring. In the latter case,
the label for censoring is |
age_specific |
Specific age at which the Life Years Lost have to be estimated. |
censoring_label |
Label for censoring status. If |
death_labels |
Label for event status. For only one cause of death, |
tau |
Remaining life expectancy and Life Years Lost are estimated restrictied to a maximum
theoretical age |
A list with class "lyl"
containing the following components:
data
: Data frame with 3 variables and as many observations as the original
data provided to estimate Life Years Lost: t0
, t
, and status
LYL
: Data frame with 1 observation and at least 3 variables: age
which corresponds
to age_spefific
; life_exp
which is the estimated remaining life expectancy at age age_specific
years
and before age tau
years; and one variable corresponding to the estimated Life Years Lost for each specific
cause of death. If only one cause of death is considered (no competing risks), this variable is Dead
and includes
the total overall Life Years Lost
tau
: Maximum theoretical age
age_specific
: Specific age at which the Life Years Lost have been estimated
data_plot
: A data frame in long format with 3 variables time
, cause
, and cip
used
to create a Figure of Life Years Lost with function plot
.
censoring_label
: Label for censoring status
death_labels
: Label(s) for death status
competing_risks
: Logical value (TRUE
= more than one cause of death (competing risks))
type
: Whether the estimation is at "age_specific"
or "age_range"
.
Andersen PK. Life years lost among patients with a given disease. Statistics in Medicine. 2017;36(22):3573- 3582.
Andersen PK. Decomposition of number of life years lost according to causes of death. Statistics in Medicine. 2013;32(30):5278-5285.
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.
lyl_range
for estimation of Life Years Lost for a range of different ages.
lyl_ci
to estimate bootstrapped confidence intervals.
lyl_diff
to compare Life Years Lost for two populations.
summary.lyl
to summarize objects obtained with function lyl
.
plot.lyl
to plot objects obtained with function lyl
.
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = death, age_specific = 45, tau = 95) # Summarize and plot the data summary(lyl_estimation) plot(lyl_estimation) # Estimate remaining life expectancy and Life Years # Lost due to specific causes of death after age 45 # years and before age 95 years lyl_estimation2 <- lyl(data = simu_data, t = age_death, status = cause_death, age_specific = 45, tau = 95) # Summarize and plot the data summary(lyl_estimation2) plot(lyl_estimation2)
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = death, age_specific = 45, tau = 95) # Summarize and plot the data summary(lyl_estimation) plot(lyl_estimation) # Estimate remaining life expectancy and Life Years # Lost due to specific causes of death after age 45 # years and before age 95 years lyl_estimation2 <- lyl(data = simu_data, t = age_death, status = cause_death, age_specific = 45, tau = 95) # Summarize and plot the data summary(lyl_estimation2) plot(lyl_estimation2)
lyl_2plot
was used to create a figure of Life Years Lost
at one specific age for two different populations. Please use
lyl_compare_plot
instead.
lyl_2plot( x, y, color_alive = NA, colors = NA, labels = c("Population of interest", "Reference population"), ... )
lyl_2plot( x, y, color_alive = NA, colors = NA, labels = c("Population of interest", "Reference population"), ... )
x |
An object of class |
y |
An object of class |
color_alive |
Color to be used for the censoring category. Default is NA, and default color is "white". |
colors |
Vector with one color for each cause of death. Default is NA, and default colors are used. |
labels |
Vector with labels for the two populations (default are "Population of
interest" for |
... |
Additional arguments affecting the plot produced. |
A plot with survival function and stacked cause-specific cumulative incidences for two populations side by side.
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.
lyl
for estimation of Life Years Lost at one specific age.
lyl_diff
to compare Life Years Lost for two populations.
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = cause_death, age_specific = 45, tau = 95) # Same estimate for those with a specific disease diseased <- simu_data[!is.na(simu_data$age_disease), ] lyl_estimation1 <- lyl(data = diseased, t0 = age_disease, t = age_death, status = cause_death, age_specific = 45, tau = 95) # Plot the data lyl_compare_plot(list(lyl_estimation1, lyl_estimation))
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = cause_death, age_specific = 45, tau = 95) # Same estimate for those with a specific disease diseased <- simu_data[!is.na(simu_data$age_disease), ] lyl_estimation1 <- lyl(data = diseased, t0 = age_disease, t = age_death, status = cause_death, age_specific = 45, tau = 95) # Plot the data lyl_compare_plot(list(lyl_estimation1, lyl_estimation))
lyl
estimates differences in remaining life expectancy and Life Years Lost
for two given life tables data
and data0
after a specific age age_speficic
and restrictied to a maximum theoretical age .
lyl_aggregated( data, age, rates, surv, data0, age0, rates0, surv0, age_specific, censoring_label = "Alive", death_labels = "Dead", tau = 100 )
lyl_aggregated( data, age, rates, surv, data0, age0, rates0, surv0, age_specific, censoring_label = "Alive", death_labels = "Dead", tau = 100 )
data |
A dataframe, where each raw represents an age, for the population of interest. The dataframe will contain information on age-specific mortality rates or survivial probability (if both parameters are provided, rates will be used). |
age |
Variable in |
rates |
Variable in |
surv |
Variable in |
data0 |
A dataframe, where each raw represents an age, for the population of reference The dataframe will contain information on age-specific mortality rates or survivial probability (if both parameters are provided, rates will be used). |
age0 |
Variable in |
rates0 |
Variable in |
surv0 |
Variable in |
age_specific |
Specific age at which the Life Years Lost have to be estimated. |
censoring_label |
Label for censoring status ( |
death_labels |
Label for event status ( |
tau |
Remaining life expectancy and Life Years Lost are estimated restrictied to a maximum
theoretical age |
A list with class "lyl_aggregated"
containing the following components:
data
: Name of the dataset preovided in parameter data
data0
: Name of the dataset preovided in parameter data0
LYL
: Data frame with 1 observation and 3 variables: age
which corresponds
to age_spefific
; and life_exp
and life_exp0
which are the estimated remaining life expectancies at age age_specific
years
and before age tau
years for the population provided in data
and data0
, respectively
tau
: Maximum theoretical age
age_specific
: Specific age at which the Life Years Lost have been estimated
data_plot
: A data frame in long format with 3 variables time
, cause
, and cip
used
to create a Figure of Life Years Lost with function plot
.
censoring_label
: Label for censoring status
death_labels
: Label(s) for death status
type
: Whether the estimation is at "age_specific"
or "age_range"
Andersen PK. Life years lost among patients with a given disease. Statistics in Medicine. 2017;36(22):3573- 3582.
Andersen PK. Decomposition of number of life years lost according to causes of death. Statistics in Medicine. 2013;32(30):5278-5285.
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.#'
lyl_aggregated_range
for estimation of Life Years Lost for a range of different ages.
summary.lyl_aggregated
to summarize objects obtained with function lyl_aggregated
.
plot.lyl_aggregated
to plot objects obtained with function lyl_aggregated
.
# Load simulated data as example data(aggreg_data) data(pop_ref) # Estimate remaining life expectancy and Life Years # Lost after age 70 years and before age 90 years lyl_summary_data70 <- lyl_aggregated(data = aggreg_data, age = age, rates = rate, data0 = pop_ref, age0 = age, surv0 = survival, age_specific = 70, tau = 90) # Summarize and plot the data summary(lyl_summary_data70) plot(lyl_summary_data70)
# Load simulated data as example data(aggreg_data) data(pop_ref) # Estimate remaining life expectancy and Life Years # Lost after age 70 years and before age 90 years lyl_summary_data70 <- lyl_aggregated(data = aggreg_data, age = age, rates = rate, data0 = pop_ref, age0 = age, surv0 = survival, age_specific = 70, tau = 90) # Summarize and plot the data summary(lyl_summary_data70) plot(lyl_summary_data70)
lyl
estimates differences in remaining life expectancy and Life Years Lost
for two given life tables data
and data0
after a range of specific ages
(age_begin
to age_end
) and restrictied to a maximum theoretical age .
lyl_aggregated_range( data, age, rates, surv, weights, data0, age0, rates0, surv0, age_begin, age_end, censoring_label = "Alive", death_labels = "Dead", tau = 100 )
lyl_aggregated_range( data, age, rates, surv, weights, data0, age0, rates0, surv0, age_begin, age_end, censoring_label = "Alive", death_labels = "Dead", tau = 100 )
data |
A dataframe, where each raw represents an age, for the population of interest. The dataframe will contain information on age-specific mortality rates or survivial probability (if both parameters are provided, rates will be used). |
age |
Variable in |
rates |
Variable in |
surv |
Variable in |
weights |
Variable in |
data0 |
A dataframe, where each raw represents an age, for the population of reference The dataframe will contain information on age-specific mortality rates or survivial probability (if both parameters are provided, rates will be used). |
age0 |
Variable in |
rates0 |
Variable in |
surv0 |
Variable in |
age_begin |
Specific starting age at which the Life Years Lost have to be estimated. |
age_end |
Specific ending age at which the Life Years Lost have to be estimated. |
censoring_label |
Label for censoring status ( |
death_labels |
Label for event status ( |
tau |
Remaining life expectancy and Life Years Lost are estimated restrictied to a maximum
theoretical age |
A list with class "lyl_aggregated"
containing the following components:
data
: Name of the dataset preovided in parameter data
data0
: Name of the dataset preovided in parameter data0
LYL
: Data frame with 1 observation and 2 variables: life_exp
and life_exp0
which are the
estimated remaining life expectancies averaged over the age range
and before age tau
years for the population provided in data
and data0
, respectively
tau
: Maximum theoretical age
age_begin
: Specific starting age at which the Life Years Lost have been estimated
age_end
: Specific ending age at which the Life Years Lost have been estimated
data_plot
: A data frame in long format with 3 variables time
, cause
, and cip
used
to create a Figure of Life Years Lost with function plot
.
censoring_label
: Label for censoring status
death_labels
: Label(s) for death status
type
: Whether the estimation is at "age_specific"
or "age_range"
.
Andersen PK. Life years lost among patients with a given disease. Statistics in Medicine. 2017;36(22):3573- 3582.
Andersen PK. Decomposition of number of life years lost according to causes of death. Statistics in Medicine. 2013;32(30):5278-5285.
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.#'
lyl_aggregated
for estimation of Life Years Lost at one specific age.
summary.lyl_aggregated
to summarize objects obtained with function lyl_aggregated_range
.
# Load simulated data as example data(aggreg_data) data(pop_ref) # Estimate remaining life expectancy and Life Years # Lost after each age from 40 to 89 years and before age 90 years lyl_summary_data <- lyl_aggregated_range(data = aggreg_data, age = age, rates = rate, weights = new_cases, data0 = pop_ref, age0 = age, surv0 = survival, age_begin = 40, age_end = 89, tau = 90) # Summarize the data summary(lyl_summary_data)
# Load simulated data as example data(aggreg_data) data(pop_ref) # Estimate remaining life expectancy and Life Years # Lost after each age from 40 to 89 years and before age 90 years lyl_summary_data <- lyl_aggregated_range(data = aggreg_data, age = age, rates = rate, weights = new_cases, data0 = pop_ref, age0 = age, surv0 = survival, age_begin = 40, age_end = 89, tau = 90) # Summarize the data summary(lyl_summary_data)
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 .
lyl_checkplot(x)
lyl_checkplot(x)
x |
An object of class |
A plot with the number of persons at risk at each specific age.
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.
lyl_range
for estimation of Life Years Lost for a range of different ages.
# 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")
# 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")
lyl_ci
estimates confidence intervals for Life Years Lost using non-parametric
bootstrap. The confidence level can be specified when summarizing the results with
the function summary.lyl_ci
.
lyl_ci(lyl_estimation, niter = 1000)
lyl_ci(lyl_estimation, niter = 1000)
lyl_estimation |
An object of class |
niter |
Number of iterations for the bootstrap (default is 1,000). |
A list with class "lyl_ci"
containing the following components:
LYL
: Data frame with one observation per age and at least 3 variables: age
; life_exp
which is the estimated remaining life expectancy at age age_specific
years
and before age tau
years; and one variable corresponding to the estimated Life Years Lost for each specific
cause of death. If only one cause of death is considered (no competing risks), this variable is Dead
and includes
the total overall Life Years Lost
LYL_ci
: Data frame with one observation per age-iteration and at least 4 variables: age
; iteration
, which
correspond to each specific iteration; life_exp
which is the estimated remaining life expectancy at age age_specific
years
and before age tau
years; and one variable corresponding to the estimated Life Years Lost for each specific
cause of death. If only one cause of death is considered (no competing risks), this variable is Dead
and includes
the total overall Life Years Lost
tau
: Maximum theoretical age
age_specific
: Specific age at which the Life Years Lost have been estimated
age_begin
: Specific starting age at which the Life Years Lost have been estimated
age_end
: Specific ending age at which the Life Years Lost have been estimated
death_labels
: Label(s) for death status
competing_risks
: Logical value (TRUE
= more than one cause of death (competing risks))
type
: Whether the estimation is at "age_specific"
or "age_range"
.
niter
: Number of iterations used to estimate the confidence intervals
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.
lyl
for estimation of Life Years Lost at one specific age.
lyl_range
for estimation of Life Years Lost for a range of different ages.
lyl_diff
to compare Life Years Lost for two populations.
summary.lyl_ci
to summarize objects obtained with function lyl_ci
.
plot.lyl_ci
to plot objects obtained with function lyl_ci
.
lyl_range
for estimation of Life Years Lost for a range of different ages.
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = death, age_specific = 45, tau = 95) # Calculate bootstrapped confidence interval (3 iterations to test; more are necessary) lyl_estimation_ci <- lyl_ci(lyl_estimation, niter = 3) summary(lyl_estimation_ci) plot(lyl_estimation_ci) # Estimate remaining life expectancy and Life Years # Lost after each age from 0 to 94 years and before age 95 years lyl_estimation2 <- lyl_range(data = simu_data, t = age_death, status = death, age_begin = 0, age_end = 94, tau = 95) # Calculate bootstrapped confidence interval (3 iterations to test; more are necessary) lyl_estimation_ci2 <- lyl_ci(lyl_estimation2, niter = 3) summary(lyl_estimation_ci2, weights = simu_data$age_disease) plot(lyl_estimation_ci2, weights = simu_data$age_disease)
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = death, age_specific = 45, tau = 95) # Calculate bootstrapped confidence interval (3 iterations to test; more are necessary) lyl_estimation_ci <- lyl_ci(lyl_estimation, niter = 3) summary(lyl_estimation_ci) plot(lyl_estimation_ci) # Estimate remaining life expectancy and Life Years # Lost after each age from 0 to 94 years and before age 95 years lyl_estimation2 <- lyl_range(data = simu_data, t = age_death, status = death, age_begin = 0, age_end = 94, tau = 95) # Calculate bootstrapped confidence interval (3 iterations to test; more are necessary) lyl_estimation_ci2 <- lyl_ci(lyl_estimation2, niter = 3) summary(lyl_estimation_ci2, weights = simu_data$age_disease) plot(lyl_estimation_ci2, weights = simu_data$age_disease)
lyl_compare_plot
creates a figure of Life Years Lost
at one specific age for two or more different populations.
lyl_compare_plot( x, color_alive = NA, colors = NA, nrow = NULL, ncol = NULL, dir = "h", reverse_legend = FALSE, labels = NA, ... )
lyl_compare_plot( x, color_alive = NA, colors = NA, nrow = NULL, ncol = NULL, dir = "h", reverse_legend = FALSE, labels = NA, ... )
x |
A list of objects of class |
color_alive |
Color to be used for the censoring category. Default is NA, and default color is "white". |
colors |
Vector with one color for each cause of death. Default is NA, and default colors are used. |
nrow |
Number of rows to be passed to |
ncol |
Number of columns to be passed to |
dir |
Direction to be passed to facet_wrap: either "h" for horizontal, the default, or "v", for vertical. |
reverse_legend |
Reverse the order of elements in the legend. Ddefault is FALSE, indicating that first is the censoring label and then all causes of death. |
labels |
Vector with labels for the two populations (default are "Population of
interest" for |
... |
Additional arguments affecting the plot produced. |
A plot with survival function and stacked cause-specific cumulative incidences for two populations side by side.
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.
lyl
for estimation of Life Years Lost at one specific age.
lyl_diff
to compare Life Years Lost for two populations.
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = cause_death, age_specific = 45, tau = 95) # Same estimate for those with a specific disease diseased <- simu_data[!is.na(simu_data$age_disease), ] lyl_estimation1 <- lyl(data = diseased, t0 = age_disease, t = age_death, status = cause_death, age_specific = 45, tau = 95) # Plot the data lyl_compare_plot(list(lyl_estimation1, lyl_estimation)) lyl_compare_plot(list(lyl_estimation1, lyl_estimation), labels = c("Population with a disease", "General population")) # The plot can be modified with a usual ggplot2 format lyl_compare_plot(list(lyl_estimation1, lyl_estimation)) + ggplot2::xlab("Age [in years]") + ggplot2::ggtitle("Differences in Life Years Lost at age 45 years")
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = cause_death, age_specific = 45, tau = 95) # Same estimate for those with a specific disease diseased <- simu_data[!is.na(simu_data$age_disease), ] lyl_estimation1 <- lyl(data = diseased, t0 = age_disease, t = age_death, status = cause_death, age_specific = 45, tau = 95) # Plot the data lyl_compare_plot(list(lyl_estimation1, lyl_estimation)) lyl_compare_plot(list(lyl_estimation1, lyl_estimation), labels = c("Population with a disease", "General population")) # The plot can be modified with a usual ggplot2 format lyl_compare_plot(list(lyl_estimation1, lyl_estimation)) + ggplot2::xlab("Age [in years]") + ggplot2::ggtitle("Differences in Life Years Lost at age 45 years")
lyl_diff
summarizes differences in estimated Life Years Lost
in two different populations: lyl_estimation
compared to lyl_estimation0
.
lyl_diff( lyl_population1, lyl_population0, decimals = 2, level = 0.95, weights = NA )
lyl_diff( lyl_population1, lyl_population0, decimals = 2, level = 0.95, weights = NA )
lyl_population1 |
Population of interest: An object of class |
lyl_population0 |
Reference population: An object of class |
decimals |
Number of decimals to be reported (default is 2). |
level |
Confidence level if |
weights |
Vector with age distribution of disease/condition onset to be used when Life Years Lost are estimated
over a range of ages (with |
A table with the summary of the differences between two populations.
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.
lyl
for estimation of Life Years Lost at one specific age.
lyl_range
for estimation of Life Years Lost for a range of different ages.
# 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; more are necessary) 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; more are necessary) lyl_estimation3_ci <- lyl_ci(lyl_estimation3, niter = 3) lyl_diff(lyl_estimation3_ci, lyl_estimation2, weights = diseased$age_disease)
# 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; more are necessary) 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; more are necessary) lyl_estimation3_ci <- lyl_ci(lyl_estimation3, niter = 3) lyl_diff(lyl_estimation3_ci, lyl_estimation2, weights = diseased$age_disease)
lyl_diff
summarizes differences in estimated Life Years Lost
in two different populations: lyl_estimation1
compared to a life table provided in data_ref
.
lyl_diff_ref( lyl_population1, data_ref, age, surv, rates, decimals = 2, level = 0.95, weights = NA, lyl_population0 )
lyl_diff_ref( lyl_population1, data_ref, age, surv, rates, decimals = 2, level = 0.95, weights = NA, lyl_population0 )
lyl_population1 |
Population of interest: An object of class |
data_ref |
A dataframe, where each raw represents an age, for the population of reference The dataframe will contain information on age-specific mortality rates or survivial probability (if both parameters are provided, rates will be used). |
age |
Variable in |
surv |
Variable in |
rates |
Variable in |
decimals |
Number of decimals to be reported (default is 2). |
level |
Confidence level if |
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_population0 |
Parameter automatically created. |
A table with the summary of the differences between two populations.
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.
lyl
for estimation of Life Years Lost at one specific age.
lyl_range
for estimation of Life Years Lost for a range of different ages.
# Load simulated data as example data(simu_data) data(pop_ref) # Estimate remaining life expectancy and Life Years # Lost due to specific causes of death after age 45 # years and before age 95 years for those with a disease diseased <- simu_data[!is.na(simu_data$age_disease), ] lyl_estimation1 <- lyl(data = diseased, t0 = age_disease, t = age_death, status = cause_death, age_specific = 45, tau = 95) lyl_diff_ref(lyl_estimation1, pop_ref, age = age, surv = survival) lyl_diff_ref(lyl_estimation1, pop_ref, age = age, rates = mortality_rates) # Calculate bootstrapped confidence interval (3 iterations to test; more are necessary) lyl_estimation1_ci <- lyl_ci(lyl_estimation1, niter = 3) lyl_diff_ref(lyl_estimation1_ci, pop_ref, age = age, surv = survival) # 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 = diseased, t0 = age_disease, t = age_death, status = cause_death, age_begin = 0, age_end = 94, tau = 95) lyl_diff_ref(lyl_estimation2, pop_ref, age = age, surv = survival) lyl_diff_ref(lyl_estimation2, pop_ref, age = age, surv = survival, weights = diseased$age_disease)
# Load simulated data as example data(simu_data) data(pop_ref) # Estimate remaining life expectancy and Life Years # Lost due to specific causes of death after age 45 # years and before age 95 years for those with a disease diseased <- simu_data[!is.na(simu_data$age_disease), ] lyl_estimation1 <- lyl(data = diseased, t0 = age_disease, t = age_death, status = cause_death, age_specific = 45, tau = 95) lyl_diff_ref(lyl_estimation1, pop_ref, age = age, surv = survival) lyl_diff_ref(lyl_estimation1, pop_ref, age = age, rates = mortality_rates) # Calculate bootstrapped confidence interval (3 iterations to test; more are necessary) lyl_estimation1_ci <- lyl_ci(lyl_estimation1, niter = 3) lyl_diff_ref(lyl_estimation1_ci, pop_ref, age = age, surv = survival) # 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 = diseased, t0 = age_disease, t = age_death, status = cause_death, age_begin = 0, age_end = 94, tau = 95) lyl_diff_ref(lyl_estimation2, pop_ref, age = age, surv = survival) lyl_diff_ref(lyl_estimation2, pop_ref, age = age, surv = survival, weights = diseased$age_disease)
lyl
estimates remaining life expectancy and Life Years Lost for a given population
after a range of specific ages (age_begin
to age_end
) and restrictied to
a maximum theoretical age .
lyl_range( data, t0 = NULL, t, status, age_begin, age_end, censoring_label = "Alive", death_labels = "Dead", tau = 100 )
lyl_range( data, t0 = NULL, t, status, age_begin, age_end, censoring_label = "Alive", death_labels = "Dead", tau = 100 )
data |
A dataframe, where each raw represents a person. The dataframe will
have a time-to-event format with at least two variables: age at end of follow-up ( |
t0 |
Age at start of the follow-up time. Default is |
t |
Age at the end of the follow-up time (death or censoring). |
status |
Status indicator, normally 0=alive, 1=dead. Other choices are
TRUE/FALSE (TRUE = death) or 1/2 (2=death). For multiple causes of death (competing risks
analysis), the status variable will be a factor, whose first level is treated as censoring; or
a numeric variable, whose lowest level is treated as censoring. In the latter case,
the label for censoring is |
age_begin |
Specific starting age at which the Life Years Lost have to be estimated. |
age_end |
Specific ending age at which the Life Years Lost have to be estimated. |
censoring_label |
Label for censoring status. If |
death_labels |
Label for event status. For only one cause of death, |
tau |
Remaining life expectancy and Life Years Lost are estimated restrictied to a maximum
theoretical age |
A list with class "lyl_range"
containing the following components:
data
: Data frame with 3 variables and as many observations as the original
data provided to estimate Life Years Lost: t0
, t
, and status
LYL
: Data frame with (age_end - age_begin + 1)
observations and at least 3 variables: age
which corresponds
to each specific age from age_begin
to age_end
; life_exp
which is the estimated remaining life expectancy at age specific age
and before age tau
years; and one variable corresponding to the estimated Life Years Lost for each specific
cause of death. If only one cause of death is considered (no competing risks), this variable is Dead
and includes
the total overall Life Years Lost
tau
: Maximum theoretical age
age_begin
: Specific starting age at which the Life Years Lost have been estimated
age_end
: Specific ending age at which the Life Years Lost have been estimated
censoring_label
: Label for censoring status
death_labels
: Label(s) for death status
competing_risks
: Logical value (TRUE
= more than one cause of death (competing risks))
numbers_at_risk
: Data frame with (tau - age_begin + 1)
observations and 2 variables: age
which corresponds
to each specific age from age_begin
to tau
; and number
which is the number of persons at risk of dying at each
specific age
type
: Whether the estimation is at "age_specific"
or "age_range"
.
Andersen PK. Life years lost among patients with a given disease. Statistics in Medicine. 2017;36(22):3573- 3582.
Andersen PK. Decomposition of number of life years lost according to causes of death. Statistics in Medicine. 2013;32(30):5278-5285.
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.
lyl
for estimation of Life Years Lost at one specific age.
lyl_diff
to compare average Life Years Lost for two populations.
lyl_checkplot
to check whether small numbers could compromise the estimation.
lyl_ci
to estimate bootstrapped confidence intervals.
summary.lyl_range
to summarize objects obtained with function lyl_range
.
plot.lyl_range
to plot objects obtained with function lyl_range
.
# 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 = 0, age_end = 94, tau = 95) # Visualize data at each different specific age summary(lyl_estimation) plot(lyl_estimation) # Summarize data over an age distribution summary(lyl_estimation, weights = simu_data$age_disease) # 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) # Visualize data at each different specific age summary(lyl_estimation2) plot(lyl_estimation2) # Summarize data over an age distribution summary(lyl_estimation2, weights = simu_data$age_disease)
# 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 = 0, age_end = 94, tau = 95) # Visualize data at each different specific age summary(lyl_estimation) plot(lyl_estimation) # Summarize data over an age distribution summary(lyl_estimation, weights = simu_data$age_disease) # 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) # Visualize data at each different specific age summary(lyl_estimation2) plot(lyl_estimation2) # Summarize data over an age distribution summary(lyl_estimation2, weights = simu_data$age_disease)
plot
for objects of class lyl
creates a figure of Life Years Lost
at one specific age.
## S3 method for class 'lyl' plot(x, color_alive = NA, colors = NA, reverse_legend = FALSE, ...)
## S3 method for class 'lyl' plot(x, color_alive = NA, colors = NA, reverse_legend = FALSE, ...)
x |
An object of class |
color_alive |
Color to be used for the censoring category. Default is NA, and default color is "white". |
colors |
Vector with one color for each cause of death. Default is NA, and default colors are used. |
reverse_legend |
Reverse the order of elements in the legend. Ddefault is FALSE, indicating that first is the censoring label and then all causes of death. |
... |
Additional arguments affecting the plot produced. |
A plot with survival function and stacked cause-specific cumulative incidences.
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.
lyl
for estimation of Life Years Lost at one specific age.
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = cause_death, age_specific = 45, tau = 95) # Summarize and plot the data plot(lyl_estimation) plot(lyl_estimation, colors = c("chocolate", "cornflowerblue")) # The plot can be modified with a usual ggplot2 format plot(lyl_estimation) + ggplot2::xlab("Age [in years]") + ggplot2::ggtitle("Life Years Lost at age 45 years")
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = cause_death, age_specific = 45, tau = 95) # Summarize and plot the data plot(lyl_estimation) plot(lyl_estimation, colors = c("chocolate", "cornflowerblue")) # The plot can be modified with a usual ggplot2 format plot(lyl_estimation) + ggplot2::xlab("Age [in years]") + ggplot2::ggtitle("Life Years Lost at age 45 years")
plot
for objects of class lyl_aggregated
creates a figure of Life Years Lost
at one specific age for two different populations.
## S3 method for class 'lyl_aggregated' plot( x, color_alive = NA, colors = NA, labels = c("Population of interest", "Reference population"), ... )
## S3 method for class 'lyl_aggregated' plot( x, color_alive = NA, colors = NA, labels = c("Population of interest", "Reference population"), ... )
x |
An object of class |
color_alive |
Color to be used for the censoring category. Default is NA, and default color is "white". |
colors |
Vector with one color for each cause of death. Default is NA, and default colors are used. |
labels |
Vector with labels for the two populations (default are "Population of
interest" for |
... |
Additional arguments affecting the plot produced. |
A plot with survival function and stacked cause-specific cumulative incidences for two populations side by side.
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.
lyl_aggregated
for estimation of Life Years Lost at one specific age.
# Load simulated data as example data(aggreg_data) data(pop_ref) # Estimate remaining life expectancy and Life Years # Lost after age 70 years and before age 90 years lyl_summary_data70 <- lyl_aggregated(data = aggreg_data, age = age, rates = rate, data0 = pop_ref, age0 = age, surv0 = survival, age_specific = 70, tau = 90) # Plot the data plot(lyl_summary_data70)
# Load simulated data as example data(aggreg_data) data(pop_ref) # Estimate remaining life expectancy and Life Years # Lost after age 70 years and before age 90 years lyl_summary_data70 <- lyl_aggregated(data = aggreg_data, age = age, rates = rate, data0 = pop_ref, age0 = age, surv0 = survival, age_specific = 70, tau = 90) # Plot the data plot(lyl_summary_data70)
plot
for objects of class lyl_ci
creates a figure of the bootstrapped Life Years Lost
to examine if the number of iterations is enough.
## S3 method for class 'lyl_ci' plot(x, level = 0.95, weights, ...)
## S3 method for class 'lyl_ci' plot(x, level = 0.95, weights, ...)
x |
An object of class |
level |
Confidence level (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 |
... |
Additional arguments affecting the plot produced. |
A plot with the evolution of bootstrapped parameters.
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.
lyl_range
for estimation of Life Years Lost for a range of different ages.
lyl
for estimation of Life Years Lost at one specific age.
lyl_ci
to estimate bootstrapped confidence intervals.
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = death, age_specific = 45, tau = 95) # Calculate bootstrapped confidence interval (10 iterations to test) lyl_estimation_ci <- lyl_ci(lyl_estimation, niter = 10) plot(lyl_estimation_ci) # Estimate remaining life expectancy and Life Years # Lost after each age from 0 to 94 years and before age 95 years lyl_estimation2 <- lyl_range(data = simu_data, t = age_death, status = death, age_begin = 0, age_end = 94, tau = 95) # Calculate bootstrapped confidence interval lyl_estimation_ci2 <- lyl_ci(lyl_estimation2) plot(lyl_estimation_ci2, weights = simu_data$age_disease)
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = death, age_specific = 45, tau = 95) # Calculate bootstrapped confidence interval (10 iterations to test) lyl_estimation_ci <- lyl_ci(lyl_estimation, niter = 10) plot(lyl_estimation_ci) # Estimate remaining life expectancy and Life Years # Lost after each age from 0 to 94 years and before age 95 years lyl_estimation2 <- lyl_range(data = simu_data, t = age_death, status = death, age_begin = 0, age_end = 94, tau = 95) # Calculate bootstrapped confidence interval lyl_estimation_ci2 <- lyl_ci(lyl_estimation2) plot(lyl_estimation_ci2, weights = simu_data$age_disease)
plot
for objects of class lyl_range
creates a figure of Life Years Lost
at a range of different ages.
## S3 method for class 'lyl_range' plot(x, colors = NA, ...)
## S3 method for class 'lyl_range' plot(x, colors = NA, ...)
x |
An object of class |
colors |
Vector with one color for each cause of death. Default is NA, and default colors are used. |
... |
Additional arguments affecting the plot produced. |
A plot with age-specific life expectancy and life years lost.
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.
lyl_range
for estimation of Life Years Lost for a range of different ages.
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost due to specific causes of death after each age # from 30 to 40 years and before age 95 years lyl_estimation <- lyl_range(data = simu_data, t = age_death, status = cause_death, age_begin = 30, age_end = 40, tau = 95) # Summarize and plot the data plot(lyl_estimation) plot(lyl_estimation, colors = c("chocolate", "cornflowerblue")) # The plot can be modified with a usual ggplot2 format plot(lyl_estimation) + ggplot2::xlab("Age [in years]") + ggplot2::ggtitle("Life Years Lost at ages 30-40 years")
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost due to specific causes of death after each age # from 30 to 40 years and before age 95 years lyl_estimation <- lyl_range(data = simu_data, t = age_death, status = cause_death, age_begin = 30, age_end = 40, tau = 95) # Summarize and plot the data plot(lyl_estimation) plot(lyl_estimation, colors = c("chocolate", "cornflowerblue")) # The plot can be modified with a usual ggplot2 format plot(lyl_estimation) + ggplot2::xlab("Age [in years]") + ggplot2::ggtitle("Life Years Lost at ages 30-40 years")
A dataset containing age-specific survival probability and mortality rates for Danish women in years 2017-2018.
pop_ref
pop_ref
A data frame with 100 rows and 3 variables:
age
survival probability at that specific age
age-specific mortality rates
Statistics Danmark (https://www.dst.dk/en/Statistik/emner/befolkning-og-valg/)
A dataset containing age and cause of death, as well as age at disease diagnosis (or start of a condition) for 100,000 simulated persons.
simu_data
simu_data
A data frame with 100000 rows and 6 variables:
unique identifier of each person
age at start of follow-up (0 for all individuals)
age at end of follow-up (death or censoring)
logical variable (TRUE
= death / FALSE
= censoring)
factor variable with 3 levels: "Alive"
(for those
censored) and "Natural"
and "Unnatural"
(for those dying of natural
and unnatural causes of death, respectively)
age at developing a specific disease or condition for those 32,391 individuals that develop the disease (missing for the remaining 67,609)
Simulated data
summary
for objects of class lyl
summarizes Life Years Lost
at one specific age.
## S3 method for class 'lyl' summary(object, decimals = 2, difference = FALSE, ...)
## S3 method for class 'lyl' summary(object, decimals = 2, difference = FALSE, ...)
object |
An object of class |
decimals |
Number of decimals to be reported (default is 2). |
difference |
Parameter automatically created by the package. |
... |
Additional arguments affecting the summary produced. |
A table with the summary of the results.
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.
lyl
for estimation of Life Years Lost at one specific age.
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = death, age_specific = 45, tau = 95) # Summarize and plot the data summary(lyl_estimation)
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = death, age_specific = 45, tau = 95) # Summarize and plot the data summary(lyl_estimation)
summary
for objects of class lyl_aggregated
summarizes Life Years Lost.
## S3 method for class 'lyl_aggregated' summary(object, decimals = 2, ...)
## S3 method for class 'lyl_aggregated' summary(object, decimals = 2, ...)
object |
An object of class |
decimals |
Number of decimals to be reported (default is 2). |
... |
Additional arguments affecting the summary produced. |
A table with the summary of the results.
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.
lyl_aggregated
for estimation of Life Years Lost at one specific age.
lyl_aggregated_range
for estimation of Life Years Lost for a range of different ages.
# Load simulated data as example data(aggreg_data) data(pop_ref) # Estimate remaining life expectancy and Life Years # Lost after age 70 years and before age 90 years lyl_summary_data70 <- lyl_aggregated(data = aggreg_data, age = age, rates = rate, data0 = pop_ref, age0 = age, surv0 = survival, age_specific = 70, tau = 90) # Summarize and plot the data summary(lyl_summary_data70)
# Load simulated data as example data(aggreg_data) data(pop_ref) # Estimate remaining life expectancy and Life Years # Lost after age 70 years and before age 90 years lyl_summary_data70 <- lyl_aggregated(data = aggreg_data, age = age, rates = rate, data0 = pop_ref, age0 = age, surv0 = survival, age_specific = 70, tau = 90) # Summarize and plot the data summary(lyl_summary_data70)
summary
for objects of class lyl_ci
summarizes Life Years Lost
at one specific age or over a range of different ages, including bootstrapped
confidence intervals
## S3 method for class 'lyl_ci' summary( object, decimals = 2, level = 0.95, weights = NA, difference = FALSE, ... )
## S3 method for class 'lyl_ci' summary( object, decimals = 2, level = 0.95, weights = NA, difference = FALSE, ... )
object |
An object of class |
decimals |
Number of decimals to be reported (default is 2). |
level |
Confidence level (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 |
difference |
Parameter automatically created by the package. |
... |
Additional arguments affecting the summary produced. |
A table with the summary of the results.
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.
lyl
for estimation of Life Years Lost at one specific age.
lyl_range
for estimation of Life Years Lost for a range of different ages.
lyl_ci
to estimate bootstrapped confidence intervals.
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = death, age_specific = 45, tau = 95) # Calculate bootstrapped confidence interval (3 iterations to test; more are necessary) lyl_estimation_ci <- lyl_ci(lyl_estimation, niter = 3) summary(lyl_estimation_ci) # Estimate remaining life expectancy and Life Years # Lost after each age from 0 to 94 years and before age 95 years lyl_estimation2 <- lyl_range(data = simu_data, t = age_death, status = death, age_begin = 0, age_end = 94, tau = 95) # Calculate bootstrapped confidence interval (3 iterations to test; more are necessary) lyl_estimation_ci2 <- lyl_ci(lyl_estimation2, niter = 3) summary(lyl_estimation_ci2, weights = simu_data$age_disease)
# Load simulated data as example data(simu_data) # Estimate remaining life expectancy and Life Years # Lost after age 45 years and before age 95 years lyl_estimation <- lyl(data = simu_data, t = age_death, status = death, age_specific = 45, tau = 95) # Calculate bootstrapped confidence interval (3 iterations to test; more are necessary) lyl_estimation_ci <- lyl_ci(lyl_estimation, niter = 3) summary(lyl_estimation_ci) # Estimate remaining life expectancy and Life Years # Lost after each age from 0 to 94 years and before age 95 years lyl_estimation2 <- lyl_range(data = simu_data, t = age_death, status = death, age_begin = 0, age_end = 94, tau = 95) # Calculate bootstrapped confidence interval (3 iterations to test; more are necessary) lyl_estimation_ci2 <- lyl_ci(lyl_estimation2, niter = 3) summary(lyl_estimation_ci2, weights = simu_data$age_disease)
summary
for objects of class lyl_range
summarizes Life Years Lost
over a range of different ages.
## S3 method for class 'lyl_range' summary(object, decimals = 2, weights = NA, difference = FALSE, ...)
## S3 method for class 'lyl_range' summary(object, decimals = 2, weights = NA, difference = FALSE, ...)
object |
An object of class |
decimals |
Number of decimals to be reported (default is 2). |
weights |
Vector with age distribution of disease/condition onset. If weights are not provided (dafault is |
difference |
Parameter automatically created by the package. |
... |
Additional arguments affecting the summary produced. |
A table with the summary of the results.
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.
lyl_range
for estimation of Life Years Lost for a range of different ages.
# 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 = 0, age_end = 94, tau = 95) # Visualize data at each different specific age summary(lyl_estimation) # Summarize data over an age distribution summary(lyl_estimation, weights = simu_data$age_disease)
# 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 = 0, age_end = 94, tau = 95) # Visualize data at each different specific age summary(lyl_estimation) # Summarize data over an age distribution summary(lyl_estimation, weights = simu_data$age_disease)