Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot_dd

Miscellaneous plotting functions for demogdata type mortality data. Versatile plotting tool with an optional legend.


Description

Plot an object of class demogdata

Usage

plot_dd(dd.obj, year = dd.obj$year, col = rainbow(length(year), start = 0.1), 
		lpos = "UL", lpar = list(), ppar = T, ...)

Arguments

dd.obj

a mortality type data object of class demogdata (or number of deaths type data object returned by extract.deaths)

year

vector of years to be included in the plotting (all available years by default)

col

color palette to be used in the plot (by default, it uses a sequence of rainbow colors)

lpos

a text identifier (one of "UR", "LR", "UL", "LL", "UC", "LC", "CL", "CR"; whereas the abbreviation is made up by U/L/C=Upper/Lower/Center, L/R/C=Left/Right/Center) or a list containing the coordinates (e.g. x and y) of the upper left corner of the legend/object.

lpar

list of additional arguments to be passed on to legend (other than legend, title, col or text.col)

ppar

logical, if FALSE, ignores in the legend the plotting arguments lty, lwd and pch (i.e. in case they are given in ...) and hence it creates a legend containing only text

...

additional plotting arguments that are passed on to both plot and legend functions (see par)

Value

Plot of mortality rates or number of deaths.

Author(s)

Zoltan Butt, Steven Haberman and Han Lin Shang

See Also

Examples

# plot log mortality rates with repositioned legend 
plot_dd(dd.cmi.pens, xlim=c(40, 110), lpar=list(x.intersp=-0.2, y.intersp=0.9, cex=0.85))
# plot (untransformed) mortality rates with repositioned legend
plot_dd(dd.cmi.pens, age=60:95, lpar=list(x.intersp=-0.2, y.intersp=0.9, cex=0.85), transf=FALSE)
# plot a small subset of log mortality rates (calendar years: 1985 - 1995)
#      and add a line with the overall mean rates
plot_dd(dd.cmi.pens, lpos=list(x=0.85,y=0.55), year=1985:1995, 
		lpar=list(x.intersp=-0.1, y.intersp=0.95, cex=0.9))
lines(mean(dd.cmi.pens),lwd=2, lty=3, col='red')
# legend(coord('LC'), legend='mean rate', lwd=2, lty=3, col='red', text.col='red')
# plot number of (extracted) deaths:
tmp.d <- extract.deaths(dd.cmi.pens, ages=55:100, y=1995:2003)
plot_dd(tmp.d, transf=FALSE, lty=1:5, ylab='Number of Deaths', 
		main=paste(tmp.d$lab, ": male (1995-2003)", sep=''))

ilc

Lee-Carter Mortality Models using Iterative Fitting Algorithms

v1.0
GPL (>= 2)
Authors
Zoltan Butt, Steven Haberman and Han Lin Shang
Initial release
2014-11-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.