Skip to contents

The local Pareto distribution with local alpha alpha(x) above t (and P(X > x) = 1 below it), approximated by a piecewise_pareto that matches its survival function exactly at the thresholds and within rel_tolerance between them. The conversion stops at stop_at or where the survival function falls below stop_survival; the local alpha there continues as the tail.

Usage

local_pareto_to_piecewise(
  t,
  alpha,
  rel_tolerance = 1e-04,
  stop_survival = 1e-09,
  stop_at = Inf
)

Arguments

t

Threshold; finite and positive.

alpha

A function of one amount returning the local alpha there: finite and non-negative, positive where the conversion stops.

rel_tolerance

Largest relative error in the survival function.

stop_survival, stop_at

Where to stop.

Value

A list: severity (a piecewise_pareto), max_relative_error and approximated_to.

Examples

res <- local_pareto_to_piecewise(1000, function(x) 1.5 + 0.3 * log(x / 1000))
res$max_relative_error
#> [1] 9.375439e-05
res$severity
#> <piecewise_pareto> 157 pieces
#>               t  alpha
#> 1      1000.000 1.5075
#> 2      1051.271 1.5225
#> 3      1105.171 1.5375
#> 4      1161.834 1.5525
#> 5      1221.403 1.5675
#> 6      1284.025 1.5825
#> 7      1349.859 1.5975
#> 8      1419.068 1.6125
#> 9      1491.825 1.6275
#> 10     1568.312 1.6425
#> 11     1648.721 1.6575
#> 12     1733.253 1.6725
#> 13     1822.119 1.6875
#> 14     1915.541 1.7025
#> 15     2013.753 1.7175
#> 16     2117.000 1.7325
#> 17     2225.541 1.7475
#> 18     2339.647 1.7625
#> 19     2459.603 1.7775
#> 20     2585.710 1.7925
#> 21     2718.282 1.8075
#> 22     2857.651 1.8225
#> 23     3004.166 1.8375
#> 24     3158.193 1.8525
#> 25     3320.117 1.8675
#> 26     3490.343 1.8825
#> 27     3669.297 1.8975
#> 28     3857.426 1.9125
#> 29     4055.200 1.9275
#> 30     4263.115 1.9425
#> 31     4481.689 1.9575
#> 32     4711.470 1.9725
#> 33     4953.032 1.9875
#> 34     5206.980 2.0025
#> 35     5473.947 2.0175
#> 36     5754.603 2.0325
#> 37     6049.647 2.0475
#> 38     6359.820 2.0625
#> 39     6685.894 2.0775
#> 40     7028.688 2.0925
#> 41     7389.056 2.1075
#> 42     7767.901 2.1225
#> 43     8166.170 2.1375
#> 44     8584.858 2.1525
#> 45     9025.013 2.1675
#> 46     9487.736 2.1825
#> 47     9974.182 2.1975
#> 48    10485.570 2.2125
#> 49    11023.176 2.2275
#> 50    11588.347 2.2425
#> 51    12182.494 2.2575
#> 52    12807.104 2.2725
#> 53    13463.738 2.2875
#> 54    14154.039 2.3025
#> 55    14879.732 2.3175
#> 56    15642.632 2.3325
#> 57    16444.647 2.3475
#> 58    17287.782 2.3625
#> 59    18174.145 2.3775
#> 60    19105.954 2.3925
#> 61    20085.537 2.4075
#> 62    21115.344 2.4225
#> 63    22197.951 2.4375
#> 64    23336.065 2.4525
#> 65    24532.530 2.4675
#> 66    25790.340 2.4825
#> 67    27112.639 2.4975
#> 68    28502.734 2.5125
#> 69    29964.100 2.5275
#> 70    31500.392 2.5425
#> 71    33115.452 2.5575
#> 72    34813.317 2.5725
#> 73    36598.234 2.5875
#> 74    38474.666 2.6025
#> 75    40447.304 2.6175
#> 76    42521.082 2.6325
#> 77    44701.184 2.6475
#> 78    46993.063 2.6625
#> 79    49402.449 2.6775
#> 80    51935.367 2.6925
#> 81    54598.150 2.7075
#> 82    57397.457 2.7225
#> 83    60340.288 2.7375
#> 84    63434.000 2.7525
#> 85    66686.331 2.7675
#> 86    70105.412 2.7825
#> 87    73699.794 2.7975
#> 88    77478.463 2.8125
#> 89    81450.869 2.8275
#> 90    85626.944 2.8425
#> 91    90017.131 2.8575
#> 92    94632.408 2.8725
#> 93    99484.316 2.8875
#> 94   104584.986 2.9025
#> 95   109947.172 2.9175
#> 96   115584.285 2.9325
#> 97   121510.418 2.9475
#> 98   127740.390 2.9625
#> 99   134289.780 2.9775
#> 100  141174.964 2.9925
#> 101  148413.159 3.0075
#> 102  156022.464 3.0225
#> 103  164021.907 3.0375
#> 104  172431.490 3.0525
#> 105  181272.242 3.0675
#> 106  190566.268 3.0825
#> 107  200336.810 3.0975
#> 108  210608.298 3.1125
#> 109  221406.416 3.1275
#> 110  232758.166 3.1425
#> 111  244691.932 3.1575
#> 112  257237.556 3.1725
#> 113  270426.407 3.1875
#> 114  284291.466 3.2025
#> 115  298867.401 3.2175
#> 116  314190.660 3.2325
#> 117  330299.560 3.2475
#> 118  347234.380 3.2625
#> 119  365037.468 3.2775
#> 120  383753.339 3.2925
#> 121  403428.793 3.3075
#> 122  424113.030 3.3225
#> 123  445857.770 3.3375
#> 124  468717.387 3.3525
#> 125  492749.041 3.3675
#> 126  518012.825 3.3825
#> 127  544571.910 3.3975
#> 128  572492.709 3.4125
#> 129  601845.038 3.4275
#> 130  632702.293 3.4425
#> 131  665141.633 3.4575
#> 132  699244.174 3.4725
#> 133  735095.189 3.4875
#> 134  772784.326 3.5025
#> 135  812405.825 3.5175
#> 136  854058.763 3.5325
#> 137  897847.292 3.5475
#> 138  943880.907 3.5625
#> 139  992274.716 3.5775
#> 140 1043149.728 3.5925
#> 141 1096633.158 3.6075
#> 142 1152858.743 3.6225
#> 143 1211967.074 3.6375
#> 144 1274105.955 3.6525
#> 145 1339430.764 3.6675
#> 146 1408104.848 3.6825
#> 147 1480299.928 3.6975
#> 148 1556196.528 3.7125
#> 149 1635984.430 3.7275
#> 150 1719863.145 3.7425
#> 151 1808042.414 3.7575
#> 152 1900742.731 3.7725
#> 153 1998195.895 3.7875
#> 154 2100645.589 3.8025
#> 155 2208347.992 3.8175
#> 156 2321572.415 3.8325
#> 157 2440601.978 3.8400