Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 56 additions & 56 deletions chainladder/utils/data/friedland_auto_freq_sev.csv
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
Accident Half-Year,Calendar Half-Year,Closed Claim Counts,Reported Claim Counts,Reported Claims,Reported Severity,Paid Claims
2003-07,2003-07,2547,3556,14234668,4003,
2003-07,2004-01,3262,3314,14959396,4514,
2003-07,2004-07,3287,3301,14920520,4520,
2003-07,2005-01,3291,3299,14911480,4520,
2003-07,2005-07,3292,3295,14926350,4530,
2003-07,2006-01,3292,3294,14862528,4512,
2003-07,2006-07,3292,3293,14861309,4513,
2003-07,2007-01,3292,3293,14854723,4511,
2003-07,2007-07,3292,3293,14851430,4510,
2003-07,2008-01,3292,3292,14846920,4510,14846000
2004-01,2004-01,2791,3492,14547672,4166,
2004-01,2004-07,3217,3262,14672476,4498,
2004-01,2005-01,3240,3250,14644500,4506,
2004-01,2005-07,3242,3247,14627735,4505,
2004-01,2006-01,3243,3247,14621241,4503,
2004-01,2006-07,3243,3245,14608990,4502,
2004-01,2007-01,3243,3245,14608990,4502,
2004-01,2007-07,3243,3244,14610976,4504,
2004-01,2008-01,3242,3243,14616201,4507,14614000
2004-07,2004-07,2099,2980,12128600,4070,
2004-07,2005-01,2677,2712,12575544,4637,
2004-07,2005-07,2695,2704,12541152,4638,
2004-07,2006-01,2697,2702,12531876,4638,
2004-07,2006-07,2697,2700,12522600,4683,
2004-07,2007-01,2698,2700,12522600,4638,
2004-07,2007-07,2698,2699,12509865,4635,
2004-07,2008-01,2698,2699,12501768,4632,12502000
2005-01,2005-01,2370,2896,11980752,4137,
2005-01,2005-07,2735,2768,11921776,4307,
2005-01,2006-01,2751,2761,11883344,4304,
2005-01,2006-07,2754,2758,11862158,4301,
2005-01,2007-01,2755,2758,11853884,4298,
2005-01,2007-07,2755,2758,11842852,4294,
2005-01,2008-01,2756,2757,11841315,4295,11840000
2005-07,2005-07,1966,2814,11284140,4010,
2005-07,2006-01,2609,2650,11842850,4469,
2005-07,2006-07,2630,2640,11806080,4472,
2005-07,2007-01,2634,2639,11788413,4467,
2005-07,2007-07,2634,2638,11770756,4462,
2005-07,2008-01,2634,2636,11769740,4465,11765000
2006-01,2006-01,2261,2808,11945232,4254,
2006-01,2006-07,2671,2712,11856864,4372,
2006-01,2007-01,2694,2704,11819184,4371,
2006-01,2007-07,2696,2701,11773659,4359,
2006-01,2008-01,2697,2700,11761200,4356,11755000
2006-07,2006-07,1949,2799,12503133,4467,
2006-07,2007-01,2637,2675,12762425,4771,
2006-07,2007-07,2659,2670,12706530,4759,
2006-07,2008-01,2662,2668,12697012,4759,12679000
2007-01,2007-01,2059,2578,11662872,4524,
2007-01,2007-07,2496,2533,11522617,4549,
2007-01,2008-01,2520,2529,11491776,4544,11406000
2007-07,2007-07,2083,2791,12646021,4531,
2007-07,2008-01,2732,2778,12853806,4627,12648000
2008-01,2008-01,2533,3139,14072137,4483,11833000
Accident Half-Year,Calendar Half-Year,Closed Claim Counts,Reported Claim Counts,Reported Claims,Reported Severity,Paid Claims
2003-07,2003-07,2547,3556,14234668,4003,
2003-07,2004-01,3262,3314,14959396,4514,
2003-07,2004-07,3287,3301,14920520,4520,
2003-07,2005-01,3291,3299,14911480,4520,
2003-07,2005-07,3292,3295,14926350,4530,
2003-07,2006-01,3292,3294,14862528,4512,
2003-07,2006-07,3292,3293,14861309,4513,
2003-07,2007-01,3292,3293,14854723,4511,
2003-07,2007-07,3292,3293,14851430,4510,
2003-07,2008-01,3292,3292,14846920,4510,14846000
2004-01,2004-01,2791,3492,14547672,4166,
2004-01,2004-07,3217,3262,14672476,4498,
2004-01,2005-01,3240,3250,14644500,4506,
2004-01,2005-07,3242,3247,14627735,4505,
2004-01,2006-01,3243,3247,14621241,4503,
2004-01,2006-07,3243,3245,14608990,4502,
2004-01,2007-01,3243,3245,14608990,4502,
2004-01,2007-07,3243,3244,14610976,4504,
2004-01,2008-01,3242,3243,14616201,4507,14614000
2004-07,2004-07,2099,2980,12128600,4070,
2004-07,2005-01,2677,2712,12575544,4637,
2004-07,2005-07,2695,2704,12541152,4638,
2004-07,2006-01,2697,2702,12531876,4638,
2004-07,2006-07,2697,2700,12522600,4638,
2004-07,2007-01,2698,2700,12522600,4638,
2004-07,2007-07,2698,2699,12509865,4635,
2004-07,2008-01,2698,2699,12501768,4632,12502000
2005-01,2005-01,2370,2896,11980752,4137,
2005-01,2005-07,2735,2768,11921776,4307,
2005-01,2006-01,2751,2761,11883344,4304,
2005-01,2006-07,2754,2758,11862158,4301,
2005-01,2007-01,2755,2758,11853884,4298,
2005-01,2007-07,2755,2758,11842852,4294,
2005-01,2008-01,2756,2757,11841315,4295,11840000
2005-07,2005-07,1966,2814,11284140,4010,
2005-07,2006-01,2609,2650,11842850,4469,
2005-07,2006-07,2630,2640,11806080,4472,
2005-07,2007-01,2634,2639,11788413,4467,
2005-07,2007-07,2634,2638,11770756,4462,
2005-07,2008-01,2634,2636,11769740,4465,11765000
2006-01,2006-01,2261,2808,11945232,4254,
2006-01,2006-07,2671,2712,11856864,4372,
2006-01,2007-01,2694,2704,11819184,4371,
2006-01,2007-07,2696,2701,11773659,4359,
2006-01,2008-01,2697,2700,11761200,4356,11755000
2006-07,2006-07,1949,2799,12503133,4467,
2006-07,2007-01,2637,2675,12762425,4771,
2006-07,2007-07,2659,2670,12706530,4759,
2006-07,2008-01,2662,2668,12697012,4759,12679000
2007-01,2007-01,2059,2578,11662872,4524,
2007-01,2007-07,2496,2533,11522617,4549,
2007-01,2008-01,2520,2529,11491776,4544,11406000
2007-07,2007-07,2083,2791,12646021,4531,
2007-07,2008-01,2732,2778,12853806,4627,12648000
2008-01,2008-01,2533,3139,14072137,4483,11833000
96 changes: 68 additions & 28 deletions docs/friedland/chapter_11.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
" exh_df:pd.DataFrame,\n",
" value_cols: list[str] = [],\n",
" factor_cols: list[str] = [],\n",
" other_formats: dict = {}\n",
" other_formats: dict = {},\n",
" date_format: str = \"{:%Y}\"\n",
"):\n",
" return exh_df \\\n",
" .reset_index() \\\n",
Expand All @@ -56,7 +57,7 @@
" .hide(axis='index') \\\n",
" .set_properties(**{\"text-align\":\"right\"}) \\\n",
" .format({\n",
" 'Accident Year':\"{:%Y}\",\n",
" 'Accident Year':date_format,\n",
" **{x:\"{:,.0f}\" for x in value_cols},\n",
" **{x:\"{:,.3f}\" for x in factor_cols},\n",
" **other_formats\n",
Expand Down Expand Up @@ -245,7 +246,7 @@
"print('PART 2 - Age-to-Age Factors')\n",
"nb_display(e1_tri['Closed Claim Counts'].age_to_age.round(3))\n",
"print('PART 3 - Average Age-to-Age Factor')\n",
"nb_display(combine_ldf(e1_ccc_devs).round(3).to_frame())\n",
"nb_display(combine_ldf(e1_ccc_devs).round(3).to_frame().rename_axis(\"\"))\n",
"print('PART 4 - Selected Age-to-Age Factors')\n",
"print('Selected')\n",
"nb_display(e1_ccc_selected.ldf_)\n",
Expand Down Expand Up @@ -294,7 +295,7 @@
"print('PART 2 - Age-to-Age Factors')\n",
"nb_display(e1_tri['Reported Claim Counts'].age_to_age.round(3))\n",
"print('PART 3 - Average Age-to-Age Factor')\n",
"nb_display(combine_ldf(e1_rcc_devs).round(3).to_frame())\n",
"nb_display(combine_ldf(e1_rcc_devs).round(3).to_frame().rename_axis(\"\"))\n",
"print('PART 4 - Selected Age-to-Age Factors')\n",
"print('Selected')\n",
"nb_display(e1_rcc_selected.ldf_)\n",
Expand Down Expand Up @@ -362,7 +363,9 @@
" [\n",
" 'Closed CDF',\n",
" 'Reported CDF',\n",
" ]\n",
" ],\n",
" {},\n",
" \"{:%Y%m}\"\n",
") "
]
},
Expand Down Expand Up @@ -480,7 +483,7 @@
"print('PART 2 - Age-to-Age Factors')\n",
"nb_display(e1_rsev.age_to_age.round(3))\n",
"print('PART 3 - Average Age-to-Age Factors')\n",
"nb_display(combine_ldf(e1_rsev_devs).round(3).to_frame())\n",
"nb_display(combine_ldf(e1_rsev_devs).round(3).to_frame().rename_axis(\"\"))\n",
"print('PART 4 - Selected Age-to-Age Factors')\n",
"nb_display(e1_rsev_selected.ldf_)\n",
"print('CDF to Ultimate')\n",
Expand Down Expand Up @@ -539,7 +542,9 @@
" 'Selected Ult CC',\n",
" 'Ult Claims',\n",
" ],\n",
" ['CDF']\n",
" ['CDF'],\n",
" {},\n",
" \"{:%Y%m}\"\n",
")"
]
},
Expand Down Expand Up @@ -578,7 +583,7 @@
"outputs": [],
"source": [
"e1_s8 = summary_exh(e1_tri['Reported Claims']/1000,e1_tri['Paid Claims']/1000,e1_ult)\n",
"format_exh(e1_s8,e1_s8.columns)"
"format_exh(e1_s8,e1_s8.columns,[],{},\"{:%Y%m}\")"
]
},
{
Expand Down Expand Up @@ -750,7 +755,7 @@
"print('PART 2 - Age-to-Age Factors')\n",
"nb_display(e2_tri['Closed Claim Counts'].age_to_age.round(3))\n",
"print('PART 3 - Average Age-to-Age Factor')\n",
"nb_display(combine_ldf(e2_ccc_devs).round(3).to_frame())\n",
"nb_display(combine_ldf(e2_ccc_devs).round(3).to_frame().rename_axis(\"\"))\n",
"print('PART 4 - Selected Age-to-Age Factors')\n",
"print('Selected')\n",
"nb_display(e2_ccc_selected.ldf_)\n",
Expand Down Expand Up @@ -800,7 +805,7 @@
"print('PART 2 - Age-to-Age Factors')\n",
"nb_display(e2_tri['Reported Claim Counts'].age_to_age.round(3))\n",
"print('PART 3 - Average Age-to-Age Factor')\n",
"nb_display(combine_ldf(e2_rcc_devs).round(3).to_frame())\n",
"nb_display(combine_ldf(e2_rcc_devs).round(3).to_frame().rename_axis(\"\"))\n",
"print('PART 4 - Selected Age-to-Age Factors')\n",
"print('Selected')\n",
"nb_display(e2_rcc_selected.ldf_)\n",
Expand Down Expand Up @@ -952,7 +957,7 @@
"print('PART 2 - Age-to-Age Factors')\n",
"nb_display(e2_rsev.age_to_age.round(3))\n",
"print('PART 3 - Average Age-to-Age Factors')\n",
"nb_display(combine_ldf(e2_rsev_devs).round(3).to_frame())\n",
"nb_display(combine_ldf(e2_rsev_devs).round(3).to_frame().rename_axis(\"\"))\n",
"print('PART 4 - Selected Age-to-Age Factors')\n",
"nb_display(e2_rsev_selected.ldf_)\n",
"print('CDF to Ultimate')\n",
Expand Down Expand Up @@ -1237,7 +1242,7 @@
"print('PART 2 - Age-to-Age Factors')\n",
"nb_display(e3_tri['Closed Claim Counts'].age_to_age.round(3))\n",
"print('PART 3 - Average Age-to-Age Factor')\n",
"nb_display(combine_ldf(e3_ccc_devs).round(3).to_frame())\n",
"nb_display(combine_ldf(e3_ccc_devs).round(3).to_frame().rename_axis(\"\"))\n",
"print('PART 4 - Selected Age-to-Age Factors')\n",
"print('Selected')\n",
"nb_display(e3_ccc_selected.ldf_)\n",
Expand Down Expand Up @@ -1286,7 +1291,7 @@
"print('PART 2 - Age-to-Age Factors')\n",
"nb_display(e3_tri['Reported Claim Counts'].age_to_age.round(3))\n",
"print('PART 3 - Average Age-to-Age Factor')\n",
"nb_display(combine_ldf(e3_rcc_devs).round(3).to_frame())\n",
"nb_display(combine_ldf(e3_rcc_devs).round(3).to_frame().rename_axis(\"\"))\n",
"print('PART 4 - Selected Age-to-Age Factors')\n",
"nb_display(e3_rcc_selected.ldf_)\n",
"print('CDF to Ultimate')\n",
Expand Down Expand Up @@ -1499,7 +1504,7 @@
"print('PART 2 - Age-to-Age Factors')\n",
"nb_display(e3_psev.age_to_age.round(3))\n",
"print('PART 3 - Average Age-to-Age Factor')\n",
"nb_display(combine_ldf(e3_psev_devs).round(3).to_frame())\n",
"nb_display(combine_ldf(e3_psev_devs).round(3).to_frame().rename_axis(\"\"))\n",
"print('PART 4 - Selected Age-to-Age Factors')\n",
"print('Selected')\n",
"nb_display(e3_psev_selected.ldf_)\n",
Expand Down Expand Up @@ -1546,7 +1551,7 @@
"print('PART 2 - Age-to-Age Factors')\n",
"nb_display(e3_rsev.age_to_age.round(3))\n",
"print('PART 3 - Average Age-to-Age Factor')\n",
"nb_display(combine_ldf(e3_rsev_devs).round(3).to_frame())\n",
"nb_display(combine_ldf(e3_rsev_devs).round(3).to_frame().rename_axis(\"\"))\n",
"print('PART 4 - Selected Age-to-Age Factors')\n",
"print('Selected')\n",
"nb_display(e3_rsev_selected.ldf_)\n",
Expand Down Expand Up @@ -1600,10 +1605,20 @@
")\n",
"e3_s8[['Reported Sev','Reported CDF','Ult Reported Sev']] = e3_resv_df[['Latest','CDF','Ultimate']]\n",
"e3_s8[\"Selected Ult Sev\"] = e3_sev_ult.latest_diagonal.to_frame()\n",
"e3_s8[['Paid CDF','Reported CDF']] = e3_s8[['Paid CDF','Reported CDF']].round(3)\n",
"#using floating point offset to achieve standard rounding\n",
"e3_s8[['Paid Sev','Reported Sev','Ult Paid Sev','Ult Reported Sev','Selected Ult Sev']] = (e3_s8[['Paid Sev','Reported Sev','Ult Paid Sev','Ult Reported Sev','Selected Ult Sev']] + 1e-9).round(0)\n",
"e3_s8.iloc[:-2,:][['Age','Paid Sev','Reported Sev','Paid CDF','Reported CDF','Ult Paid Sev','Ult Reported Sev','Selected Ult Sev']]"
"format_exh(\n",
" e3_s8.iloc[:-2,:],\n",
" [\n",
" 'Paid Sev',\n",
" 'Reported Sev',\n",
" 'Ult Paid Sev',\n",
" 'Ult Reported Sev',\n",
" 'Selected Ult Sev',\n",
" ],\n",
" [\n",
" 'Paid CDF',\n",
" 'Reported CDF',\n",
" ],\n",
")"
]
},
{
Expand Down Expand Up @@ -1646,12 +1661,21 @@
"e3_s9[['Sev Trend']] = e3_s9[['Sev Trend']].round(3)\n",
"#using floating point offset to achieve standard rounding\n",
"e3_s9[['Trended Ult Sev']] = (e3_s9[['Trended Ult Sev']] + 1e-9).round(0)\n",
"nb_display(e3_s9.iloc[:-2,:])\n",
"nb_display(format_exh(\n",
" e3_s9.iloc[:-2,:],\n",
" [\n",
" 'Selected Ult Sev',\n",
" 'Trended Ult Sev',\n",
" ],\n",
" [\n",
" 'Sev Trend',\n",
" ],\n",
"))\n",
"print('Average Trended Severity at 2008 Cost Level')\n",
"for k,v in e3_sevs.items():\n",
" print(f\"\\t{k:<20} \\t{v.round(0)}\")\n",
"print(f\"Selected 2008 Severity \\t\\t{e3_sev_2008:.0f}\")\n",
"print(f\"Estimated 2007 Severity \\t{e3_sev_2007:.0f}\")"
" print(f\"\\t{k:<20} \\t{v:,.0f}\")\n",
"print(f\"Selected 2008 Severity \\t\\t{e3_sev_2008:,.0f}\")\n",
"print(f\"Estimated 2007 Severity \\t{e3_sev_2007:,.0f}\")"
]
},
{
Expand Down Expand Up @@ -1698,7 +1722,22 @@
"e3_s10['Case Outstanding'] = e3_s10['Reported Claims'] - e3_s10['Paid Claims']\n",
"e3_s10['IBNR'] = e3_s10['Ult Claims'] - e3_s10['Reported Claims']\n",
"e3_s10['Unpaid'] = e3_s10['IBNR'] + e3_s10['Case Outstanding']\n",
"e3_s10.T"
"format_exh(\n",
" e3_s10,\n",
" [\n",
" 'Payroll',\n",
" 'Ult CC',\n",
" 'Selected Severity',\n",
" 'Ult Claims',\n",
" 'Reported Claims',\n",
" 'Paid Claims',\n",
" 'Case Outstanding',\n",
" 'IBNR',\n",
" 'Unpaid'\n",
" ],\n",
" [],\n",
" {'Selected Frequency':'{:.2%}'}\n",
")"
]
},
{
Expand Down Expand Up @@ -1747,7 +1786,7 @@
"assert np.allclose(\n",
" e3_s8['Selected Ult Sev'].values[:-2],\n",
" np.array([4371, 4587, 4963, 5242, 5635, 6169]),\n",
" atol=1\n",
" rtol=.001\n",
")\n",
"#Exhibit III Sheet 9\n",
"assert np.allclose(\n",
Expand Down Expand Up @@ -1813,7 +1852,8 @@
" },\n",
" origin='origin',\n",
" development='valuation',\n",
" columns='On-Level Adjustment'\n",
" columns='On-Level Adjustment',\n",
" cumulative = True\n",
")\n",
"e4_freq_assumptions = {}\n",
"e4_freq_assumptions['all_years'] = {}\n",
Expand Down Expand Up @@ -2186,7 +2226,7 @@
"print('PART 2 - Age-to-Age Factors')\n",
"nb_display(e5_tri['Closed Claim Counts'].age_to_age.round(3))\n",
"print('PART 3 - Average Age-to-Age Factor')\n",
"nb_display(combine_ldf(e5_ccc_devs).round(3).to_frame())\n",
"nb_display(combine_ldf(e5_ccc_devs).round(3).to_frame().rename_axis(\"\"))\n",
"print('PART 4 - Selected Age-to-Age Factors')\n",
"print('Selected')\n",
"nb_display(e5_ccc_selected.ldf_)\n",
Expand Down Expand Up @@ -2235,7 +2275,7 @@
"print('PART 2 - Age-to-Age Factors')\n",
"nb_display(e5_tri['Reported Claim Counts'].age_to_age.round(3))\n",
"print('PART 3 - Average Age-to-Age Factor')\n",
"nb_display(combine_ldf(e5_rcc_devs).round(3).to_frame())\n",
"nb_display(combine_ldf(e5_rcc_devs).round(3).to_frame().rename_axis(\"\"))\n",
"print('PART 4 - Selected Age-to-Age Factors')\n",
"nb_display(e5_rcc_selected.ldf_)\n",
"print('CDF to Ultimate')\n",
Expand Down
Loading