开始使用免费开始使用

The interest rates they are a-changin'

Cynthia wants to borrow money from her parents to finance a trip to Australia. She needs 1000 EUR this year and another 5000 EUR next year. She wants to repay the money with yearly payments \(K\) as shown on the timeline below.

The interest rate in the loan agreement is not constant, but changes over time as illustrated on the timeline.

These yearly interest rates are predefined in the vector interest. Can you verify that under these conditions Cynthia's yearly loan payments \(K\) should amount 816.86 EUR?

本练习是课程的一部分

Life Insurance Products Valuation in R

查看课程

练习说明

  • Compute the yearly discount factors as 1 plus interest to the power minus 1.
  • Define the discount factors from each future time point to the present moment.
  • Specify the full cash flow vector with positive values 1000 and 5000 representing the loan amounts and 10 negative values -816.86 representing the loan payments.
  • Calculate the present value of the cash flow vector. This amount should be (up to rounding) equal to zero indicating an actuarial equivalence.

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Interest rates
interest <- c(rep(0.05, 3), rep(0.06, 3), rep(0.07, 5))

# Define the yearly discount factors
yearly_discount_factors <- (___) ^ ( - 1)

# Define the discount factors
discount_factors <- c(1 , ___(___))

# Define the cash flow vector
cash_flow <- c(___, ___, rep(___, ___))

# Calculate the PV
PV <- ___(___ * ___)
PV
编辑并运行代码