Incremental and cumulative triangles
to_incremental.Rdto_incremental() subtracts from each observed value the previous
observed value of its row, so the increment after a hole covers the
whole gap; to_cumulative() takes running sums of the observed
increments. Each returns x unchanged if it is already in that form.
Arguments
- x
A triangle.
Value
A triangle.
Examples
long <- data.frame(year = c(2020, 2020, 2021), age = c(12, 24, 12), paid = c(100, 150, 110))
tri <- triangle(long, "year", "age", "paid")
to_incremental(tri)@values[1, 1, , ]
#> development
#> origin 12 24
#> 2020 100 50
#> 2021 110 NA
to_cumulative(to_incremental(tri))@values[1, 1, , ]
#> development
#> origin 12 24
#> 2020 100 150
#> 2021 110 NA