Skip to content
Snippets Groups Projects
Commit 2b9f8dec authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Document the setLoading function

parent b2f41367
No related branches found
No related tags found
No related merge requests found
...@@ -243,16 +243,19 @@ b@modification = function(qx) pmax(qx, 0.01) ...@@ -243,16 +243,19 @@ b@modification = function(qx) pmax(qx, 0.01)
plot(AVOe2005R.female, b, YOB=2000) 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 When calculating premiums for life insurance contracts, one often needs to add
bound for the death probabilities. To achive this, all `valuationTable`-derived a certain security loading on the raw death probabilities (e.g. 10% increased
classes have a slot `modification` that takes a function that is passed the vector death probabilities) to account for statistical fluctuations. This can be easily
of death probabilities. done with the `setLoading` function that returns a copy of the given table and
adds the given security loading.
```{r} ```{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)) AVOe2005R.female.sec = setLoading(AVOe2005R.female, loading = 0.1);
plot(lt, lt.mod, title="Original and modified table") # 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 ### Adding a modification to the raw probabilities
...@@ -269,6 +272,3 @@ AVOe2005R.female.mod@name = "Modified table (lower bound of 3%)" ...@@ -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") plot(AVOe2005R.female, AVOe2005R.female.mod, title="Original and modified table")
``` ```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment