##---- 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, mfrow = c(2, 2), Currency = "�")
{
op = par(mfrow = mfrow)
n <- ncol(x[["MCLPaid"]])
barplot(t(as.matrix(data.frame(Paid = x[["MCLPaid"]][, n]/myUnit,
Incurred = x[["MCLIncurred"]][, n]/myUnit))), beside = TRUE,
legend.text = c("MCL Paid", "MCL Incurred"), names.arg = c(1:n),
xlab = "origin year", ylab = paste(Currency, myUnit),
main = "Munich Chain Ladder Results")
barplot(t(as.matrix(data.frame(SCL.PI = 100 * x[["MackPaid"]]$FullTriangle[,
n]/x[["MackIncurred"]]$FullTriangle[, n], MCL.PI = 100 *
x[["MCLPaid"]][, n]/x[["MCLIncurred"]][, n]))), beside = TRUE,
legend.text = c("SCL P/I", "MCL P/I"), names.arg = c(1:n),
xlab = "origin year", ylab = "%", main = "Munich Chain Ladder Results")
plot(x[["PaidResiduals"]][left.tri(x[["PaidResiduals"]])] ~
x[["QinverseResiduals"]][left.tri(x[["QinverseResiduals"]])],
xlim = c(-2, 2), ylim = c(-2, 2), xlab = "Paid residuals",
ylab = "Incurred/Paid residuals", main = "Paid residual plot")
abline(v = 0)
abline(h = 0)
abline(a = 0, b = x[["lambdaP"]], col = "red")
plot(x[["IncurredResiduals"]][left.tri(x[["IncurredResiduals"]])] ~
x[["QResiduals"]][left.tri(x[["QResiduals"]])], xlim = c(-2,
2), ylim = c(-2, 2), xlab = "Incurred residuals", ylab = "Paid/Incurred residuals",
main = "Incurred residual plot")
abline(v = 0)
abline(h = 0)
abline(a = 0, b = x[["lambdaI"]], col = "red")
par(op)
}
Run the code above in your browser using DataLab