Calculating APR for biweekly payments

math-guy

New member
Joined
Nov 9, 2019
Messages
13
Hello,

For regular APR calculation, I use Newton's method and the partial derivative of that function.

However, I now need to be able to calculate APR for biweekly payments, but I don't know what function to use or how to get the APR.

Examples below using the payment calculator from the Treasury Web site (no source code there).

Example 1:

Loan $2,995
Interest 14.99
Payment 125
Number of payments 26
Unit 14 days
1st Payment made 1 unit and 7 days out
Last payment made 26 units and 7 days out 88.97

Calculated APR = 13.4076%


-------------------------------------

Example 2:


Loan $3,463.22
Interest 26%
Payments 125
Number of Payments 33
Unit 14 days
1st Payment in a series of 32, starts 1 Unit out $125
33rd payment due 33 units out: $21.22

Calculated APR = 24.1021%

----

This APR calculation would be part of a web service called from a third party application so I need to code the algorithm (that is, the calculation can't be from a "calculator").

Can anyone help me with the formula and approach?

Thanks very much in advance,
 
Example 1:
Loan $2,995
Interest 14.99
Payment 125
Number of payments 26
Unit 14 days
1st Payment made 1 unit and 7 days out
Last payment made 26 units and 7 days out 88.97
What is "Interest 14.99"?
What is "88.97"?
How do "1 unit" and "26 units" (increasing payments) related to "Payment 125" (level payments)? Is it a level payment or not?

Only guessing at this point, but It may appear that we have this, for increasing payments:

i = APR
j = i/26
[math]v[/math] = 1/(1+j)
[math]U[/math] = 1 unit

1) [math]Uv + 2Uv^{2} + 3Uv^{3} + ... + 26Uv^{26} = S[/math], where S is the total original loan

2) [math]Uv^{2} + 2Uv^{3} + 3Uv^{4} + ... + 26Uv^{27} = Sv[/math]
Subtracting 2) from 1)

3) [math]Uv + Uv^{2} + Uv^{2} + ... + Uv^{26} = S(1-v) + 26Uv^{27}[/math]
4) [math]U\cdot\dfrac{v-v^{27}}{1-v} = S(1-v) + 26Uv^{27}[/math], which is easily solved for [math]S[/math] if desired.

Any appropriate numerical method can then be used to solve for [math]v[/math], given [math]S[/math] and [math]U[/math].
 
Sorry for the confusion. I'm confused also. :)

Interest 14.99 -> Interest rate is 14.99%
I believe the 88.97 is $88.97 -> the amount of the last payment made.

---

So, here's the deal -- I was given these as examples from which the client could calculate using the APR using the APRwin calculator.


Can you derive the APR using this new information using your formula to match either of the examples?

I really appreciate your input.

Thanks again.
 
Sorry for the confusion. I'm confused also. :)

Interest 14.99 -> Interest rate is 14.99%
I believe the 88.97 is $88.97 -> the amount of the last payment made.

---

So, here's the deal -- I was given these as examples from which the client could calculate using the APR using the APRwin calculator.


Can you derive the APR using this new information using your formula to match either of the examples?

I really appreciate your input.

Thanks again.
tk gave you the (detailed) equation - and you know Newton's method - so give it a try and tell us what you got as answer for 'v'.
 
Still not getting it. If the Interest Rate is 14.99%, how can the APR be 13.4076? Is there an investment component we're supposed to be worrying about? We can find pretty close to the 13.4076%, but it has nothing to do with the 14.99%.

Please observe that language usage is not the same across cultures or translations or even time. Try to be explicit with your definitions. Your assumptions concerning what may be standard usage, and well-understood by all, may not be sufficient to facilitate effective communication.

Let's try this:
1) Payments are level (except for the last) and Bi-weekly, but do not start 2 weeks from origination. This is a small complication.
2) 14.99 is a red herring
3) Units refer to time periods (bi-weekly = 1 unit of time), not payment amounts.
4) "1 unit and 7 days out" is three weeks from origination
5) "26 units and 7 days out" is one year and one extra week from origination

