Attributes
Members list
Type members
Classlikes
Collects events one at a time into primitive columns, then builds a Scenarr. Use it for streaming sources (CSV, parquet, a database cursor), where the number of events isn't known up front.
Collects events one at a time into primitive columns, then builds a Scenarr. Use it for streaming sources (CSV, parquet, a database cursor), where the number of events isn't known up front.
Each add checks the iteration lies in 1..numberIterations (the per-iteration kernels trust this without checking), that the day is at least 1, and that the amount is not NaN. result checks the sort order in one pass: events added in (iteration, day) order are used as they are, anything else is sorted. Either way the result has isSorted = true.
A builder can't be reused after result.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Inherited and Abstract types
The names of the product elements.
The names of the product elements.
Attributes
- Inherited from:
- Mirror
The name of the type.
The name of the type.
Attributes
- Inherited from:
- Mirror
Value members
Concrete methods
Combine two scenarios. Same as combineAll(Seq(s1, s2)), which documents the semantics.
Combine two scenarios. Same as combineAll(Seq(s1, s2)), which documents the semantics.
In particular: t1 + t2 threshold if the two share an event ID, max(t1, t2) otherwise.
Attributes
Combine scenarios from the same simulation into one.
Combine scenarios from the same simulation into one.
- Events with the same ID are one event, and their amounts are summed. An ID must sit at the same (iteration, day) wherever it appears.
'''Event IDs from more than one source.''' The same-ID-means-same-event rule is easy to trip over: vendor event IDs are usually only unique within one model or catalogue, so two perils' scenarios can share an ID by coincidence. Their losses are then summed into one event (inflating the OEP), the scenarios are joined into one threshold group, and if the two events sit on different days combineAll throws. Build IDs with Scenarr.eventKey (or remap with withIdSource) so that only a genuinely shared event shares an ID.
- Scenarios with no events don't constrain anything. All scenarios that have events must agree on
numberIterationsandday1; the result takes both from the first scenario with events, or from the first scenario if none has any. - Threshold: scenarios that share event IDs (directly, or through a chain of other scenarios) form a group whose threshold is the sum of its members' thresholds, because an event split across them can be missing a piece below each member's threshold. Groups don't interact, so the result's threshold is the largest group threshold. A scenario sharing no IDs, including one with no events, is a group of its own.
- Events at or below the result's threshold are dropped, once, after all amounts have been summed.
- The result is sorted by (iteration, day).
Combining with non-zero thresholds is not associative, because each binary combine filters. Combining a whole collection in one call applies the threshold once, so prefer this method over folding combine. With zero thresholds the result does not depend on grouping, and Scenarr.empty(n, day1) leaves any scenario unchanged.
Attributes
- Throws
-
IllegalArgumentException
if
scenariosis empty, if scenarios with events disagree onnumberIterationsorday1, or if an event ID appears at more than one (iteration, day)
A scenario with no events, belonging to a simulation of numberIterations iterations starting at day1.
A scenario with no events, belonging to a simulation of numberIterations iterations starting at day1.
With the default zero threshold it leaves any scenario unchanged under combine. A positive threshold states that nothing above it happened, and raises the threshold of anything it is combined with (see combineAll).
Attributes
A Scenarr event ID that is unique across sources: source in the high 32 bits, the source's own eventId in the low 32.
A Scenarr event ID that is unique across sources: source in the high 32 bits, the source's own eventId in the low 32.
Use it when scenarios come from more than one model or vendor whose event IDs may collide (see combineAll). A given (source, eventId) always maps to the same key, so the same event loaded from different loss tables (e.g. two programmes on one catalogue) still lines up and is summed.
Attributes
Generate a small random Scenarr for experimentation.
Generate a small random Scenarr for experimentation.
Value parameters
- numClaims
-
number of claim events to generate (default 15)
- seed
-
optional random seed for reproducibility
Attributes
- Returns
-
a small Scenarr with 10 iterations
Create a Scenarr with automatically generated random IDs for each event. Use this factory when you don't need to specify event IDs explicitly.
Create a Scenarr with automatically generated random IDs for each event. Use this factory when you don't need to specify event IDs explicitly.
Attributes
Extensions
Extensions
This scenario ordered by (iteration, day), with isSorted = true. Events on the same iteration and day keep their original relative order.
This scenario ordered by (iteration, day), with isSorted = true. Events on the same iteration and day keep their original relative order.
Returns scenario itself when it is already flagged sorted. When it is in order but not flagged, the result shares its arrays (no copy). Otherwise the columns are copied in sorted order.
Attributes
This scenario with every event ID replaced by eventKey(source, id), so its IDs can't collide with those of a scenario from another source under combineAll.
This scenario with every event ID replaced by eventKey(source, id), so its IDs can't collide with those of a scenario from another source under combineAll.
Attributes
- Throws
-
IllegalArgumentException
if an ID doesn't fit in 32 bits (it already carries a source, or isn't a vendor event ID)