Hours clause
hours_clause.RdEach year's losses grouped into occurrences: losses within window_hours
of the first loss of a window are one occurrence, whose loss is their sum
and whose time is the window's start; the next loss after the window opens
the next one. A year is 8,760 hours. Windows open at each first loss in
turn, not where they would recover most. Needs times; sums insured are not
carried.
Arguments
- x
An event_set with times.
- window_hours
Such as 72 for a windstorm, 168 for a flood.
- labels
What the occurrences carry of the losses' labels: none (
"drop"), their losses' labels, which must agree within an occurrence ("agree", an error otherwise), or the labels of the largest loss in the occurrence, the earliest of equal ones ("largest"). An aggregate part keeps its labels unless they are dropped.- by
NULL, or a label dimension,"peril"say: the clause applies within each of its values, so losses of two perils are never one occurrence, and the occurrences keep the labels (labelsthen decides the other dimensions,"drop"read as"agree"). Occurrences are listed by the time each window opens.
Value
An event_set of occurrences.
Examples
h <- 1 / 8760
ev <- events_from_years(list(c(10, 20, 5)), times = list(c(0.5, 0.5 + 30 * h, 0.5 + 40 * h)))
ev <- with_labels(ev, list(peril = c("wind", "flood", "wind")))
g <- hours_clause(ev, 72, by = "peril")
events(g, 1)
#> [1] 15 20
event_labels(g, 1)
#> peril
#> 1 wind
#> 2 flood