| plotMortalityTrend {MortalityTables} | R Documentation |
Plot the trends of multiple mortality tables (life tables) in one chart
Description
plotMortalityTrend prints the trends of multiple life tables (objects
of child classes of mortalityTable) in one plot, with a legend showing
the names of the tables.
Usage
plotMortalityTrend(
data,
...,
aes = NULL,
ages = NULL,
xlim = NULL,
ylim = NULL,
xlab = NULL,
ylab = NULL,
title = "",
legend.position = c(0.9, 0.9),
legend.justification = c(1, 1),
legend.title = "Sterbetafel",
legend.key.width = unit(25, "mm")
)
Arguments
data |
First life table to be plotted. Either a |
... |
Additional life tables to be plotted (if |
aes |
Optional aesthetics to append or override the default. The default aesthetics will always be applied first and provide defaults for x, y and color. This argument can be used to override the defaults or append other aesthetics. |
ages |
Plot only the given ages |
xlim |
X-axis limitatation (as a two-element vector) |
ylim |
Y-axis limitatation (as a two-element vector) |
xlab |
X-axis label (default: "Alter") |
ylab |
Y-axis label (default: "Sterbewahrscheinlichkeit q_x relativ zu ....") |
title |
The plot title |
legend.position |
The position of the legend (default is |
legend.justification |
The justification of the legend (default is |
legend.title |
Title of the legend ( |
legend.key.width |
The keywith of the lines in the legend (default is |
Examples
# Load the Austrian aunnity data
mortalityTables.load("Austria_Annuities")
# Compare the trends of these tables
plotMortalityTrend(AVOe2005R.male, AVOe2005R.female, AVOe1996R.male, AVOe1996R.female,
Period = 2002, title = "Trends of Austrian Annuity Tables")
# For tables with a non-constant trend, the Period and YOB can be used to compare
# the age-specific trends that apply to the death probabilities during a given
# period or for a given birth year
plotMortalityTrend(AVOe2005R.male, AVOe2005R.female, AVOe1996R.male, AVOe1996R.female,
YOB = 1950, title = "Trends of Austrian Annuity Tables for cohort YOB=1950")
plotMortalityTrend(AVOe2005R.male, AVOe2005R.female, AVOe1996R.male, AVOe1996R.female,
YOB = 2000, title = "Trends of Austrian Annuity Tables for cohort YOB=2000")
plotMortalityTrend(AVOe2005R.male, AVOe2005R.female, AVOe1996R.male, AVOe1996R.female,
Period = 1999, title = "Trends of Austrian Annuity Tables for Period 2002")
plotMortalityTrend(AVOe2005R.male, AVOe2005R.female, AVOe1996R.male, AVOe1996R.female,
Period = 2030, title = "Trends of Austrian Annuity Tables for Period 2030")
#' @import scales