Unexpected Behavior From grain() Method #161
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @SMSinclair , Thanks for the question, our first through github discussions! This is unusual behavior. The Limiting it to the more typical upper diagonals seems to produce the desired result. Here's a reprex of what I mean: import pandas as pd
import chainladder as cl
data = pd.DataFrame(
{'origin': ['2018-07','2018-08','2018-09','2018-10','2018-11','2018-12','2018-07','2018-08','2018-09','2018-10','2018-11','2018-12','2018-07','2018-08','2018-09','2018-10','2018-11','2018-12','2018-07','2018-08','2018-09','2018-10','2018-11','2018-12','2018-07','2018-08','2018-09','2018-10','2018-11','2018-12','2018-07','2018-08','2018-09','2018-10','2018-11','2018-12'],
'valuation': ['2018-07','2018-08','2018-09','2018-10','2018-11','2018-12','2018-08','2018-09','2018-10','2018-11','2018-12','2019-01','2018-09','2018-10','2018-11','2018-12','2019-01','2019-02','2018-10','2018-11','2018-12','2019-01','2019-02','2019-03','2018-11','2018-12','2019-01','2019-02','2019-03','2019-04','2018-12','2019-01','2019-02','2019-03','2019-04','2019-05'],
'value': [1,4,0,1,2,0,2,6,1,3,3,1,3,7,3,5,4,3,5,8,5,7,5,5,7,9,7,9,6,7,8,10,8,10,7,8]})
tri = cl.Triangle(
data=data, origin='origin', development='valuation',
columns='value', cumulative=True).dropna()
tri[tri.valuation<'2019'].grain('OQDQ') The problem with the full triangle is that we are censoring all origins to age 6 (valuation 2019-05), but we don't have observations for every origin at that valuation and it chokes. Regardless of how it works currently , grain + full triangle combination probably needs deeper review in the package. |
Beta Was this translation helpful? Give feedback.
-
Thanks! My original post was misleading, that was actually the top left corner of an incomplete cumulative triangle with 36 accident months in the origin ranging from 2018-05 to 2021-04. Anyway, I mocked up an incomplete cumulative triangle with 12 accident months and dummy values to test on:
Then it occurred to me that I was not using the latest version of chainladder, I was still on 0.7.9. So I ran the code in 0.7.9 and 0.8.4 and found that the newest version was working as expected: So it looks like I'm good to go! |
Beta Was this translation helpful? Give feedback.
@jbogaardt ,
Thanks!
My original post was misleading, that was actually the top left corner of an incomplete cumulative triangle with 36 accident months in the origin ranging from 2018-05 to 2021-04.
Anyway, I mocked up an incomplete cumulative triangle with 12 accident months and dummy values to test on: