储蓄计划的存入额
现在,您已经定义了变量 discount_factors、deposits 和 payments。接下来,利用存入额(红色现金流)与支出(蓝色现金流)之间的精算等价关系,计算年度储蓄存入额 \(K\) 的取值。
本练习是课程的一部分
用 R 评估人寿保险产品
练习说明
- 计算存入模式的现值:对
deposits与discount_factors的按元素乘积使用sum()求和。 - 用同样的方法计算支出模式的现值:对
payments与discount_factors的乘积求和。 - 根据精算等价的概念,前 4 年的年度存入额
K可由PV_payment除以PV_deposit得到。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Calculate the present value of the deposits
PV_deposit <- ___(___ * ___)
# Calculate the present value of the payments
PV_payment <- ___(___ * ___)
# Calculate the yearly deposit K in the first 4 years
K <- ___
K