casact / chainladder-python

Actuarial reserving in Python
https://chainladder-python.readthedocs.io/en/latest/
Mozilla Public License 2.0
192 stars 71 forks source link

[BUG] changing grain with an off-cycle close. #409

Closed jbogaardt closed 1 year ago

jbogaardt commented 1 year ago

Describe the bug The Triangle class supports trailing quarter, semesters and years. However, moving from a triangle grain that is trailing to more aggregate grain produces inaccurate results.

To Reproduce Steps to reproduce the behavior. Code should be self-contained and runnable against publicly available data. For example:

import chainladder as cl

prism = cl.load_sample('prism')['Paid'].sum()
prism = prism[prism.valuation<prism.valuation_date].incr_to_cum() # (limit data to November)
prism = prism.grain('OQDQ', trailing=True) # OK
primt(prism.origin_close) # OK - latest origin is complete quarter cut-off at November
prism.grain('OYDY') # Not OK. 

Expected behavior prism.grain('OYDY') should inherit the trailing property and produce ages 12, 24, 36, etc.