The Trail
[math]i[/math] = Unknown Interest Rate

[math]j = i/26[/math] = Bi-Weekly Interest Rate

[math]k = \sqrt{1+j} - 1[/math] = Equivalent Weekly Interest Rate

[math]v = \dfrac{1}{1+k}[/math] = Weekly Discount Factor

The Equation
[math]2995.00 = 125.00v^{3} + 125.00v^{5} +\;...\; + 125.00v^{51} + 88.95v^{53} = 125\cdot\dfrac{v^{3} - v^{53}}{1-v^{2}} + 88.95v^{53}[/math]
Understand the equation and then solve for [math]v[/math] using your favorite method. Walk the trail backwards to find [math]i[/math]. I get 13.4071067579343%, not quite your 13.4076%, but I feel pretty good about it since I'm still just guessing what is wanted.

If you can build a cash flow map, you can solve it.
 
Last edited:
I believe the two images below reference the problem I stated.

Do these match your guessing what I posted above?

I am a math/CS person, not a financial person so I apologize for my lack of clarity and completeness in my postings. I only got a rough idea via email from the client and he himself is not a finance person.

The attached documents are ancient and the only documentation I could find, not that the formulas actually change but enjoy the typewritten text :) The dates in the examples are from 1978.

Thanks
 

Attachments

  • irregularpayment.png
    irregularpayment.png
    44.5 KB · Views: 6
  • image002.png
    image002.png
    127.4 KB · Views: 5
Some of us have been around since well before 1978. :)

The use of the well-defined international actuarial notation is a good sign. I never had much use for memorizing symbols, though - even while writing actuarial exams. Just build the cash flow map and add things up. That is what I did. Be careful to get your payment frequency and your interest compounding frequency on the same page. That is also what I did. (Some might call it "quantization", I suppose.)

For the second example, using the same cash flow map methodology, I get 24.1021292340776% (Again, ignoring the provided interest rate.) Slight differences may be due to specific rounding of intermediate values - something we don't have to do any more - unlike 1978. Perhaps the provided interest rate is just a place to start looking for the solution.

Looks like you're in business, then.
 
Last edited:
I am a math/CS person, not a financial person so I apologize for my lack of clarity and completeness in my postings. I only got a rough idea via email from the client and he himself is not a finance person. The attached documents are ancient and the only documentation I could find, not that the formulas actually change but enjoy the typewritten text :) The dates in the examples are from 1978. Thanks
Be careful about "legal liabilities" of quoting financial numbers to your clients through internet assistance (in case it is not correct).
 
Some of us have been around since well before 1978. :)

The use of the well-defined international actuarial notation is a good sign. I never had much use for memorizing symbols, though - even while writing actuarial exams. Just build the cash flow map and add things up. That is what I did. Be careful to get your payment frequency and your interest compounding frequency on the same page. That is also what I did. (Some might call it "quantization", I suppose.)

For the second example, using the same cash flow map methodology, I get 24.1021292340776% (Again, ignoring the provided interest rate.) Slight differences may be due to specific rounding of intermediate values - something we don't have to do any more - unlike 1978. Perhaps the provided interest rate is just a place to start looking for the solution.

Looks like you're in business, then.

Cool!!!

What do you mean by "building a cash flow map"? What exactly did you do to do that?

It seems the equation is suitable to a computer implementation. All the numbers make sense except for the 88.95. I don't see how you calculated that. I'm assuming it's not a formula constant.

I think what you did to solve this was that you solved for v using Newton's method (or similar), then you used the equations above plugging in v, and solving for successive values until you got i. Is that correct?

Did you use Newton's method or a brute force iteration, Mathmatica, or what?

Just curious.

Thanks again!!!

1573384564085.png
 
