chainladder-python icon indicating copy to clipboard operation
chainladder-python copied to clipboard

Grain is throwing the exception for OYDY

Open Dayananda02 opened this issue 2 years ago • 3 comments

Grain is throwing the exception for OY and DY for the below input. triangle.grain(OYDY)

2019-12-15 2019-12-31 2300000.0000 2019-12-21 2019-12-31 5000000.0000 2018-12-29 2018-12-31 3542379.0000 2018-12-28 2018-12-31 10400000.0000 2018-12-30 2018-12-31 1000000.0000 2019-12-27 2019-12-31 1500000.0000 2019-12-25 2019-12-31 3000000.0000 2018-12-30 2018-12-31 6000000.0000 2019-12-28 2019-12-31 6900000.0000 2018-12-29 2018-12-31 750000.0000 2019-12-31 2019-12-31 3000000.0000 2019-12-27 2019-12-31 4000000.0000 2018-12-30 2018-12-31 3000000.0000 2018-12-23 2018-12-31 8895000.0000 2018-12-23 2018-12-31 6000000.0000 2018-12-28 2018-12-31 3000000.0000 2018-12-29 2018-12-31 750000.0000 2019-12-13 2019-12-31 4000000.0000 2018-12-27 2018-12-31 3000000.0000 2018-12-27 2018-12-31 350002.8000 2018-12-29 2018-12-31 2000000.0000

I am using the chainladder version as 0.8.9 and also i am using triangle.development_grain = 'M' due to #223

Dayananda02 avatar Jul 04 '22 05:07 Dayananda02

Under chainladder=0.8.13, the triangle initializes as 'OYDY'. Is that not your expectation?

import chainladder as cl
import pandas as pd
import io

cl.Triangle(
    pd.read_csv(
        io.StringIO("""
            12/15/2019, 12/31/2019,2300000
            12/21/2019, 12/31/2019,5000000
            12/29/2018, 12/31/2018,3542379
            12/28/2018, 12/31/2018,10400000
            12/30/2018, 12/31/2018,1000000
            12/27/2019, 12/31/2019,1500000
            12/25/2019, 12/31/2019,3000000
            12/30/2018, 12/31/2018,6000000
            12/28/2019, 12/31/2019,6900000
            12/29/2018, 12/31/2018,750000
            12/31/2019, 12/31/2019,3000000
            12/27/2019, 12/31/2019,4000000
            12/30/2018, 12/31/2018,3000000
            12/23/2018, 12/31/2018,8895000
            12/23/2018, 12/31/2018,6000000
            12/28/2018, 12/31/2018,3000000
            12/29/2018, 12/31/2018,750000
            12/13/2019, 12/31/2019,4000000
            12/27/2018, 12/31/2018,3000000
            12/27/2018, 12/31/2018,350002.8
            12/29/2018, 12/31/2018,2000000"""), 
        header=None, 
        names=['origin', 'development', 'values'],
        parse_dates=['origin', 'development']), 
    origin='origin', 
    development='development', 
    columns='values', 
    cumulative=False).incr_to_cum()

jbogaardt avatar Jul 04 '22 21:07 jbogaardt

I think in old versions we will get triangles in monthly right ? and apply the Grain OYDY to get the yearly triangles ? Is something changed with 0.8.13 ?

Dayananda02 avatar Jul 11 '22 06:07 Dayananda02

The Triangle is supposed to produce/infer a grain consistent with the origin and developement supplied. This is true for 0.8.13 and all prior versions of the package. There may have been edge cases where this didn't work in the past, but they get resolved as they are discovered. In the above example, you only have a December reading for multiple years. With only one month, this gets inferred as OYDY.

jbogaardt avatar Jul 12 '22 11:07 jbogaardt