Timeline of a term shared by its underwriting years
timeline.RdA timeline holds the events of a whole term of accident months once:
simulation j is one path, and each event's time, a fraction of the
term, puts it in accident month floor(time * months) (the last month
for time 1). timeline_from_years() stitches one event_set per
accident year, each with times within its year (from term_years() or
correlated_years(), say): year t's event at time tau is at
(t - 1 + tau) / T of the term.
Usage
timeline(events, months, aggregate_pattern = NULL, ptr = NULL)
timeline_from_years(years, aggregate_pattern = NULL)
timeline_years(timeline, basis, exposure, sources = FALSE)
uniform_exposure(n_years, policy_months)Arguments
- events
An event_set with times. An aggregate part is the whole term's.
- months
The number of accident months.
- aggregate_pattern
Twelve non-negative weights, one for each month of an accident year, that spread the aggregate part over the months (they need not add to 1);
NULLfor uniform.- ptr
Internal: the Rust timeline.
- years
A list of event_sets, one per accident year; each one's aggregate part stays its accident year's.
- timeline
A
timeline.- basis
"losses_occurring"or"risks_attaching".- exposure
A matrix of shares in
[0, 1], one row per underwriting year, one column per accident month, each column adding to at most 1.- sources
Also return each year's sources: for each of its losses, in order, its event's index among all the timeline's losses, from 1.
- n_years, policy_months
The number of underwriting years and each policy's months in force.
Value
timeline() and timeline_from_years() a timeline with
properties events (without the aggregate part), months, n_sims,
aggregate_pattern and has_aggregate_part; timeline_years() a list
of event_sets, one per contract year, or with sources a list of
years and sources; uniform_exposure() a matrix.
Details
timeline_years() splits it into contract years for
apply_tower_term(). Under "losses_occurring", contract year k takes
every event in accident months 12 (k - 1) + 1 to 12 k whole. Under
"risks_attaching", underwriting year u takes exposure[u, m] of each
event in month m, sums insured scaled alike, at its time over the
months the year has a share; the same event can fall to several years.
apply_tower_timeline() does both steps under a tower's basis.
An aggregate part of the events (with_aggregate_part()) has no time.
The timeline keeps it by accident period (each accident year of
timeline_from_years(), the whole term of timeline()) and spreads it
over the period's months by aggregate_pattern: a month's weight over
the period's weights. Each month's amount falls to the contract years
as an event in that month would, so a quota share or stop loss in each
year sees its part.
uniform_exposure() writes each of n_years underwriting years evenly
over its twelve months, each policy in force for policy_months from
the middle of its month: a year's share of a month is its policies' time
in force there over policy_months, so a month in mid-term has shares
adding to 1 and the exposure runs 12 * n_years + policy_months months.
Examples
ev <- events_from_years(list(100), times = list(13.5 / 24))
shares <- matrix(0, 2, 24)
shares[1, 14] <- 0.25
shares[2, 14] <- 0.75
rad <- timeline_years(timeline(ev, 24), "risks_attaching", shares)
c(mean(total(rad[[1]])), mean(total(rad[[2]])))
#> [1] 25 75
e <- uniform_exposure(2, 12)
dim(e)
#> [1] 2 36
colSums(e)[13]
#> [1] 1