EMI Calculator

Loan Monthly Payment (EMI) and Total Interest Calculator

Aditya

Introduction to the Shiny App

1. 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 basic idea of EMI calculations:

a) EMI calculations are done in such a way thet 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 is below:

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 can be calculated using the following function:

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)
}

Calculating Loan

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

payment(100000,10,5,6)
## [1] 1975.97

Now, the total interest paid during the period can be determined using the function below:

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)
}

How much TOTAL interest did you pay during the loan period?

Using the function in previous slide, we can calculate the total interest paid by the borrower for the same example as before:

int(100000,10,5,6)
## [1] 30414.02

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

Please go to the Shiny app link here to access the app: Weblink