# Calculating APR (Part 1) August 19, 2019

In a previous blog, we talked about the difference between the APR and the stated interest rate, and the factors that cause the two to be potentially different from each other (fees and interest year calculations). In that blog, I stated that while the accrual and the periodic payment were calculated from the stated rate, the APR was calculated from the payment stream (including fees as if they were interest), and due to the summation component of the amortizing equation, one could not algebraically derive the APR from the payment stream. Instead, it takes a trial-and-error, guess the answer and see how close you are, adjust, wash-rinse-repeat method. In this blog, I will go into the specific detail of that method as is detailed in the documentation by none other than the U.S. Government. This is how it is to be done.

Volume 76, Number 246, Reg Z, Appendix J of the Federal Register details the rules. This publication gives the result to two decimal places. The Nortridge Loan System takes the calculation to four decimal places of precision, which means that once an iteration has not caused any of the first four decimal places to change, the process will stop.

Premise: A \$5,000 loan with monthly payments, and regular periods, a payment of \$230/month, and a two-year term.

STEP 1: First, we start with a guess for the APR. We are going to use this guess in an amortization to determine what the total payments would be if that was the APR. Right now, we know that the total starting principal is \$5,000, and that the sum of the payments (\$ 230 x 24) is \$5,520. We are ultimately looking for the APR that is going to give us exactly \$ 520 of interest, and it is going to take trial and error to find it. In a trial-and-error process, we must start with an initial guess, and in the Nortridge Loan System, that guess is ALWAYS 1%.

We are going to determine a special value, which we will call A'. Once that is determined, we will discuss what this value actually represents, and then it will begin to become apparent how we are going to get the APR. The process for finding A' works like this:

First, we must determine the periodic rate in real number (not percentage) terms. So we take the interest rate, which is defined as a percentage, and we divide it by 12 (monthly loan) to get the period rate and by 100 to take it out of percentage format.

1% / 1200 = 0.000833333

Next, we add 1 (because the component of the equation we are working on is 1+i.)

0.000833333 + 1 = 1.000833333

Next, we iterate that value 24 times (our term is 24 payments), raising it to the power zero the first time, the power 1 the second, the power 2 the third.... to the power 23 the 24th and last time. If we call the number we are raising 1+i to n, then the equation at this point is (1+i)^n

For each of those iterations, we take the reciprocal, so our result is now 1/[(1+i)^n)].

We then add all 24 of the resulting components together. Here is a table to show these calculations:

N (1+i)^n 1/[(1+i)^n] Cumulative Sum
0 1 1 1
1 1.000833 0.999167 1.999167
2 1.001667 0.998335 2.997503
3 1.002502 0.997504 3.995007
4 1.003338 0.996674 4.991681
5 1.004174 0.995844 5.987524
6 1.00501 0.995015 6.982539
7 1.005848 0.994186 7.976725
8 1.006686 0.993358 8.970083
9 1.007525 0.992531 9.962614
10 1.008365 0.991705 10.95432
11 1.009205 0.990879 11.9452
12 1.010046 0.990054 12.93525
13 1.010888 0.98923 13.92448
14 1.01173 0.988406 14.91289
15 1.012573 0.987583 15.90047
16 1.013417 0.986761 16.88723
17 1.014262 0.985939 17.87317
18 1.015107 0.985118 18.85829
19 1.015953 0.984238 19.84259
20 1.016799 0.986478 20.82606
21 1.017647 0.982659 21.80872
22 1.018495 0.981841 22.79056
23 1.019343 0.981024 23.77159

So, what does this cumulative value represent? We are not quite yet to the number that we are going to call A'. So far, the only factors in determining this cumulative value are the term and the interest rate. To get to A', we multiply the cumulative value by the payment amount, and divide by 1+i.

A' = (23.77159 x 230)/1.000833 = 5462.912953

Let's notice a few things about this number. First, note that the cumulative sum is slightly less than the term of 24. In the limiting case where i = 0, the cumulative sum would be exactly 24, and A' would be exactly the total of the payments (\$5,520). So, the higher we raise the guess for the interest rate, the lower our result for A'. When A' reaches the starting principal (A = 5,000) then we have our APR.

Now, we could just incrementally increase i until A' = A, but that would be highly inefficient. The government documentation even goes so far as to tell us how to properly make a second guess, and then how to interpolate our results to efficiently narrow down our subsequent guesses.

STEP 2: Let I(2) = I(1) + .1

As you may recall, I(1) was 1%. I(2) will be 1.1%. That is Big I, not to be confused with little i. Little i(2) will be I(2)/1200, which in this case is 1.1%/1200 = 0.000916667

I'm NOT going to show the table with 24 lines of data again. The process is precisely the same. The cumulative result is 23.74892 and when multiplied by the payment and divided by 1+i we get 5457.249393, which we will call A''.

STEP 3: Now we interpolate using the following equation:

I = I(1) + .1 x [(A - A')/(A'' - A')]

The numbers to plug in here are:

I(1) = 1%

A = 5000

A' = 5462.912953

A'' = 5457.249393

The result of the equation is I = 9.173533372

STEP 4: Repeat steps 1, 2, and 3, beginning with I(1) set to the result just calculated for I. This is the wash, rinse, repeat part.

Without going into the nauseating details (too late, but that was kind of the point, wasn't it), at the end of the second iteration, we have I = 9.684221322

Now that is a difference of a half percent. Clearly we need another iteration, and at the end of the third iteration, we get I = 9.685709095

We are almost at a point where the calculation is good enough for the government requirements (2 decimal places). We would need one more iteration to absolutely know if we were going to round up to 9.69% or down to 9.68% because we can see that our last two iterations have us going either way. At the end of the fourth iteration, the value for I is 9.685708062.

Amazingly, this satisfies the government requirement for two decimal places but also satisfies the Nortridge Loan System's requirement for four decimal places. We can see that both of the last two iterations' results, when rounded to four decimal places are 9.6857%. If we round there, no further iterations will change that. We have our answer.

But what if there is an irregular first period on the loan? Well there are a lot of what ifs. This example was a pretty straight forward one. In fact, there are a lot of variables in the program code for calculating the APR that effectively drop out and are canceled in this special case where we have an even period, monthly loan. The answers to what to do if the loan is a bit more messy will come in another blog.