A layer scoped to some perils or classes
with_scope.RdThe layer covers only the losses whose label label takes one of
values: a windstorm treaty on a multi-peril event set is scoped to
with_scope(layer, "peril", "windstorm"). Its occurrence and annual
terms see only those losses, so another peril's events neither use its
annual limit nor count toward its deductible, and the losses it does not
cover pass to the next inuring stage whole. That differs from reading
one label's share of an unscoped layer, whose annual terms every peril
uses up. A tower with a scoped layer needs labelled events
(apply_tower() on an event_set, apply_tower_term(),
apply_tower_timeline()) and refuses the grids and annual losses.
filter_events() gives the losses such a layer sees.
Arguments
- layer
An xol_layer.
- label
A label dimension of the events.
- values
At least one value; at least one must occur.
Value
The xol_layer; its scope property is list(label, values),
NULL for every loss.
Examples
ev <- with_labels(events_from_years(list(c(20, 15))), list(peril = c("quake", "wind")))
xl <- xol_layer("10x5", 10, 5, aggregate_limit = 15)
key <- list("ceded", "10x5", "wind")
mean(marginal(apply_tower(reinsurance_tower(list(with_scope(xl, "peril", "wind"))), ev), key))
#> [1] 10
mean(marginal(apply_tower(reinsurance_tower(list(xl)), ev), key))
#> [1] 5