Skip to content
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

BerquistSherman class paid adjustment causes NaN's[BUG] #537

Open
cdietrich215 opened this issue Jul 17, 2024 · 3 comments
Open

BerquistSherman class paid adjustment causes NaN's[BUG] #537

cdietrich215 opened this issue Jul 17, 2024 · 3 comments
Assignees
Labels

Comments

@cdietrich215
Copy link

cdietrich215 commented Jul 17, 2024

Describe the bug
I believe the BerquistSherman class's paid adjustment has a bug (this probably some lesser used functionality again). This error occurs in the lookup array defined in line 127.

The procedure selects regression parameters (a and b) within the same AY, based on how close the adjusted closed claim count is to the raw closed claim counts in the row, as described in the Friedland paper, page 289. However, in this implementation, if the adjusted closed count is higher than the max of the AY row's unadjusted closed counts, this lookup produces a value that extends into the "lower triangle". This causes nan values for the a and b parameters, as well as the resulting paid loss values.

There should be a ceiling on the lookup values corresponding to the final regression in the AY row. This can be done after lookup is defined in line 143:

n = lookup.shape[-1]
for j in range(n - 1):
    lookup[:, :, j, :] = np.clip(lookup[:, :, :, j], 0,  n - j - 1)

Hope this makes sense - will try to produce an example at some point. Happy to help implement this.

@cdietrich215 cdietrich215 changed the title BerquistSherman class paid adjustment NaN's[BUG] BerquistSherman class paid adjustment causes NaN's[BUG] Jul 17, 2024
@cdietrich215
Copy link
Author

@jbogaardt I would be happy to help contribute on this or some of the other issues I brought up, let me know if that would be an option!

@jbogaardt
Copy link
Collaborator

@cdietrich215 , contributions are very welcome! Please contribute if you can! Any PR will be tested against the existing test suite. If you can keep those in a passing state, things should be good. Happy to provide further pointers on setting up a development environment (or alternatively you can reference https://chainladder-python.readthedocs.io/en/latest/library/contributing.html)

@cdietrich215
Copy link
Author

Sounds good, was able to get the environment set up. Will make a PR on this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants