Truncate claims data subject to reporting delay
Arguments
- data
Full claims data including IBNR
- accident
Accident times. May be an unquoted column name from
data
.- delay
Reporting delays. May be an unquoted column name from
data
.- time
Observation time (scalar number or one per claim). Claims with
accident + delay > time
will be truncated. Settime = Inf
to only compute reporting times and perform no truncation.- .report_col
NULL
or a column name to store the reporting timereport = accident + delay
.
Value
Truncated data
.
The reporting time is stored in a colnumn named by .report_col
unless
.report_col
is NULL
.
If both .report_col
is NULL
and time
contains only Inf
s,
a warning will be issued since data
will be
returned unchanged and no work will be done.
Examples
claims_full <- data.frame(
acc = runif(100),
repdel = rexp(100)
)
tau <- 2.0
truncate_claims(claims_full, acc, repdel, tau)
#> acc repdel report
#> 1 1.341272e-01 0.028235584 0.16236281
#> 2 7.952195e-02 0.008358716 0.08788066
#> 3 3.443970e-02 0.140290387 0.17473009
#> 4 7.098971e-01 1.152279972 1.86217711
#> 5 2.960615e-01 1.574453000 1.87051447
#> 6 7.289446e-01 0.088894959 0.81783959
#> 7 1.101838e-01 1.216726908 1.32691067
#> 8 5.654015e-01 1.387287179 1.95268864
#> 9 7.189693e-01 0.069208830 0.78817813
#> 10 8.909014e-01 0.152164621 1.04306601
#> 11 4.515028e-01 0.206191922 0.65769476
#> 13 1.224872e-01 0.514714528 0.63720168
#> 14 1.555099e-05 0.319640385 0.31965594
#> 15 6.111351e-01 0.932906239 1.54404130
#> 17 3.713955e-02 0.471633688 0.50877323
#> 18 7.302117e-01 0.470371407 1.20058307
#> 19 4.125354e-01 0.825975930 1.23851137
#> 21 5.602826e-01 0.078439292 0.63872193
#> 23 5.899033e-01 0.356895571 0.94679888
#> 24 5.889085e-01 0.886226820 1.47513534
#> 25 1.670153e-01 0.177537690 0.34455295
#> 26 6.828304e-01 0.163108702 0.84593913
#> 27 3.082466e-01 0.319356196 0.62760279
#> 28 7.793431e-01 0.952858891 1.73220199
#> 29 3.284492e-01 1.587426414 1.91587561
#> 30 4.171246e-02 1.250061904 1.29177437
#> 31 1.383127e-01 1.177008377 1.31532110
#> 32 2.560620e-01 0.055133459 0.31119549
#> 33 4.429471e-01 0.267354952 0.71030207
#> 34 2.050347e-01 0.464885217 0.66991992
#> 35 7.792969e-01 0.157671728 0.93696860
#> 37 7.766178e-01 1.075450784 1.85206859
#> 39 1.776113e-01 1.112906751 1.29051807
#> 42 5.313195e-01 0.137196474 0.66851598
#> 43 4.677886e-01 0.664616256 1.13240482
#> 44 1.206373e-01 0.297930363 0.41856766
#> 45 6.348620e-01 1.141797280 1.77665926
#> 46 8.912517e-01 0.680814184 1.57206585
#> 47 8.781296e-01 0.540906635 1.41903623
#> 48 2.148099e-02 0.518280302 0.53976129
#> 50 5.886034e-01 0.705613201 1.29421661
#> 51 1.850858e-01 0.508072750 0.69315858
#> 52 5.010168e-01 0.352654210 0.85367102
#> 54 9.485277e-01 0.332760828 1.28128852
#> 55 1.860526e-01 0.110473518 0.29652609
#> 56 9.358294e-01 0.568551742 1.50438114
#> 57 7.175151e-01 0.091612742 0.80912781
#> 58 3.182253e-01 0.436845455 0.75507071
#> 59 5.823165e-01 0.114667189 0.69698367
#> 61 6.969247e-01 0.476378988 1.17330367
#> 62 7.630700e-01 0.010118335 0.77318837
#> 63 1.971220e-01 1.478337746 1.67545979
#> 64 1.982628e-01 1.151255731 1.34951853
#> 65 3.902595e-01 1.343615915 1.73387538
#> 66 6.074760e-01 0.774707003 1.38218298
#> 67 5.993708e-01 0.646028800 1.24539964
#> 68 7.847457e-01 0.986775468 1.77152118
#> 69 5.605707e-01 0.550733615 1.11130433
#> 70 4.787836e-01 0.947700852 1.42648449
#> 71 9.189584e-01 0.396267166 1.31522557
#> 72 1.237870e-02 0.390503512 0.40288222
#> 74 5.759545e-01 0.819434726 1.39538924
#> 75 3.667410e-01 0.043780853 0.41052181
#> 76 1.393693e-01 0.232285622 0.37165496
#> 78 8.949839e-01 0.206483914 1.10146782
#> 79 2.749953e-01 0.453207363 0.72820271
#> 80 2.195253e-01 0.777957749 0.99748306
#> 81 7.483612e-02 0.264012017 0.33884814
#> 82 2.389014e-01 0.022741144 0.26164256
#> 84 2.821164e-01 0.205027999 0.48714435
#> 86 2.685969e-01 0.517190858 0.78578778
#> 87 3.688022e-01 0.114156616 0.48295881
#> 90 1.491891e-01 1.768341100 1.91753016
#> 91 2.765223e-01 0.306067371 0.58258966
#> 92 7.019701e-01 0.056862872 0.75883296
#> 94 6.576286e-01 1.223552487 1.88118109
#> 95 4.837228e-01 0.368050174 0.85177300
#> 97 6.680541e-01 0.381928012 1.04998212
#> 98 1.240903e-01 0.434685851 0.55877612
#> 99 4.515315e-01 0.622061988 1.07359347
#> 100 3.454657e-01 0.470663017 0.81612874