Developing Data Products Course Project - EMI Calculator

Aditya
May 8th, 2016

Introduction to the EMI Calculator App

This shiny app is a simple tool that does the following:

a) It calculates the monthly payment amount for a certain amount of loan taken. This is also called Equated Monthly Installments or EMI.

b) It calculates the Total Interest paid by the borrower during the entire term of the loan.

The Details of the functions used in this app are in the next slides.

You can also go to the Shiny app link here to access the app: Weblink

The basic idea of EMI calculations:

a) EMI calculations are done in such a way that the Present Value (that is the value of money if it were paid to you today) of all the EMIs is equal to the Loan availed.

b) Present Value of any single amount or a series or payments depends on the rate of return which is the loan interest rate in this case. The simple function for calculating EMI and total interest are in the next slides:

If, P = Loan availed or Principal; R = Yearly interest charged (monthly = Yearly rate/12); Y = number of years in loan duration (Total Months = Number of years*12); M = Any additional months. Then, Simple EMI and Total Interest can be calculated using the functions in the nexts slides:

Calculating Loan EMI

If P = $100,000; R = 10%; and the term of the loan is = 5 years (Y) and 6 months (M):

payment <- function(P, R, Y, M) {
  i <- R/(12*100); n <- (Y*12)+M
  pvf <- (1-((1+i)^(-n)))/(i)
  pmt <- P/pvf; pmt <- round(pmt, 2)
  return(pmt)
}
payment(100000,10,5,6)
[1] 1975.97

Here, the EMI is $1,975.97

Calculating Total Interest Paid

We can calculate the total interest paid by the borrower for the same example as before:

int <- function(P, R, Y, M) {
  i <- R/(12*100); n <- (Y*12)+M
  pvf <- (1-((1+i)^(-n)))/(i); pmt <- P/pvf
  total <- pmt*n; net <- total-P
  net <- round(net,2); return(net)
}
int(100000,10,5,6)
[1] 30414.02

As we can seen, the Total Interest on a loan of $100,000 borrowed at 10% for 5 years and 6 months is $30,414.02.