Last edited:
What is "PII"?
"Personally Identifiable Information". It's a term that's use a lot these days with all the data leaks that happen at companies (over 1,000,000,000 records with Yahoo being the worst or the best-- with the most leaked data -- depending you look at it...).

Here's a listing of the top data leak offenders from a publicly-available database (this data is a month or two old):

1573392895996.png
 
Last edited:
Here are the two functions for Newton's method in general form. Once v is determined, we walk backwards (thank you for that!) using the formula "Trail" shown above to get i.

Function: LoanAmt - Payment * (( v ^ 3 - v ^ 53 ) / ( 1 - v ^2 )) + ResidualPmt * v ^ 53 = 0

Derivative (a mess): LoanAmt- ( ( 3 v^2 - 53 v^52 )(1 - v^2)-( v^3 - v^53 )-( -2v )/( 1-v^2 ) ^ 2 ) + 53 * ResidualPmt * v ^52 = 0


I think this is correct, but if anyone sees any problem, let me know.

I truly appreciate the excellent help given here.

Simply excellent! 8-)

Thanks very very much.

-Oliver
 
Cool!!!

What do you mean by "building a cash flow map"? What exactly did you do to do that?

It seems the equation is suitable to a computer implementation. All the numbers make sense except for the 88.95. I don't see how you calculated that. I'm assuming it's not a formula constant.

I think what you did to solve this was that you solved for v using Newton's method (or similar), then you used the equations above plugging in v, and solving for successive values until you got i. Is that correct?

Did you use Newton's method or a brute force iteration, Mathmatica, or what?

Just curious.

Thanks again!!!

View attachment 14568
I see you have discovered that 2995 was given, 88.95 was given, 125 was given, 53 was given. The only thing not given in the equation is [math]v[/math]. The equation is to be solve for [math]v[/math]. After that, you can calculate [math]i[/math] directly.

The Cash Flow map is just a picture of when money moves. Typically, with a loan, money moves one direction at Time = 0 (loan originaltion), and back the other direction at various times according to the terms of the loan. In your first example, using "1 Week" as the unit of time, the first payment was Time = 3. After that, increase every payment by two weeks.

Last time I wrote an iterative solve routine for use by humans, I did not use Newton's Method. That problem had multiple variables that required simultaneous solution. With only one variable, I may have considered Newton. If you rewrite a little:

[math]2995.00 = 125\cdot v\cdot\dfrac{v^{2} - v^{52}}{1-v^{2}} + 88.95\cdot v\cdot v^{52}[/math], it might be easier to find [math]v^{2}[/math]. You should have multiple tools in your basket. It is quite unusual for one method to work for everything. That's probably a big reason why other methods were invented. It certainly helps to know up front that your result is unique.
 
Thanks. I appreciate your replies. In my experience, using a brute-force iterative method is highly inefficient. The good: Newton's will converge quickly. The bad: it's a pain to implement in code.

Thanks again!
 
Thanks. I appreciate your replies. In my experience, using a brute-force iterative method is highly inefficient. The good: Newton's will converge quickly. The bad: it's a pain to implement in code.

Thanks again!
If you can use Excel - it has a "goal seek" function that uses Newton's method in the back-ground.
 
Thanks. I appreciate your replies. In my experience, using a brute-force iterative method is highly inefficient. The good: Newton's will converge quickly. The bad: it's a pain to implement in code.

Thanks again!
Well, then your experience is limited. Keep your mind open.
 
Actually, my 20+ years experience says to rarely use a brute-force approach.

Donald Knuth would be unhappy with your reply. LOL.

In any case, if you have the output for your approach, I would like to see it.

Thanks
 
Actually, my 20+ years experience says to rarely use a brute-force approach.

Donald Knuth would be unhappy with your reply. LOL.

In any case, if you have the output for your approach, I would like to see it.

Thanks
That's the point. I don't have an approach.

Each problem type must be considered on its own merits, keeping in mind all possible solution types and exploitable efficiencies.

"Brute Force" is not well-defined. One person's Brute Force may be another's Elegant Solution.
 
Top