Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
R - Mortality Tables
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
R
R - Mortality Tables
Commits
bce68466
Commit
bce68466
authored
9 years ago
by
Reinhold Kainhofer
Browse files
Options
Downloads
Patches
Plain Diff
Fix benefits paid in arrears, fix multiple payments per year
parent
1bccc58d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
R/HelperFunctions.R
+1
-1
1 addition, 1 deletion
R/HelperFunctions.R
R/InsuranceTarif.R
+14
-5
14 additions, 5 deletions
R/InsuranceTarif.R
R/TODO.txt
+2
-0
2 additions, 0 deletions
R/TODO.txt
with
17 additions
and
6 deletions
R/HelperFunctions.R
+
1
−
1
View file @
bce68466
...
...
@@ -64,7 +64,7 @@ correctionPaymentFrequency = function(m = 1, i = self$i, order = 0) {
# correction are used like an explicit premium frequency loading on the premium.
if
(
order
>=
0
)
beta
=
beta
+
(
m
-1
)
/
(
2
*
m
);
# For higher orders, simply add one term after the other!
if
(
order
>=
1
)
beta
=
beta
+
(
m
^
2-1
)
/
(
6
*
m
^
2
)
*
i
;
if
(
order
>=
1
)
beta
=
beta
+
(
m
^
2-1
)
/
(
6
*
m
^
2
)
*
i
;
# S-Versicherung: *(1-i/2)
# order 1.5 has a special term that should NOT be used for higher-order approximations!
if
(
order
==
1.5
)
beta
=
beta
+
(
1
-
m
^
2
)
/
(
12
*
m
^
2
)
*
i
^
2
;
...
...
This diff is collapsed.
Click to expand it.
R/InsuranceTarif.R
+
14
−
5
View file @
bce68466
...
...
@@ -53,8 +53,8 @@ InsuranceTarif = R6Class(
sumRebate
=
0
,
costs
=
list
(),
benefitFrequencyLoading
=
list
(
"1"
=
0.0
,
"2"
=
0.0
1
,
"4"
=
0.0
15
,
"12"
=
0.0
2
),
# TODO: Properly implement this
premiumFrequencyLoading
=
list
(
"1"
=
0.0
,
"2"
=
0.0
1
,
"4"
=
0.0
15
,
"12"
=
0.0
2
),
# TODO: Implement this
benefitFrequencyLoading
=
list
(
"1"
=
0.0
,
"2"
=
0.0
,
"4"
=
0.0
,
"12"
=
0.0
),
# TODO: Properly implement this
premiumFrequencyLoading
=
list
(
"1"
=
0.0
,
"2"
=
0.0
,
"4"
=
0.0
,
"12"
=
0.0
),
# TODO: Implement this
loadings
=
list
(
# Loadings can also be function(sumInsured, premiums) # TODO: Add other possible arguments
"tax"
=
0.04
,
# insurance tax, factor on each premium paid
"unitcosts"
=
0
,
# annual unit cost for each policy (Stückkosten), absolute value
...
...
@@ -423,7 +423,12 @@ InsuranceContract = R6Class(
#### The code:
initialize
=
function
(
tarif
,
age
,
policyPeriod
,
premiumPeriod
=
policyPeriod
,
sumInsured
=
1
,
...
,
deferral
=
0
,
YOB
=
1975
)
{
initialize
=
function
(
tarif
,
age
,
policyPeriod
,
premiumPeriod
=
policyPeriod
,
sumInsured
=
1
,
...
,
premiumPayments
=
"in advance"
,
benefitPayments
=
"in advance"
,
premiumFrequency
=
1
,
benefitFrequency
=
1
,
deferral
=
0
,
YOB
=
1975
)
{
self
$
tarif
=
tarif
;
self
$
age
=
age
;
self
$
policyPeriod
=
policyPeriod
;
...
...
@@ -431,6 +436,10 @@ InsuranceContract = R6Class(
self
$
sumInsured
=
sumInsured
;
if
(
!
missing
(
deferral
))
self
$
deferral
=
deferral
;
if
(
!
missing
(
YOB
))
self
$
YOB
=
YOB
;
if
(
!
missing
(
premiumPayments
))
self
$
premiumPayments
=
premiumPayments
;
if
(
!
missing
(
benefitPayments
))
self
$
benefitPayments
=
benefitPayments
;
if
(
!
missing
(
premiumFrequency
))
self
$
premiumFrequency
=
premiumFrequency
;
if
(
!
missing
(
benefitFrequency
))
self
$
benefitFrequency
=
benefitFrequency
;
self
$
determineTransitionProbabilities
();
self
$
determineCashFlows
();
...
...
@@ -445,14 +454,14 @@ InsuranceContract = R6Class(
determineCashFlows
=
function
()
{
self
$
cashFlowsBasic
=
self
$
tarif
$
getBasicCashFlows
(
YOB
=
self
$
YOB
,
age
=
self
$
age
,
policyPeriod
=
self
$
policyPeriod
,
premiumPeriod
=
self
$
premiumPeriod
);
self
$
cashFlows
=
self
$
tarif
$
getCashFlows
(
age
=
self
$
age
,
premiumPayments
=
self
$
premiumPayments
,
policyPeriod
=
self
$
policyPeriod
,
premiumPaymentPeriod
=
self
$
premiumPeriod
,
basicCashFlows
=
self
$
cashFlowsBasic
);
self
$
cashFlows
=
self
$
tarif
$
getCashFlows
(
age
=
self
$
age
,
premiumPayments
=
self
$
premiumPayments
,
benefitPayments
=
self
$
benefitPayments
,
policyPeriod
=
self
$
policyPeriod
,
premiumPaymentPeriod
=
self
$
premiumPeriod
,
basicCashFlows
=
self
$
cashFlowsBasic
);
self
$
premiumSum
=
sum
(
self
$
cashFlows
$
premiums_advance
+
self
$
cashFlows
$
premiums_arrears
);
self
$
cashFlowsCosts
=
self
$
tarif
$
getCashFlowsCosts
(
YOB
=
self
$
YOB
,
age
=
self
$
age
,
premiumPaymentPeriod
=
self
$
premiumPeriod
,
policyPeriod
=
self
$
policyPeriod
);
list
(
"benefits"
=
self
$
cashFlows
,
"costs"
=
self
$
cashFlowCosts
,
"premiumSum"
=
self
$
premiumSum
)
},
calculatePresentValues
=
function
()
{
self
$
presentValues
=
self
$
tarif
$
presentValueCashFlows
(
self
$
cashFlows
,
age
=
self
$
age
,
YOB
=
self
$
YOB
);
self
$
presentValues
=
self
$
tarif
$
presentValueCashFlows
(
self
$
cashFlows
,
age
=
self
$
age
,
YOB
=
self
$
YOB
,
premiumFrequency
=
self
$
premiumFrequency
,
benefitFrequency
=
self
$
benefitFrequency
);
self
$
presentValuesCosts
=
self
$
tarif
$
presentValueCashFlowsCosts
(
self
$
cashFlowsCosts
,
age
=
self
$
age
,
YOB
=
self
$
YOB
);
list
(
"benefits"
=
self
$
presentValues
,
"costs"
=
self
$
presentValuesCosts
)
},
...
...
This diff is collapsed.
Click to expand it.
R/TODO.txt
0 → 100644
+
2
−
0
View file @
bce68466
TODO:
- Alpha-Kosten an laufender Rentenzahlung bei Unterjährigkeit (Kosten werden nicht unterjährig berechnet!)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment