Change the grain of a triangle
grain.RdCoarsens the origin and development periods, as chainladder-python's
grain(). Both new grains must be multiples of the current ones, and
the development grain must divide the origin grain. Valuations are kept
every development period back from the triangle's valuation, so a
partial latest period keeps its exact latest diagonal.
Arguments
- x
A triangle.
- origin_grain
The new origin grain:
"M","Q","S"or"Y".- development_grain
The new development grain, by default the same as
origin_grain.
Value
A triangle.
Examples
long <- data.frame(
origin = as.Date(c("2020-01-01", "2020-01-01", "2020-04-01")),
age = c(3, 6, 3), paid = c(10, 20, 10)
)
q <- triangle(long, "origin", "age", "paid", origin_grain = "Q", development_grain = "Q")
grain(q, "Y", "Q")@values[1, 1, , ]
#> 3 6
#> 10 30
grain(q, "Y")@development
#> [1] 6