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