From 2b9f8dec6c59b09aae5ade5181f7fc9acacfea36 Mon Sep 17 00:00:00 2001
From: Reinhold Kainhofer <reinhold@kainhofer.com>
Date: Sat, 3 Sep 2016 03:05:28 +0200
Subject: [PATCH] Document the setLoading function

---
 .../using-the-valuationTables-package.Rmd     | 20 +++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/vignettes/using-the-valuationTables-package.Rmd b/vignettes/using-the-valuationTables-package.Rmd
index a2dd1e6..bfaa8b5 100644
--- a/vignettes/using-the-valuationTables-package.Rmd
+++ b/vignettes/using-the-valuationTables-package.Rmd
@@ -243,16 +243,19 @@ b@modification = function(qx) pmax(qx, 0.01)
 plot(AVOe2005R.female, b, YOB=2000)
 ```
 
-### Adding a modification to the raw probabilities
+### Adding a security loading to the raw probabilities
 
-Some uses require post-processing of the death probabilities, like adding a lower
-bound for the death probabilities. To achive this, all `valuationTable`-derived 
-classes have a slot `modification` that takes a function that is passed the vector 
-of death probabilities.
+When calculating premiums for life insurance contracts, one often needs to add 
+a certain security loading on the raw death probabilities (e.g. 10% increased
+death probabilities) to account for statistical fluctuations. This can be easily
+done with the `setLoading` function that returns a copy of the given table and 
+adds the given security loading.
 
 ```{r}
-lt.mod = valuationTable.period(name="Sample modified lifetable (lower bound of 3%)", ages=1:99, deathProbs=exp(-(99:1)/10), modification=function (qx) pmax(0.03, qx))
-plot(lt, lt.mod, title="Original and modified table")
+AVOe2005R.female.sec = setLoading(AVOe2005R.female, loading = 0.1);
+# Make sure the modified table has a new name, otherwise plots might break
+AVOe2005R.female.sec@name = "Table with 10% loading"
+plot(AVOe2005R.female, AVOe2005R.female.sec, title="Original and modified table")
 ```
 
 ### Adding a modification to the raw probabilities
@@ -269,6 +272,3 @@ AVOe2005R.female.mod@name = "Modified table (lower bound of 3%)"
 plot(AVOe2005R.female, AVOe2005R.female.mod, title="Original and modified table")
 ```
 
-
-
-
-- 
GitLab