Description Usage Arguments Value Examples
View source: R/Payments2Triangle.R
Payments2Triangle
converts a list of cash flows to a triangle.
1 2 3 4 5 6 7 8 | Payments2Triangle(
accidentDate,
transactionDate,
cashFlows,
years = NA,
mode = "year",
evalDate = "01-01"
)
|
accidentDate |
Date vector. Reference date for the triangle: accident date or underwriting date depending on the reference |
transactionDate |
Date vector. Date of transaction. |
cashFlows |
Numeric vector. Cash flows corresponding to the reference date and made at transaction date. |
years |
Numeric vector. Years to include in the analysis. By default, all years are taken. |
mode |
string. The mode of aggregation for triangle. The different possible modes are:
|
evalDate |
String. Date of evaluation, with format "m-d" (ex: "12-23"). All data after this date for the maximal year will not be considered. |
Triangle as a matrix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library(lubridate)
library(data.table)
origin_claim <- as.Date("2010-01-03")
origin_transaction <- as.Date("2010-01-25")
dates_claim <- origin_claim %m+% months(0:59)
dates_transaction <- origin_transaction %m+% months(0:59)
d <- data.table(expand.grid(dates_claim, dates_transaction))
colnames(d) <- c("date_claim", "date_transaction")
d <- d[date_claim < date_transaction]
d$amount <- 1:1
Payments2Triangle(d$date_claim, d$date_transaction, d$amount, years = NA, mode = "yearRef", evalDate = "01-01")
Payments2Triangle(d$date_claim, d$date_transaction, d$amount, years = 2011:2014, mode = "yearRef", evalDate = "01-01")
Payments2Triangle(d$date_claim, d$date_transaction, d$amount, years = NA, mode = "yearRef", evalDate = "04-05")
Payments2Triangle(d$date_claim, d$date_transaction, d$amount, years = NA, mode = "year", evalDate = "01-01")
Payments2Triangle(d$date_claim, d$date_transaction, d$amount, years = NA, mode = "year", evalDate = "04-05")
Payments2Triangle(d$date_claim, d$date_transaction, d$amount, years = NA, mode = "semester", evalDate = "01-01")
Payments2Triangle(d$date_claim, d$date_transaction, d$amount, years = NA, mode = "quarter", evalDate = "01-01")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.