Get startedGet started for free

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?

This exercise is part of the course

Life Insurance Products Valuation in R

View Course

Exercise instructions

  • 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.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# 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
Edit and Run Code