apc.polygon {apc}R Documentation

Add connected line and standard deviation polygons to a plot

Description

Draws a line for point forecasts and adds shaded region for forecast distribution around it. This is added to a plot in the same way as lines and polygon add lines and polygons to a plot.

Usage

apc.polygon(m.forecast,x.origin=1,
	plot.se=TRUE,plot.se.proc=FALSE,plot.se.est=FALSE,
	unit=1,
	col.line=1,lty.line=1,lwd.line=1,
	q.se=c(2,2,2),
	angle.se=c(45,45,45),
	border.se=c(NA,NA,NA),
	col.se=gray(c(0.50,0.80,0.90)),
	density.se=c(NULL,NULL,NULL),
	lty.se=c(1,1,1))

Arguments

m.forecast

Matrix. Up to 4 columns. Column 1: point forecasts. Column 2: forecast standard errors. Column 3: process standard errors. Column 4: estimation standard errors.

x.origin

Optional. Numerical. x-coordinate for last observation. The first point forecast is made at x.origin+unit, where unit (with default 1) is defined in apc.data.list. Default: 1.

plot.se

Optional. Logical. Should forecast standard errors be plotted? Default: TRUE.

plot.se.proc

Optional. Logical. Should process standard errors be plotted? Default: FALSE.

plot.se.est

Optional. Logical. Should estimation standard errors be plotted? Default: FALSE.

unit

Optional. Numerical. step length for point forecasts. Default=1.

col.line

Optional. Point forecasts: Colour of line. Same as col for lines. Default: 1.

lty.line

Optional. Point forecasts: Type of line. Same as lty for lines. Default: 1.

lwd.line

Optional. Point forecasts: Width of line. Same as lwd for lines. Default: 1.

q.se

Optional. Vector of length 3. Multiplication factors for standard errors. Default: c(2,2,2).

angle.se

Optional. Standard error polygon: 3-vector: Angle of shading. Same as angle for polygon. Default: =c(45,45,45).

border.se

Optional. Standard error polygon: 3-vector: Border of polygon. Same as border for polygon. Default: =c(NA,NA,NA).

col.se

Optional. Standard error polygon: 3-vector: Colour of polygon. Same as col for polygon. Default: gray(c(0.50,0.80,0.90)).

density.se

Optional. Standard error polygon: 3-vector: Density of shading. Same as density for polygon. Default: =c(NULL,NULL,NULL).

lty.se

Optional. Standard error polygon: 3-vector: Type of shading. Same as lty for polygon. Default: =c(1,1,1).

Details

The empirical example of Martinez Miranda, Nielsen and Nielsen (2015) uses the data data.asbestos. The results of that paper are reproduced in the vignette ReproducingMMNN2015.pdf, ReproducingMMNN2015.R on Vignettes. The function is used there.

Author(s)

Bent Nielsen <bent.nielsen@nuffield.ox.ac.uk> 6 Jan 2016

References

Martinez Miranda, M.D., Nielsen, B. and Nielsen, J.P. (2015) Inference and forecasting in the age-period-cohort model with unknown exposure with an application to mesothelioma mortality. Journal of the Royal Statistical Society A 178, 29-55. Download: Article, Nuffield DP.


[Package apc version 2.0.0 Index]