mages / ChainLadder

Claims reserving models in R
https://mages.github.io/ChainLadder/
75 stars 62 forks source link

Weighted matrix for Munich Chain Ladder #84

Closed mspina84 closed 2 years ago

mspina84 commented 2 years ago

The proposed changes introduce the possibility of using the weight matrix in the Munich Chain Ladder model. This setting is already provided for the MackChainladder function.

mages commented 2 years ago

Hi mspina84,

Thanks for your contribution. Can I please ask you the following:

  1. Change the argument in MunichChainLadder from w to weights to be consistent with the MackChainLadder function
  2. Move the weights arguments to the end of the function definition of MunichChainLadder to avoid that existing scripts break, which use arguments without names.
  3. Update the documentation for MunichChainLadder for the new argument https://github.com/mages/ChainLadder/blob/master/man/MunichChainLadder.Rd
  4. Create a test case in in ChainLadder/inst/unitTests. Basically you have to create an R file with a simple example with a given data set and weights for which you know the output. The first test here should give you the idea. This will ensure that we know if future edits of the file break your code. Let me know if you need assistance.
  5. Let me know your real name such I can thank in the THANKS file

Let me know if you require assistance.

mspina84 commented 2 years ago

Hi, Markus.

1 . Change the argument in MunichChainLadder from w to weights to be consistent with the MackChainLadder function Ok 2 . Move the weights arguments to the end of the function definition of MunichChainLadder to avoid that existing scripts break, which use arguments without names. Ok

  1. Update the documentation for MunichChainLadder for the new argument. https://github.com/mages/ChainLadder/blob/master/man/MunichChainLadder.Rd Ok. I refered to MackChainLadder Documentation.
  2. Create a test case in ChainLadder/inst/unitTests. Basically you have to create an R file with a simple example with a given data set and weights for which you know the output. The first test [here] (https://github.com/mages/ChainLadder/blob/master/inst/unitTests/runit.MackChainLadder.R) should give you the idea. This will ensure that we know if future edits of the file break your code. Let me know if you need assistance. Ok. I've created a simple test in ChainLadder/inst/unitTests/runit.MunichChainLadder.R that checks the match of the Ultimate (Paid and Incurred) with L3 LDF selection.
  3. Let me know your real name such I can thank in the [THANKS] file My name is Marco Spina.

Let me know if I need to make any further additions.

mspina84 commented 2 years ago

Hi Markus,

after the failed first run, I modified the script test in the ChainLadder/inst/unitTests/runit.MunichChainLadder.R file and corrected an error in the argument definition of the checkEquals function. It should now work correctly.

mages commented 2 years ago

Hi Marco, I merged the new file into the master branch. Unfortunately, the build process is failing with the old examples MunichChainLadder. Can you please look into this? Thanks!