Learn R Programming

ChainLadder (version 0.1.1-5)

plot.MackChainLadder: ~~function to do ... ~~

Description

~~ A concise (1-5 lines) description of what the function does. ~~

Usage

plot.MackChainLadder(x, myUnit = 1000, Currency = "�", mfrow = c(3, 2), title = NULL, ...)

Arguments

x
~~Describe x here~~
myUnit
~~Describe myUnit here~~
Currency
~~Describe Currency here~~
mfrow
~~Describe mfrow here~~
title
~~Describe title here~~
...
~~Describe ... here~~

Value

  • ~Describe the value returned If it is a LIST, use
  • comp1Description of 'comp1'
  • comp2Description of 'comp2'
  • ...

Details

~~ If necessary, more details than the description above ~~

References

~put references to the literature/web site here ~

See Also

~~objects to See Also as help, ~~~

Examples

Run this code
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (x, myUnit = 1000, Currency = "�", mfrow = c(3, 2), 
    title = NULL, ...) 
{
    if (is.null(title)) 
        myoma <- c(0, 0, 0, 0)
    else myoma <- c(0, 0, 2, 0)
    op = par(mfrow = mfrow, oma = myoma)
    .myResult <- summary(x)
    .FullTriangle <- x[["FullTriangle"]]
    .Triangle <- x[["Triangle"]]
    n <- nrow(.Triangle)
    bp <- barplot(t(as.matrix(.myResult[, c("Latest", "Reserve")]/myUnit)), 
        legend.text = c("Latest", "Reserve"), names.arg = c(1:n), 
        main = "Mack Chain Ladder Results", xlab = "Origin year", 
        ylab = paste(Currency, myUnit), ylim = c(0, max(.myResult$Ultimate + 
            .myResult$Mack.S.E)/myUnit), ...)
    library(Hmisc)
    errbar(x = bp, y = .myResult$Ultimate/myUnit, yplus = (.myResult$Ultimate + 
        .myResult$Mack.S.E)/myUnit, yminus = (.myResult$Ultimate - 
        .myResult$Mack.S.E)/myUnit, cap = 0.05, add = TRUE)
    matplot(t(.FullTriangle)/myUnit, t = "l", main = "Chain ladder developments by origin year", 
        xlab = "Development year", ylab = paste(Currency, myUnit))
    matplot(t(.Triangle)/myUnit, add = TRUE)
    Residuals = residuals(x)
    attach(Residuals)
    plot(standard.residuals ~ fitted.value, ylab = "Standardised residuals", 
        xlab = "Fitted")
    lines(lowess(fitted.value, standard.residuals), col = "red")
    abline(h = 0, col = "grey")
    plot(standard.residuals ~ origin.year, ylab = "Standardised residuals", 
        xlab = "Origin year")
    lines(lowess(origin.year, standard.residuals), col = "red")
    abline(h = 0, col = "grey")
    plot(standard.residuals ~ cal.year, ylab = "Standardised residuals", 
        xlab = "Calendar year")
    lines(lowess(cal.year, standard.residuals), col = "red")
    abline(h = 0, col = "grey")
    plot(standard.residuals ~ dev.year, ylab = "Standardised residuals", 
        xlab = "Development year")
    lines(lowess(dev.year, standard.residuals), col = "red")
    abline(h = 0, col = "grey")
    detach(Residuals)
    title(title, outer = TRUE)
    par(op)
  }

Run the code above in your browser using DataLab