-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
331 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"%matplotlib inline" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# Munich Adjustment Example\n\n\nThis example demonstrates how to adjust LDFs by the relationship between Paid\nand Incurred using the MunichAdjustment.\n.\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import chainladder as cl\nimport seaborn as sns\nimport matplotlib.pyplot as plt\nsns.set_style('whitegrid')\nsns.set_palette('muted')\n\n# Load data\nmcl = cl.load_dataset('mcl')\n# Volume weighted (default) LDFs\ndev = cl.Development().fit_transform(mcl)\n# Traditional Chainladder\ncl_traditional = cl.Chainladder().fit(dev)\n# Munich Adjustment\ndev_munich = cl.MunichAdjustment(paid_to_incurred={'paid':'incurred'}).fit_transform(dev)\ncl_munich = cl.Chainladder().fit(dev_munich)\n\n# Plot data\nfig, (ax, ax2) = plt.subplots(ncols=2, sharex=True, figsize=(10,5))\nplot1_data = cl_munich.ultimate_['paid'].to_frame()\nplot1_data.columns = ['Paid Ultimate']\nplot1_data['Incurred Ultimate'] = cl_munich.ultimate_['incurred'].to_frame()\nplot2_data = (cl_munich.ultimate_['paid']/cl_munich.ultimate_['incurred']).to_frame()\nplot2_data.columns = ['Munich']\nplot2_data['Traditional'] = (cl_traditional.ultimate_['paid']/cl_traditional.ultimate_['incurred']).to_frame()\nplot1_data.plot(kind='bar', ax=ax)\nax.set_ylabel('Ultimate')\nax.set_xlabel('Accident Year')\nax.set_title('Munich Chainladder')\nplot2_data.plot(kind='bar', ax=ax2, ylim=(0,1.25))\nax2.set_title('P/I Ratio Comparison')\nax2.set_xlabel('Accident Year')\ng = plt.ylabel('Paid Ultimate / Incurred Ultimate')" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.6.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" | ||
========================= | ||
Munich Adjustment Example | ||
========================= | ||
This example demonstrates how to adjust LDFs by the relationship between Paid | ||
and Incurred using the MunichAdjustment. | ||
. | ||
""" | ||
|
||
import chainladder as cl | ||
import seaborn as sns | ||
import matplotlib.pyplot as plt | ||
sns.set_style('whitegrid') | ||
sns.set_palette('muted') | ||
|
||
# Load data | ||
mcl = cl.load_dataset('mcl') | ||
# Volume weighted (default) LDFs | ||
dev = cl.Development().fit_transform(mcl) | ||
# Traditional Chainladder | ||
cl_traditional = cl.Chainladder().fit(dev) | ||
# Munich Adjustment | ||
dev_munich = cl.MunichAdjustment(paid_to_incurred={'paid':'incurred'}).fit_transform(dev) | ||
cl_munich = cl.Chainladder().fit(dev_munich) | ||
|
||
# Plot data | ||
fig, (ax, ax2) = plt.subplots(ncols=2, sharex=True, figsize=(10,5)) | ||
plot1_data = cl_munich.ultimate_['paid'].to_frame() | ||
plot1_data.columns = ['Paid Ultimate'] | ||
plot1_data['Incurred Ultimate'] = cl_munich.ultimate_['incurred'].to_frame() | ||
plot2_data = (cl_munich.ultimate_['paid']/cl_munich.ultimate_['incurred']).to_frame() | ||
plot2_data.columns = ['Munich'] | ||
plot2_data['Traditional'] = (cl_traditional.ultimate_['paid']/cl_traditional.ultimate_['incurred']).to_frame() | ||
plot1_data.plot(kind='bar', ax=ax) | ||
ax.set_ylabel('Ultimate') | ||
ax.set_xlabel('Accident Year') | ||
ax.set_title('Munich Chainladder') | ||
plot2_data.plot(kind='bar', ax=ax2, ylim=(0,1.25)) | ||
ax2.set_title('P/I Ratio Comparison') | ||
ax2.set_xlabel('Accident Year') | ||
g = plt.ylabel('Paid Ultimate / Incurred Ultimate') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
242c50127e7690e88516533290192901 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
.. note:: | ||
:class: sphx-glr-download-link-note | ||
|
||
Click :ref:`here <sphx_glr_download_auto_examples_plot_munich.py>` to download the full example code | ||
.. rst-class:: sphx-glr-example-title | ||
|
||
.. _sphx_glr_auto_examples_plot_munich.py: | ||
|
||
|
||
========================= | ||
Munich Adjustment Example | ||
========================= | ||
|
||
This example demonstrates how to adjust LDFs by the relationship between Paid | ||
and Incurred using the MunichAdjustment. | ||
. | ||
|
||
|
||
|
||
|
||
.. image:: /auto_examples/images/sphx_glr_plot_munich_001.png | ||
:class: sphx-glr-single-img | ||
|
||
|
||
|
||
|
||
|
||
.. code-block:: python | ||
import chainladder as cl | ||
import seaborn as sns | ||
import matplotlib.pyplot as plt | ||
sns.set_style('whitegrid') | ||
sns.set_palette('muted') | ||
# Load data | ||
mcl = cl.load_dataset('mcl') | ||
# Volume weighted (default) LDFs | ||
dev = cl.Development().fit_transform(mcl) | ||
# Traditional Chainladder | ||
cl_traditional = cl.Chainladder().fit(dev) | ||
# Munich Adjustment | ||
dev_munich = cl.MunichAdjustment(paid_to_incurred={'paid':'incurred'}).fit_transform(dev) | ||
cl_munich = cl.Chainladder().fit(dev_munich) | ||
# Plot data | ||
fig, (ax, ax2) = plt.subplots(ncols=2, sharex=True, figsize=(10,5)) | ||
plot1_data = cl_munich.ultimate_['paid'].to_frame() | ||
plot1_data.columns = ['Paid Ultimate'] | ||
plot1_data['Incurred Ultimate'] = cl_munich.ultimate_['incurred'].to_frame() | ||
plot2_data = (cl_munich.ultimate_['paid']/cl_munich.ultimate_['incurred']).to_frame() | ||
plot2_data.columns = ['Munich'] | ||
plot2_data['Traditional'] = (cl_traditional.ultimate_['paid']/cl_traditional.ultimate_['incurred']).to_frame() | ||
plot1_data.plot(kind='bar', ax=ax) | ||
ax.set_ylabel('Ultimate') | ||
ax.set_xlabel('Accident Year') | ||
ax.set_title('Munich Chainladder') | ||
plot2_data.plot(kind='bar', ax=ax2, ylim=(0,1.25)) | ||
ax2.set_title('P/I Ratio Comparison') | ||
ax2.set_xlabel('Accident Year') | ||
g = plt.ylabel('Paid Ultimate / Incurred Ultimate') | ||
**Total running time of the script:** ( 0 minutes 0.433 seconds) | ||
|
||
|
||
.. _sphx_glr_download_auto_examples_plot_munich.py: | ||
|
||
|
||
.. only :: html | ||
.. container:: sphx-glr-footer | ||
:class: sphx-glr-footer-example | ||
.. container:: sphx-glr-download | ||
:download:`Download Python source code: plot_munich.py <plot_munich.py>` | ||
.. container:: sphx-glr-download | ||
:download:`Download Jupyter notebook: plot_munich.ipynb <plot_munich.ipynb>` | ||
.. only:: html | ||
|
||
.. rst-class:: sphx-glr-signature | ||
|
||
`Gallery generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_ |
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
docs/auto_examples/plot_triangle_from_pandas_codeobj.pickle
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
|
||
Examples using ``chainladder.MunichAdjustment`` | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. raw:: html | ||
|
||
<div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how to adjust LDFs by the relationship between Paid and Incurred usin..."> | ||
|
||
.. only:: html | ||
|
||
.. figure:: /auto_examples/images/thumb/sphx_glr_plot_munich_thumb.png | ||
|
||
:ref:`sphx_glr_auto_examples_plot_munich.py` | ||
|
||
.. raw:: html | ||
|
||
</div> | ||
|
||
.. only:: not html | ||
|
||
* :ref:`sphx_glr_auto_examples_plot_munich.py` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" | ||
========================= | ||
Munich Adjustment Example | ||
========================= | ||
This example demonstrates how to adjust LDFs by the relationship between Paid | ||
and Incurred using the MunichAdjustment. | ||
. | ||
""" | ||
|
||
import chainladder as cl | ||
import seaborn as sns | ||
import matplotlib.pyplot as plt | ||
sns.set_style('whitegrid') | ||
sns.set_palette('muted') | ||
|
||
# Load data | ||
mcl = cl.load_dataset('mcl') | ||
# Volume weighted (default) LDFs | ||
dev = cl.Development().fit_transform(mcl) | ||
# Traditional Chainladder | ||
cl_traditional = cl.Chainladder().fit(dev) | ||
# Munich Adjustment | ||
dev_munich = cl.MunichAdjustment(paid_to_incurred={'paid':'incurred'}).fit_transform(dev) | ||
cl_munich = cl.Chainladder().fit(dev_munich) | ||
|
||
# Plot data | ||
fig, (ax, ax2) = plt.subplots(ncols=2, sharex=True, figsize=(10,5)) | ||
plot1_data = cl_munich.ultimate_['paid'].to_frame() | ||
plot1_data.columns = ['Paid Ultimate'] | ||
plot1_data['Incurred Ultimate'] = cl_munich.ultimate_['incurred'].to_frame() | ||
plot2_data = (cl_munich.ultimate_['paid']/cl_munich.ultimate_['incurred']).to_frame() | ||
plot2_data.columns = ['Munich'] | ||
plot2_data['Traditional'] = (cl_traditional.ultimate_['paid']/cl_traditional.ultimate_['incurred']).to_frame() | ||
plot1_data.plot(kind='bar', ax=ax) | ||
ax.set_ylabel('Ultimate') | ||
ax.set_xlabel('Accident Year') | ||
ax.set_title('Munich Chainladder') | ||
plot2_data.plot(kind='bar', ax=ax2, ylim=(0,1.25)) | ||
ax2.set_title('P/I Ratio Comparison') | ||
ax2.set_xlabel('Accident Year') | ||
g = plt.ylabel('Paid Ultimate / Incurred Ultimate') |