Based on loan term, instalment, and the loan amount, this
function calculates the associated compound interest rate.
This function is designed to be equivalent to the Excel
function RATE. It calculates a fixed interest rate.
Usage
RATE(nper, pmt, pv)
Arguments
nper
Number of periods
pmt
Instalment per period (should be negative)
pv
Present value i.e. loan advance (should be
positive)
Value
rate The corresponding compound interest rate required to
arrive at an FV of 0
RATE(12,-500,3000) # 0.126947 Taken from exceldf<-data.frame(nper=c(12,12),pmt=c(-500,-400),pv=c(3000,3000))
RATE(df$nper,df$pmt,df$pv) # c(0.126947,0.080927) Taken from excel