Scenarr

vecxt_re.Scenarr
See theScenarr companion object
case class Scenarr(iterations: Array[Int], days: Array[Int], amounts: Array[Double], ids: Array[Long], numberIterations: Int, threshold: Double = ..., day1: LocalDate = ..., name: String = ..., id: Long = ..., isSorted: Boolean = ...)

Columnar scenario: one entry per event across iterations, days, amounts and ids.

isSorted is a promise from the constructor's caller that the columns are ordered by (iteration, day), and that every iteration lies in 1..numberIterations. It is trusted, not verified: per-iteration statistics (freq, agg, oep) feed it into unchecked single-pass kernels (see groupSums.scala), and passing isSorted = true for unsorted data gives silently wrong results. If you're unsure, leave it false and call .sorted.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

inline def applyThreshold(newThresh: Double): Scenarr
Extension method from Scenarr
inline def iteration(num: Int): Scenarr
Extension method from Scenarr
inline def scaleAmntBy(scale: Double): Scenarr
Extension method from Scenarr
def show: String

A multi-line, terminal-friendly report with the first 10 events. See show(eventRows).

A multi-line, terminal-friendly report with the first 10 events. See show(eventRows).

Attributes

def show(eventRows: Int): String

A multi-line, terminal-friendly report: summary statistics, OEP / AEP at standard return periods (those the simulation can support), the largest events, and the first eventRows events in (iteration, day) order.

A multi-line, terminal-friendly report: summary statistics, OEP / AEP at standard return periods (those the simulation can support), the largest events, and the first eventRows events in (iteration, day) order.

Sorts a copy if this scenario isn't flagged sorted, so it costs O(n log n) on unsorted data. Meant for interrogating a scenario by eye, not for parsing.

Attributes

Extension method from Scenarr

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

inline def takeFirstNIterations(i: Int): Scenarr
Extension method from Scenarr
override def toString: String

One line, cheap: doesn't sort or compute any statistics. Use show for a report.

One line, cheap: doesn't sort or compute any statistics. Use show for a report.

Attributes

Definition Classes
Any
def withIdSource(source: Int): Scenarr
Extension method from Scenarr

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)

def |+|(s2: Scenarr): Scenarr
Extension method from Scenarr

Infix operator for combining scenarios

Infix operator for combining scenarios

Attributes

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product

Concrete fields

lazy val aep: ExceedanceCurve

Aggregate exceedance curve: the total of all events per iteration, ranked. Iterations with no events count as 0.

Aggregate exceedance curve: the total of all events per iteration, ranked. Iterations with no events count as 0.

Attributes

lazy val agg: Array[Double]
lazy val claimDates: Array[LocalDate]
lazy val clusterCoeff: Double

Interpretation:

Interpretation:

  • Excess variance over Poisson, scaled by m^2: Var(X) = E[X] for Poisson, so (v - m) is the extra variance; dividing by m^2 scales it.
  • Method-of-moments estimate of 1/k for Negative Binomial: Var(X) = μ + μ^2 / k ⇒ (Var(X) - μ) / μ^2 = 1 / k. Thus, clusterCoeff estimates 1 / k. Smaller k (larger clusterCoeff) ⇒ more clustering/overdispersion.
  • Relation to Index of Dispersion (VMR = v / m): clusterCoeff = (v - m) / m^2 = (VMR - 1) / m. It is a mean-scaled excess dispersion; under NB, it targets 1 / k.

Attributes

lazy val freq: Array[Int]
lazy val hasOccurence: Boolean
lazy val itrDayAmount: Array[(itr: Int, day: Int, amnt: Double, id: Long)]
lazy val meanFreq: Double
lazy val meanLoss: Double
lazy val monthYear: Array[(month: Month, year: Int)]
lazy val numSeasons: Int
lazy val oep: ExceedanceCurve

Occurrence exceedance curve: the largest single event per iteration, ranked. Iterations with no events count as a largest loss of 0.

Occurrence exceedance curve: the largest single event per iteration, ranked. Iterations with no events count as a largest loss of 0.

Only empty iterations (left at -Inf by groupMax) are replaced. A negative largest loss is kept as is, so don't simplify this to math.max(_, 0): negative losses may become meaningful depending on how inuring is treated.

Attributes

lazy val period: (firstLoss: LocalDate, lastLoss: LocalDate)
lazy val varianceMeanRatio: Double

Computes the variance-to-mean ratio (dispersion) based on the frequency data. This metric is calculated by dividing the variance by the mean, using values from freq.meanAndVariance.

Computes the variance-to-mean ratio (dispersion) based on the frequency data. This metric is calculated by dividing the variance by the mean, using values from freq.meanAndVariance.

1 = poisson distributed > 1 => overdispersed... but careful with sample size.

Attributes