My app is a savings calculator to help people better plan for retirement. It works by predicting your overall returns from investing a set amount of money each month for several years. The UI consists of sliders that allow you to adjust the amount of money saved each month, inflation rate, interest rate, starting year, and number of years that you will save money.
The real interest rate (r) is defined below as per Fisher’s Equation:
\[\ r = \frac{i - f}{1 + f} \approx i - f\]
where i is the nominal interest rate before inflation, and f is the inflation rate. This approximation is important as it allows us to account for inflation rates in the calculations.
The savings account can be modeled as an annuity. In particular, I used a model for the future value of an annuity with monthly payments, as given below:
\[\ FV = \frac{P[(1 + \frac{r}{12})^n - 1]}{\frac{r}{12}}\] where FV is the future value of the annuity, P is the Fixed Payment Per Period, r is the annual interest rate, and n is the number of periods (12 months/year * # of years). I use this formula to calculate the value of the annuity at the end of the last year as chosen by the user.
Here is a sample calculation of the future value with the following parameters: 10 Years, 2% Inflation rate, 9% Interest Rate, and a $500 payment per month.
r <- (9 - 2)/100 #Real Interest Rate (%)
n <- 10 * 12 #Number of Payment Periods
P <- 500 #Monthly Payment
FV <- P * ((1 + r/12)^n - 1)/(r/12) #Future Value
paste("Real (Inflation-Adjusted) Future Value: $", round(FV, digits = 3))## [1] "Real (Inflation-Adjusted) Future Value: $ 86542.404"