triangle S3 Methods {ChainLadder}R Documentation

Generic functions for triangles

Description

Functions to ease the work with triangle shaped matrix data. A 'triangle' is a matrix with some generic functions. Triangles are usually stored in a 'long' format in data bases. The function as.triangle can transform a data.frame into a triangle shape.

Usage

## S3 method for class 'matrix':
as.triangle(Triangle,origin="origin", dev="dev", value="value",...)
## S3 method for class 'data.frame':
as.triangle(Triangle, origin="origin", dev="dev", value="value",...)
## S3 method for class 'triangle':
as.data.frame(x, row.names=NULL, optional, lob=NULL, na.rm=FALSE, ...)
as.triangle(Triangle, origin="origin", dev="dev", value="value",...)
## S3 method for class 'triangle':
plot(x, t = "b", xlab = "dev. period", ylab = NULL, lattice=FALSE, ...)

Arguments

Triangle a triangle
origin name of the origin period, default is "origin".
dev name of the development period, default is "dev".
value name of the value, default is "value".
row.names default is set to NULL an will merge origin and dev. period to create row names.
lob default is NULL. The idea is to use lob (line of business) as an additional column to label a triangle in a long format, see the examples for more details.
optional not used
na.rm logical. Remove missing values?
x a matrix of class 'triangle'
xlab a label for the x axis, defaults to 'dev. period'
ylab a label for the y axis, defaults to NULL
lattice logical. If FALSE the function matplot is used to plot the developments of the triangle in one graph, otherwise the xyplot function of the lattice package is used, to plot developments of each origin period in a different panel.
t type, see plot.default
... arguments to be passed to other methods

Author(s)

Markus Gesmann

Examples

GenIns
plot(GenIns)
plot(GenIns, lattice=TRUE)

## Convert long format into triangle
## Triangles are usually stored as 'long' tables in data bases
head(GenInsLong)
as.triangle(GenInsLong, origin="accyear", dev="devyear", "incurred claims")

X <- as.data.frame(RAA)
head(X)

Y <- as.data.frame(RAA, lob="General Liability")
head(Y)


[Package ChainLadder version 0.1.2-13 Index]