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

Docs: Example for initializeCosts; Extend initializeCosts with gamma.contract parameter

parent 84d3319e
Branches
No related tags found
No related merge requests found
...@@ -21,14 +21,28 @@ NULL ...@@ -21,14 +21,28 @@ NULL
#' @param gamma Administration costs while premiums are paid (relative to sum insured) #' @param gamma Administration costs while premiums are paid (relative to sum insured)
#' @param gamma.paidUp Administration costs for paid-up contracts (relative to sum insured) #' @param gamma.paidUp Administration costs for paid-up contracts (relative to sum insured)
#' @param gamma.premiumfree Administration costs for planned premium-free period (reltaive to sum insured) #' @param gamma.premiumfree Administration costs for planned premium-free period (reltaive to sum insured)
#' @param gamma.contract Administration costs for the whole contract period (relative to sum insured)
#' @param unitcosts Unit costs (absolute monetary amount, during premium period) #' @param unitcosts Unit costs (absolute monetary amount, during premium period)
#' @param unitcosts.PolicyPeriod Unit costs (absolute monetary amount, during full contract period) #' @param unitcosts.PolicyPeriod Unit costs (absolute monetary amount, during full contract period)
#' #'
#' @examples #' @examples
#' # empty cost structure (only 0 costs) #' # empty cost structure (only 0 costs)
#' initializeCosts() #' initializeCosts()
#'
#' # the most common cost types can be given in initializeCosts()
#' initializeCosts(alpha = 0.04, Zillmer = 0.025, beta = 0.05, gamma.contract = 0.001)
#'
#' # The same cost structure manually
#' costs.Bsp = initializeCosts();
#' costs.Bsp[["alpha", "SumPremiums", "once"]] = 0.04;
#' costs.Bsp[["Zillmer", "SumPremiums", "once"]] = 0.025;
#' costs.Bsp[["beta", "GrossPremium", "PremiumPeriod"]] = 0.05;
#' costs.Bsp[["gamma", "SumInsured", "PolicyPeriod"]] = 0.001;
#'
#'
#'
#' @export #' @export
initializeCosts = function(costs, alpha, Zillmer, beta, gamma, gamma.paidUp, gamma.premiumfree, unitcosts, unitcosts.PolicyPeriod) { initializeCosts = function(costs, alpha, Zillmer, beta, gamma, gamma.paidUp, gamma.premiumfree, gamma.contract, unitcosts, unitcosts.PolicyPeriod) {
if (missing(costs)) { if (missing(costs)) {
dimnm = list( dimnm = list(
type = c("alpha", "Zillmer", "beta", "gamma", "gamma_nopremiums", "unitcosts"), type = c("alpha", "Zillmer", "beta", "gamma", "gamma_nopremiums", "unitcosts"),
...@@ -59,6 +73,9 @@ initializeCosts = function(costs, alpha, Zillmer, beta, gamma, gamma.paidUp, gam ...@@ -59,6 +73,9 @@ initializeCosts = function(costs, alpha, Zillmer, beta, gamma, gamma.paidUp, gam
if (!missing(gamma.paidUp)) { if (!missing(gamma.paidUp)) {
costs[["gamma_nopremiums", "SumInsured", "PolicyPeriod"]] = gamma.paidUp; costs[["gamma_nopremiums", "SumInsured", "PolicyPeriod"]] = gamma.paidUp;
} }
if (!missing(gamma.contract)) {
costs[["gamma", "SumInsured", "PolicyPeriod"]] = gamma.contract;
}
if (!missing(unitcosts)) { if (!missing(unitcosts)) {
costs[["unitcosts", "Constant", "PremiumPeriod"]] = unitcosts; costs[["unitcosts", "Constant", "PremiumPeriod"]] = unitcosts;
} }
...@@ -67,9 +84,6 @@ initializeCosts = function(costs, alpha, Zillmer, beta, gamma, gamma.paidUp, gam ...@@ -67,9 +84,6 @@ initializeCosts = function(costs, alpha, Zillmer, beta, gamma, gamma.paidUp, gam
} }
costs costs
} }
# costs[["beta", "GrossPremium", "once"]] = 0.12; // Bei EINMALERLAG!
# costs[["gamma", "SumInsured", "PolicyPeriod"]] = 0.0005;
# costs[["alpha", "NetPremium", "once"]]
#' Data structure (filled only with NULL) for insurance contract class member values. #' Data structure (filled only with NULL) for insurance contract class member values.
......
...@@ -12,6 +12,7 @@ initializeCosts( ...@@ -12,6 +12,7 @@ initializeCosts(
gamma, gamma,
gamma.paidUp, gamma.paidUp,
gamma.premiumfree, gamma.premiumfree,
gamma.contract,
unitcosts, unitcosts,
unitcosts.PolicyPeriod unitcosts.PolicyPeriod
) )
...@@ -31,6 +32,8 @@ initializeCosts( ...@@ -31,6 +32,8 @@ initializeCosts(
\item{gamma.premiumfree}{Administration costs for planned premium-free period (reltaive to sum insured)} \item{gamma.premiumfree}{Administration costs for planned premium-free period (reltaive to sum insured)}
\item{gamma.contract}{Administration costs for the whole contract period (relative to sum insured)}
\item{unitcosts}{Unit costs (absolute monetary amount, during premium period)} \item{unitcosts}{Unit costs (absolute monetary amount, during premium period)}
\item{unitcosts.PolicyPeriod}{Unit costs (absolute monetary amount, during full contract period)} \item{unitcosts.PolicyPeriod}{Unit costs (absolute monetary amount, during full contract period)}
...@@ -49,4 +52,17 @@ The main purpose of this structure is to be passed to \link{InsuranceContract} o ...@@ -49,4 +52,17 @@ The main purpose of this structure is to be passed to \link{InsuranceContract} o
\examples{ \examples{
# empty cost structure (only 0 costs) # empty cost structure (only 0 costs)
initializeCosts() initializeCosts()
# the most common cost types can be given in initializeCosts()
initializeCosts(alpha = 0.04, Zillmer = 0.025, beta = 0.05, gamma.contract = 0.001)
# The same cost structure manually
costs.Bsp = initializeCosts();
costs.Bsp[["alpha", "SumPremiums", "once"]] = 0.04;
costs.Bsp[["Zillmer", "SumPremiums", "once"]] = 0.025;
costs.Bsp[["beta", "GrossPremium", "PremiumPeriod"]] = 0.05;
costs.Bsp[["gamma", "SumInsured", "PolicyPeriod"]] = 0.001;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment