demography (version 1.22)

mean.demogdata: Mean and median functions for data of class demogdata

Description

Computes mean or median of demographic rates for each age level.

Usage

# S3 method for demogdata
mean(x, series = names(x$rate)[1],
  transform = TRUE, na.rm = TRUE, ...)

# S3 method for demogdata median(x, na.rm = FALSE, series = names(x$rate)[1], transform = TRUE, method = c("hossjercroux", "coordinate"), ...)

Value

A list containing x=ages and y=mean or median rates.

Arguments

x

Demogdata object such as created using read.demogdata or smooth.demogdata.

series

Name of demogdata series to plot..

transform

Should transform of data be taken first?

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

...

Other arguments.

method

Method for computing the median. Either "coordinate" for a coordinate-wise median, or "hossjercroux" for the L1-median using the Hossjer-Croux algorithm.

Author

Rob J Hyndman

References

Hossjer, O., and Croux, C. (1995) Generalized univariate signed rank statistics for testing and estimating a multivariate location parameter. Nonparametric Statistics, 4, 293-308.

Examples

Run this code
plot(fr.mort)
lines(mean(fr.mort),lwd=2)
lines(median(fr.mort),lwd=2,col=2)

Run the code above in your browser using DataCamp Workspace