Plots
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Plots.type
Members list
Type members
Types
A modification applied to a plot's JSON spec, after the plot's own modifications (data, title, ...) have been applied. Every plot in this object accepts a mods argument of these.
A modification applied to a plot's JSON spec, after the plot's own modifications (data, title, ...) have been applied. Every plot in this object accepts a mods argument of these.
Attributes
- Example
-
hillResult.plotHill(Seq(Plots.fixedSize(600, 400)))
Value members
Concrete methods
Replace the top-level width / height (which default to "container") with fixed pixel sizes. Use this in notebooks, where sizing to the container causes the plot to grow indefinitely.
Replace the top-level width / height (which default to "container") with fixed pixel sizes. Use this in notebooks, where sizing to the container causes the plot to grow indefinitely.
Attributes
Plot the OEP or AEP curves of several scenarios on one chart: loss along x, return period (log scale) up y.
Plot the OEP or AEP curves of several scenarios on one chart: loss along x, return period (log scale) up y.
Each scenario is one line, named by Scenarr.name; click a legend entry to pick one out. With more than one scenario, their combination (Scenarr.combineAll) is added as a thick line named total. Pass total = None to leave it out, e.g. when the scenarios are alternatives rather than parts of one portfolio.
Attachments are drawn as dashed vertical lines, taken from layers (see the retention and limit of each layer's occurrence terms for an OEP, aggregate terms for an AEP) and from attachments. A dot marks where each curve reaches each attachment; hover it for the return period.
Value parameters
- attachments
-
further lines to draw, as (label, loss), in the same money as the scenarios
- curve
-
OEP or AEP
- layers
-
layers whose attachment and exhaustion points to draw. Their terms are compared with the scenario losses as they are: the scenarios should be the losses to the layer (e.g. ground up, or net of inuring cover).
- lossTitle
-
the loss axis title; the unit is appended
- maxLoss
-
the right-hand end of the loss axis, in the same money as the scenarios; curves are cut off there. If not set, an OEP plot with attachment lines stops at 1.2 × the highest line (the top layer's exhaustion point, plus 20% headroom), and any other plot shows the whole of every curve.
- minReturnPeriod
-
points below this return period are left out, which keeps the plot small for big simulations
- scenarios
-
all from the same simulation (same
numberIterations) iftotalis used - unit
-
losses are divided by
unit.multiplierfor display
Attributes
Stem plot of individual losses against their date: the amount as reported, the normalised (on-levelled) amount, and a trailing rolling average of the normalised amounts.
Stem plot of individual losses against their date: the amount as reported, the normalised (on-levelled) amount, and a trailing rolling average of the normalised amounts.
Use it to look at the data behind plotSeverityTrend: clusters of losses in time, single years that dominate, and how much normalisation moves the older losses.
The rolling average for end year Y is the mean normalised amount of the losses dated in years `Y - rollingYears
- 1
toY, plotted at 31 December ofY`. It is shown for every end year whose window lies inside the data and contains at least one loss.
Value parameters
- amounts
-
the amount of each loss as reported
- dates
-
the date of each loss
- normalisedAmounts
-
the amount of each loss normalised to the current year, same length as dates
- rollingYears
-
the length of the rolling average window, in years
Attributes
Plot a severity trend: log(Severity) ~ 1 + Year, fitted by TrendAnalysis.fitSeverityTrend.
Plot a severity trend: log(Severity) ~ 1 + Year, fitted by TrendAnalysis.fitSeverityTrend.
Shows each loss on a log scale, the fitted median severity exp(β₀ + β₁·year) and a (1 − alpha) confidence band for it. The title gives the annual trend, its confidence interval (the range of trends the data cannot rule out) and the p-value of the slope. The subtitle gives the range of trends when each loss is left out in turn, and each loss's tooltip shows the trend without it. Clicking a loss redraws the fit and band without it; double-clicking restores all losses.
With small data volumes the result is not robust: read it as a check for gross errors in the normalisation, not as a measurement of the trend.
Value parameters
- alpha
-
1 − alphais the confidence level of the band and the interval in the title - losses
-
the (on-levelled) loss amounts, all strictly positive, same length as years
- years
-
the year of each loss
Attributes
Extensions
Extensions
Plot a Hill plot: the tail index estimate α̂(k) against k / n, as points with a 95% interval and the continuous-threshold estimate.
Plot a Hill plot: the tail index estimate α̂(k) against k / n, as points with a 95% interval and the continuous-threshold estimate.
k / n is the empirical exceedance probability of the threshold. The points are evenly spaced, one per loss: the left end uses only the largest losses, and each step right lowers the threshold by one loss. The threshold is in each point's tooltip. Look for a plateau. To the left the estimate is noisy; to the right it pulls in losses from outside the tail.
The continuous-threshold estimate (red) lets the threshold u slide between consecutive losses: with m losses above u, α̂(u) = m / Σᵢ₌₁ᵐ log(x₍ᵢ₎ / u). It decays as u falls and jumps up by m / (m − 1) as each loss enters. It is drawn evenly in log u, and always passes through the points:
- HillConvention.MaxLikelihood: the threshold is the (k+1)-th largest loss, so the points are the bottoms of the teeth. Each tooth runs from (k − 1)/n to k/n.
- HillConvention.Embrechts: the threshold is the k-th largest loss, so the points are the tops of the teeth. The curve leaves each point decaying and jumps up into the next. It is the maximum likelihood curve shifted right by one loss: the two conventions are the same estimator, with the points in different places.
- HillConvention.Unbiased: a different estimator, so a different curve, (m − 1) / Σᵢ₌₁ᵐ log(x₍ᵢ₎ / u): (k − 1)/k times the maximum likelihood tooth. The points are the bottoms of its teeth.
The subtitle says which. The sawtooth needs consecutive k values and the thresholds; it is left out otherwise.
The band is exact if the losses above the threshold are Pareto: with S = Σ log(Xᵢ / threshold) over d non-zero terms (d = k, or k − 1 for HillConvention.Embrechts), 2αS is χ²(2d), so α lies in [χ²₂d(0.025) / 2S, χ²₂d(0.975) / 2S]. The band is an interval for α, not for the estimator, so it is the same for every convention (shifted by one loss for Embrechts). It does not include bias from losses that are not Pareto, which is what drifting to the right shows. If the result does not record n, the x-axis is k instead.
The y-axis stops 0.1 above the highest estimate shown, and the band is clipped there; the tooltip gives the unclipped interval. Use the yMax overload to set the top yourself.
Attributes
Plot the per-year index factors, the shortfall of each year's level relative to the current year, and the reporting threshold on-levelled to the current year.
Plot the per-year index factors, the shortfall of each year's level relative to the current year, and the reporting threshold on-levelled to the current year.
Value parameters
- reportingThreshold
-
The reporting threshold, in
thresholdYearmoney - thresholdYear
-
The year the reporting threshold was set
Attributes
Plot the raw index level for each year. The tooltip shows the factor which on-levels each year to the current year.
Plot the raw index level for each year. The tooltip shows the factor which on-levels each year to the current year.
Attributes
Plot log-log comparison of theoretical Mixed distribution vs empirical sample data.
Plot log-log comparison of theoretical Mixed distribution vs empirical sample data.
This plot shows the complementary CDF (1 - CDF) on log-log scale, which is useful for visualizing tail behavior of heavy-tailed distributions. The x-axis shows log(value) and y-axis shows log(1 - CDF).
Attributes
Plot ECDF vs theoretical CDF as step functions for visual goodness-of-fit assessment.
Plot ECDF vs theoretical CDF as step functions for visual goodness-of-fit assessment.
Both curves are step functions. Deviations between the orange (empirical) and blue (theoretical) lines indicate potential model misfit.
Attributes
As plotEcdfVsCdf, applying mods to the spec after the built-in modifications.
Plot Pearson residuals per count value k: (Oₖ − Eₖ) / √Eₖ, where Oₖ is the number of samples equal to k and Eₖ = n·P(X = k) under the fitted distribution.
Plot Pearson residuals per count value k: (Oₖ − Eₖ) / √Eₖ, where Oₖ is the number of samples equal to k and Eₖ = n·P(X = k) under the fitted distribution.
The denominator is √Eₖ because the number of samples landing in bucket k is approximately Poisson(Eₖ), whatever distribution generated the samples. The Negative Binomial variance μ(1 + μ/a) is the variance of a single draw X, not of a bucket count, so it does not belong here. Residuals beyond ±2 (shown in red) indicate significant deviation from the fitted model.
Attributes
As plotPearsonResiduals, applying mods to the spec after the built-in modifications.
Plot a hanging rootogram for count data diagnostics.
Plot a hanging rootogram for count data diagnostics.
A rootogram displays sqrt(expected) as the reference curve and hangs bars from it down to sqrt(observed). When the model fits well, bars hang close to the zero line. Bars extending below zero indicate under-prediction; bars stopping above zero indicate over-prediction.
A tick marks each bar bottom, so a bucket with zero observations (bottom = top) is still visible. The grey band marks ±1, the usual rule of thumb for a meaningful deviation on the √ scale.
Attributes
As plotRootogram, applying mods to the spec after the built-in modifications.
Plot ECDF vs theoretical CDF as step functions for visual goodness-of-fit assessment.
Plot ECDF vs theoretical CDF as step functions for visual goodness-of-fit assessment.
Attributes
As plotEcdfVsCdf, applying mods to the spec after the built-in modifications.
Plot Pearson residuals for Poisson: (observed - expected) / sqrt(expected).
Plot Pearson residuals for Poisson: (observed - expected) / sqrt(expected).
For Poisson, variance = mean, so the denominator is simply sqrt(expected). Residuals beyond ±2 (red) suggest significant deviation. Systematic patterns may indicate overdispersion (consider Negative Binomial).
Attributes
As plotPearsonResiduals, applying mods to the spec after the built-in modifications.
Plot a hanging rootogram for Poisson count data diagnostics.
Plot a hanging rootogram for Poisson count data diagnostics.
Bars hang from sqrt(expected) down to sqrt(expected) - sqrt(observed). Good fit means bars end near zero.
Attributes
As plotRootogram, applying mods to the spec after the built-in modifications.
Plot a Poisson GLM trend: log(Count) ~ 1 + Year with 95% confidence intervals.
Plot a Poisson GLM trend: log(Count) ~ 1 + Year with 95% confidence intervals.
Fits a Poisson regression to count data over years and displays: - Observations (blue X markers) - Fitted trend line (solid red) - 95% confidence interval band (dashed red lines with shaded area)
The coefficients (intercept, year slope) and their standard errors are estimated via iteratively reweighted least squares (IRLS). The confidence intervals use normal approximation on the log scale.
Value parameters
- counts
-
the count for each observation (same length as years)
- years
-
the year for each observation
Attributes
Plot a Pickands plot showing tail index estimates α̂(k) = 1/γ̂(k) vs k.
Plot a Pickands plot showing tail index estimates α̂(k) = 1/γ̂(k) vs k.
The Pickands estimator is more robust than Hill to model misspecification but has higher variance. Look for a stable plateau region. Unlike the Hill plot, the Pickands estimator can give negative γ values for light-tailed distributions; only positive γ (and thus positive α) indicates heavy tails.
Attributes
As plotPickands, applying mods to the spec after the built-in modifications.
Plot the raw extreme value index γ̂(k) from Pickands estimator.
Plot the raw extreme value index γ̂(k) from Pickands estimator.
For heavy-tailed data, γ > 0. For light-tailed data (e.g., exponential), γ = 0. For bounded distributions, γ < 0.
Attributes
As plotPickandsGamma, applying mods to the spec after the built-in modifications.
Plots.plotExceedance of the scenarios' AEP curves.
Plots.plotExceedance of the scenarios' OEP curves.