-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to correctly apply drop_valuation to quarterly triangles? #457
Comments
can you create a reproducible example using the sample data available in the package? |
Sure:
|
Hi @contenrico, did you ever resolve your issue? My understanding is that you are just trying to drop the latest diagonal of your triangle, is that correct? There's no need to use import chainladder as cl
triangle = cl.load_sample('quarterly')
incurred = triangle['incurred']
incurred[incurred.valuation < '2006-1-1'] However, if you need the link ratios, excluding information from the latest diagonal, you can then do this: cl.Development().fit(incurred[incurred.valuation < '2006-1-1']).ldf_ Does this help? |
Hi @kennethshsu, I was indeed trying to drop the latest diagonal from my triangle, but for the specific purpose of calculating link ratios - so I think I do need to use Your second code snippet does exactly that, so I think that works! I guess the only improvement I need is to make that Thank you! |
If you need to access incurred.valuation_date Then, you can calculate the ldfs or cdfs as usual: cl.Development().fit(incurred[incurred.valuation < incurred.valuation_date]).cdf_ With this, you'll be able to manipulate from dateutil.relativedelta import relativedelta
date_x6months = incurred.valuation_date - relativedelta(months=6)
cl.Development().fit(incurred[incurred.valuation < date_x6months]).cdf_ Now, with all that said, I don't know why |
Tests: # Annual development work
raa = cl.load_sample("raa")
assert cl.Development(drop_valuation='1981-12-31').fit_transform(raa).cdf_ != cl.Development(drop_valuation='1982-12-31').fit_transform(raa).cdf_
assert cl.Development(drop_valuation='1982-12-31').fit_transform(raa).cdf_ != cl.Development(drop_valuation='1983-12-31').fit_transform(raa).cdf_
assert cl.Development(drop_valuation='1981-12-31').fit_transform(raa).cdf_ != cl.Development(drop_valuation='1983-12-31').fit_transform(raa).cdf_
# but non-annual don't
assert cl.Development().fit_transform(incurred).cdf_ != cl.Development(drop_valuation='1995-03-31').fit_transform(incurred).cdf_
assert cl.Development().fit_transform(incurred).cdf_ != cl.Development(drop_valuation='1995-06-30').fit_transform(incurred).cdf_
assert cl.Development(drop_valuation='1995-03-31').fit_transform(incurred).cdf_ != cl.Development(drop_valuation='1995-06-30').fit_transform(incurred).cdf_ #this fails now
assert cl.Development(drop_valuation='1995-06-30').fit_transform(incurred).cdf_ != cl.Development(drop_valuation='1995-09-30').fit_transform(incurred).cdf_ #this fails now |
Discussed in #455
Originally posted by contenrico September 7, 2023
Hello,
I'm working with a quarterly triangle and I'm trying to exclude the latest diagonal (valuation date 2022-12). This is the code I'm running:
cl.Development(drop_valuation='2022').fit_transform(incurred).link_ratio
However, the excluded link ratios are the following:
This is quite odd, as I would expect the following points to be excluded:
(2022, 3), (2022, 6), (2022, 9)
(2021, 15), (2021, 18), (2021, 21)
(2020, 27), (2020, 30), (2020, 33)
etc.
Is there a way to use drop_valuation that achieves this?
Thanks!
The text was updated successfully, but these errors were encountered: