Checks on a tower model's shape
tower_diagnostics.RdA match reproduces its references exactly, but between and beyond them a
piece of the severity can be implausible: an alpha below min_alpha (below
1 on the last, untruncated piece the mean is infinite), or neighbouring
alphas more than max_ratio apart.
Arguments
- model
A tower_model.
- min_alpha
The smallest plausible alpha.
- max_ratio
The largest plausible ratio between neighbouring alphas.
Value
A list with min_alpha, max_alpha, max_ratio, infinite_mean
and warnings (a character vector, empty when the shape looks
plausible).
Examples
m <- fit_references(
layers = data.frame(limit = c(1, 5, Inf), attachment = c(1, 5, 10),
expected_loss = c(1.706, 0.675, 0.295)),
frequencies = data.frame(threshold = 1, frequency = 2.8)
)
tower_diagnostics(m)$warnings
#> [1] "the piece from 1.28998 has alpha 0.6431, below 1"
#> [2] "the piece from 2 has alpha 0.5475, below 1"
#> [3] "the alphas 1.8659 and 0.6431 either side of 1.28998 differ by a factor of 2.901, above 2"
#> [4] "the alphas 0.5475 and 1.8088 either side of 3.61248 differ by a factor of 3.304, above 2"
#> [5] "the alphas 1.8088 and 7.2756 either side of 5 differ by a factor of 4.022, above 2"
#> [6] "the alphas 7.2756 and 1.4574 either side of 5.98506 differ by a factor of 4.992, above 2"
#> [7] "the alphas 1.4574 and 3.2881 either side of 10 differ by a factor of 2.256, above 2"