Pitch Presentation Loan Calculator

Johannes Spiess
September 2017

Why use the Loan Calculator App?

  • Many people and organizations depend on loans to fund projects
  • Hence loans are a widespread and “real life” phenomenon many have to deal with
  • The underlying maths is relatively simple
  • However, calculation results seem counter-intuitive and surprising to many
  • The app at hand shall users help to
    • play around with the key parameters and generate scenarios in doing so
    • compare different loan types offered by lenders
    • develop an understanding for the payments and parallel savings necessary over time

Basic Inputs

The user interface of the app asks for three basic parameters

  • loan
    • this is the total amount of the loan
  • interest
    • the (fixed) interest rate in percent for the loan
  • credit period
    • in how many years the loan will be paid back

Additionaly, users can enter a start date of the loan to caclulate in which year (approximately) the loan will be paid off.

Calculation

The following code part represents the core calculation of the app:

loan <- 300000 ; interest <- 5.5 ; period <- 30 
# Example for a loan of 300000, an interest rate of 5.5 percent and a credit period of 30 years

# The formula below calculates the so called annuity, i.e. the necessary annual sum of back payments; a division by 12 yields the monthly rate
loan * ((1+(interest/100))^period*(interest/100))/((1+(interest/100))^period-1) 
[1] 20641.62

Generating the Payment Pattern

One feature of the app is to list and visualize (using a bar plot) how the annuities accumulate over time. We use a loop and the subsequently the function cumsum for that:

prob1 <- function(loan){  
    for(i in 2:(period+1)) 
        loan[i] <- loan * ((1+(interest/100))^period*(interest/100))/((1+(interest/100))^period-1)
return(loan)                        }
x <- prob1(loan) # apply function for loan
x[1] <- 0 # replace first value with a 0
x <- cumsum(x) # accumulation of sums
return(x)
 [1]      0.00  20641.62  41283.23  61924.85  82566.47 103208.08 123849.70
 [8] 144491.32 165132.94 185774.55 206416.17 227057.79 247699.40 268341.02
[15] 288982.64 309624.25 330265.87 350907.49 371549.10 392190.72 412832.34
[22] 433473.95 454115.57 474757.19 495398.81 516040.42 536682.04 557323.66
[29] 577965.27 598606.89 619248.51

Summary

The Loan Calculator is …

  • easy to use | only four input parameters are needed
  • provides detailed results | e.g. monthly and yearly back payments at a glance
  • has good performance | due to its lean design
  • allows future extensions | e.g. additional graphs, solve for different parameters ..

We hope you find Loan Calculator helpful! Feel free to get in touch: jkhspiess@gmail.com