Bitcoin Forum
July 21, 2017, 02:58:48 PM
 News: The warning which may be displayed by Bitcoin Core about unknown versions is related to BIP91, and can be safely ignored.
 Home Help Search Donate Login Register
 Pages: [1] 2  All
 Author Topic: Bitcoin loan payment formula (WARNING: MATHS AHEAD!) [FORMULAS FIXED]  (Read 3924 times)
Rassah
Legendary

Offline

Activity: 1680

Director of Bitcoin100

 July 14, 2011, 04:52:27 PM

EDIT: Using Tables for formulas butchered them due to text reflow, so converted formulas to images

Could someone with the financial and algebraic know-how please check my numbers? I don't know if I'm getting rounding errors, or if I'm not calculating this correctly:

The payment of annuity formula is:

Where:
Pmt  = payment amount
Prin = Initial borrowed ammount
i = interest rate
n = number of terms in the loan.

So for those who need an example read below. If you're familiar with this, skip to the My Proposal section below.

Explanation/Example
Let's say it's a \$10,000 loan, 5% rate, 10 year term, payable once a year. Formula would look like:

Meaning that to pay off a \$10,000, 5% loan over 10 pay periods (years), if you pay \$1,295.05 every pay period, your loan balance will be \$0 after the 10th payment (plus or minus rounding errors).
A VERY important aspect of this loan is that in an inflationary economy, the 10th payment of \$1,295.05 is actually worth a lot less than the 1st payment. If we assume a 3% annual inflation, the 1st \$1,295.05 payment at the end of the year is actually worth \$1,295.05*(1+3%)^-1 = \$1,257.33 in today's dollars, and the 10th payment is actually worth \$1,295.05*(1+3%)^-10 = \$963.64 in today's dollars (meaning at year 10, paying that \$1,295.05 will feel like paying only \$963.64 today). The idea is that the loan becomes easier to pay off as time goes on.
The big problem arises when the loan is given out in an deflationary currency, such as (future) Bitcoin. If we use that same level-payment annuity formula from above, but assume that instead of a 3% INflation, we have a 3% DEflation (i.e. -3% instead of +3%), the 1st payment will feel like \$1,295.05*(1-3%)^-1 = \$1,335.10, and the 10th payment will feel like \$1,295.05*(1-3%)^-10 = \$1,756.18. That's a bit worse than \$1,295.05, and MUCH WORSE than \$963.64. Now imagine stretching this out to 30 years, instead of 10, and the problem will be even worse! Now, sure, this will discourage borrowing, but from a lender's point of view, this will also SIGNIFICANTLY increase risks of default as time goes by, since people will have a much harder time making loan payments as their loan matures.

My Proposal/Calculations

I propose that the formula be augmented as such:

Where:
t = period at which the payment is calculated (t is 1 to n)
n = number of terms in the loan
Pmtt = payment amount for term t
Print = Outstanding principal at term t
i = interest rate of the loan
d = deflation rate

The first part is the annuity formula, the second part (after the *) is time value adjustment to present value using the 3% deflation rate.

So, as an example, using the loan above and assuming a 3% deflation, the calculation for the 1st payment will look like this:

After this payment, the outstanding principle is now \$10,000*(1+5%)*(1+3%) - \$1,740.43 = \$9,074.57

Calculation for the 2nd payment will look like:

This will continue until the very last 10th payment, which will look like:

which will pay off the remaining outstanding principal, bringing the loan to \$0

The excel table for this looks like this:

.   Outstanding      Int         Prin            Pmt            Remain
1    \$10,815.00    \$800.00     \$940.43     \$1,740.43    \$9,074.57
2    \$9,814.14     \$725.97     \$939.84     \$1,665.81     \$8,148.34
3    \$8,812.43     \$651.87     \$945.18     \$1,597.05     \$7,215.38
4    \$7,803.43     \$577.23     \$956.37     \$1,533.60     \$6,269.83
5    \$6,780.82     \$501.59     \$973.39     \$1,474.97     \$5,305.85
6    \$5,738.27     \$424.47     \$996.24     \$1,420.71     \$4,317.56
7    \$4,669.44     \$345.41     \$1,025.02   \$1,370.42     \$3,299.02
8    \$3,567.89     \$263.92     \$1,059.84   \$1,323.76     \$2,244.13
9    \$2,427.03     \$179.53     \$1,100.87   \$1,280.40     \$1,146.62
10   \$1,240.07     \$91.73     \$1,148.34   \$1,240.07     \$-

Where Outstanding is previous Remain*(1+5%)*(1+3%),  Pmt is my formula, and Remain = Outstanding - Pmt

Problems/Issues/Things I need help with

As you can see, this will calculate the payment structure that will front-load the first payment, and possibly make the last payment a lot more bearable (though still more difficult than in an inflationary system). If you run separate calculations, you'll also see that the lender is able to get both, the interest, and the deflation effect, from the lent money (i.e. the return is the same whether the lender lends the money, or sits on it and has it "magically" collect 5% interest).

These are the problems I still see with this, or need help with:

1) This system calculates the accumulated interest on each outstanding principle as Prin * (1+i) * (1+d). Intuitively, I would think that 5% + 3% = 8%, and so I should just use Prin*(1+i+d), but when I do that, the last payment ends up overpaying, with the remaining outstanding balance at year 10 being -\$1.69. Is my formula wrong somewhere, or is this a rounding error? I think either my formula is wrong, or the Prin*(1+i+d) assumption is wrong.

2) Having a recursive formula that depends on each previous calculation to work is annoying, to say the least. The original annuity formula is much cleaner and nicer by comparison. If anyone out there is good with algebraic simplifications and such, maybe you can help fixing/simplifying this thing?

3) The final payment, although lower, is still a tad higher than it would be in an inflationary system with level payments using today's dollars, though not by much. If anyone has a better suggestion than this formula/system, please share!

1500649128
Hero Member

Offline

Posts: 1500649128

Ignore
 1500649128

1500649128
 Report to moderator
1500649128
Hero Member

Offline

Posts: 1500649128

Ignore
 1500649128

1500649128
 Report to moderator
1500649128
Hero Member

Offline

Posts: 1500649128

Ignore
 1500649128

1500649128
 Report to moderator
 Hash Rush - the first web game backed by cryptocurrency mining! JOIN THE PRE-ICO
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1500649128
Hero Member

Offline

Posts: 1500649128

Ignore
 1500649128

1500649128
 Report to moderator
Leon
Newbie

Offline

Activity: 14

 July 14, 2011, 08:55:17 PM

I think my mind just sploded!!!

Opening a webhost soon. Free for the first 5 orders!
http://img593.imageshack.us/img593/7034/iluvbitcoin.png
Rassah
Legendary

Offline

Activity: 1680

Director of Bitcoin100

 July 14, 2011, 09:03:37 PM

I think my mind just sploded!!!

LOL! Sorry, college level finance crap here. I'm hoping there are others with understanding who can help.

Rassah
Legendary

Offline

Activity: 1680

Director of Bitcoin100

 July 14, 2011, 09:38:37 PM

Formulas fixed. Anyone here know what I'm talking about? Or are the finance/econ types just the armchair finance-econ types?

2112
Legendary

Offline

Activity: 1918

 July 15, 2011, 05:35:22 AM

How about you start with balancing the parentheses correctly in your formulas? Each and every one of them is missing at least one parenthesis.

Please comment, critique, criticize or ridicule BIP 2112: https://bitcointalk.org/index.php?topic=54382.0
Long-term mining prognosis: https://bitcointalk.org/index.php?topic=91101.0
GeniuSxBoY
Hero Member

Offline

Activity: 602

 July 15, 2011, 06:35:33 AM

I don't understand the question.

It's as simple as switching \$ to ฿

 PRIMEDICE .   The Premier Bitcoin Gambling Experience  Most Trusted & Popular | Active Chat & Community | Free BTC Faucet | 1% Edge
Aristotle
Jr. Member

Offline

Activity: 56

 July 15, 2011, 07:46:11 AM

Inflation isn't explicitly used in the normal annuity formula now, so why use it in one for Bitcoin?

Also, Bitcoin isn't, and never will be monetarily deflationary in any real sense.  There will probably be a lot of price deflation, but you cannot predict the value of price deflation.  The simplest solution would be just negative interest rate loans if price deflation is high.  Perhaps a better solution would be adjustable rate loans pegged to something that's not volatile like the USD.  I.e. just use the regular payment annuity formula, calculate what the market value of the payments would be in USD when the loan terms are outlined, then when payment time comes along the bill should be x bitcoins based on the market value at that time.

If you're one of the crazy people that don't think that traditional fiat will be around for long, then a consumer-price index can be used for variable-rate loans

Brother, can you spare a Bitcoin? 18Xe5KqJhmgw5cTjosek2YwnqzG6tDWKNU
Meni Rosenfeld
Donator
Legendary

Offline

Activity: 1988

 July 15, 2011, 08:09:52 AM

I don't know the standard terminology for this, so I'll specify my modeling assumptions explicitly.

Let's say you borrow a principal of P=\$10K at the end of year 0 at interest i=5%. You are expected to return it at the end of year n=10. Your first payment is at the end of year 1. You pay an interest of 5%*\$10K=\$500 and some principal, say \$1000, for a total of \$1500. However, because of d=3% deflation, it feels like paying \$1545 would feel at end of year 0. You now have \$9000 principal left, so at end of year 2 you pay 5%*\$9K=\$450 interest, and say \$1000 principal again, for a total of \$1450 which feels like \$1450*1.03^2=\$1538.3. And so on.

What we are looking for is a payment scheme that ensures every payment feels the same. So let's call this feeling-equivalent x, we are looking for the x which makes the principal owed 0 after n years.

For an equivalent of x at the end of year k, the actual payment is x*(1+d)^(-k). So for the principal at the end of year k you have P_k = P_{k-1}(1+i) - x*(1+d)^(-k). Denoting R = (1+i)(1+d), this has general solution P_k = A(1+i)^k + [x(1+d)^(-k)]/(R-1). Because P_n=0 we have A = (-xR^(-n))/(R-1) and hence P_k = x * [(1+d)^(-k)-(1+i)^kR^(-n)]/(R-1). Letting k=0 gives us x = P_0*(R-1)/(1-R^(-n)), and so the actual payment at end of year k is P_0*[(R-1)/(1-R^(-n))]*(1+d)^(-k).

I don't currently have access to my CAS so you'll have to verify these calculations. But the fact that for d=0 you have R=1+i and this reduces to the original formula is encouraging.

1) 5% + 3% = 8% is probably the wrong intuition. If you have 50% interest per year, then the interest in two years will be 125% = (1+50%)(1+50%)-1, not 100%=50%+50%. The same probably happens when you combine the interest with deflation. They are combined multiplicatively, not additively, and you'll notice that R=(1+i)(1+d) plays a key role in my above calculation.

2) Check.

3) My formula gives an equal feeling-equivalent for every payment, and the derivation should be easy to modify for any desired increase or decrease in the equivalents.

About the philosophical issues, how much a payment feels is proportional to the person's salary, not its purchasing power. I expect that in a stable Bitcoin economy, salaries will remain more or less fixed in numerical value while their purchasing power will increase. So d would be 0 for Bitcoin.

1EofoZNBhWQ3kxfKnvWkhtMns4AivZArhr   |   Who am I?   |   bitcoin-otc WoT
Bitcoil - Exchange bitcoins for ILS (thread)   |   Israel Bitcoin community homepage (thread)
Analysis of Bitcoin Pooled Mining Reward Systems (thread, summary)  |   PureMining - Infinite-term, deterministic mining bond
patvarilly
Jr. Member

Offline

Activity: 42

 July 15, 2011, 10:08:29 AM

The simplest solution would be just negative interest rate loans if price deflation is high.

Why would you ever extend a negative interest loan to anyone instead of holding on to the principal at zero risk?  At the end of the purported loan period, you'd have more money if you hadn't made the loan in the first place that if you did.  You'd be crazy (or altruistic/charitable) to make the loan.
whenhowwho
Member

Offline

Activity: 96

 July 15, 2011, 10:23:01 AM

Loans are bad. Loans are 99.999999% of the reason why fiat currency is not a desirable unit of exchange. Do not attempt to add loans and interest to bitcoins as it will destroy them.

1HUy7T9SyNLTJCVX3p8KzftApYdWgcsRqD
hugolp
Hero Member

Offline

Activity: 742

 July 15, 2011, 10:30:10 AM

I have not read the whole thing yet, just made it to the middle, but you can not expect people to demand the same interest rate in a inflationary monetary system than in a non-inflationary monetary system. The premium for inflation is always considered when given a loan. For example, a 6% loan with a 3% price inflation rate, has a real interest rate of 3%. Thus in a price deflationary system, f.e. -1% price inflation, a real interest rate of 3% is a 2% interest rate. In both cases the burden to return the loan is the same.

You can not seriously expect someone to demand the same interest rate in a price inflationary environment than in a price deflationary one.

EDIT: Ended reading it. You are now appliying the price deflation rate to the loan. I dont know if you realize that you should also aply the price inflation rate to calculate the difference between the two loans.
Rassah
Legendary

Offline

Activity: 1680

Director of Bitcoin100

 July 15, 2011, 02:55:24 PM

Inflation isn't explicitly used in the normal annuity formula now, so why use it in one for Bitcoin?

As mentioned, that formula assumes it. It was created recently. And with deflation, even a low one, the increasing burden of payments can be a serious problem.

Perhaps a better solution would be adjustable rate loans pegged to something that's not volatile like the USD.  I.e. just use the regular payment annuity formula, calculate what the market value of the payments would be in USD when the loan terms are outlined, then when payment time comes along the bill should be x bitcoins based on the market value at that time.

Since you're still using an exchange rate between currencies, you'll still have a deflationary loan. You'll have to pay back way more USD at the end of the loan than way more BTC. Unless the loan is given out in BTC, and the payments are all based on USD, in which case the loan is a money loser for the lender (same as negative interest basically)

Rassah
Legendary

Offline

Activity: 1680

Director of Bitcoin100

 July 15, 2011, 03:01:40 PM

EDIT: Ended reading it. You are now appliying the price deflation rate to the loan. I dont know if you realize that you should also aply the price inflation rate to calculate the difference between the two loans.

Could you elaborate please? Price inflation to two loans?

carbonc
Member

Offline

Activity: 104

 July 15, 2011, 03:51:57 PM

None of this really matters because nobody can truly enforce the loan contractually.

There are no laws stating that I would be required to pay the loan back since it was not in dollars or pesos or euros...

Besides...
If I borrowed a single bitcoin from you today and paid you .1 BTC at the end of the year.
I could theoretically end it at that because the future value of that .1 BTC would be more than enough to pay you back for the past value of the 1BTC I borrowed in 5 years.
Rassah
Legendary

Offline

Activity: 1680

Director of Bitcoin100

 July 15, 2011, 03:59:13 PM

None of this really matters because nobody can truly enforce the loan contractually.

There are no laws stating that I would be required to pay the loan back since it was not in dollars or pesos or euros...

Besides...
If I borrowed a single bitcoin from you today and paid you .1 BTC at the end of the year.
I could theoretically end it at that because the future value of that .1 BTC would be more than enough to pay you back for the past value of the 1BTC I borrowed in 5 years.

1) There are no laws that require you to pay back in dollars or pesos or euros.
2) The laws are for contracts. We can have a contract that requires you to pay me back in twinkie bars, and if you don't, I can take you to court.
3) You could chose to ignore the contract, and I could chose to let the loan go, but your reputation as a borrower would suffer (credit score, or GPG Web of Trust rating, or whatever)
4) If the contract says you have to pay me back 1BTC, you have to pay me back 1BTC. If we both knew that the value would increase, hopefully you would either know you'll be able to take the loan, I knew that I could trust you to pay the loan back, or you wouldn't want the loan due to high repayment amount. Since why should I lend you 1BTC and get back 0.1BTC, when I can just sit on my 1BTC and have 1BTC at the end of the year?

Even without government, contracts and reputation matter. I suspect they'll be even more important in the near future, where business will be more and more trans-national.

Rassah
Legendary

Offline

Activity: 1680

Director of Bitcoin100

 July 15, 2011, 08:32:44 PM

I don't know the standard terminology for this, so I'll specify my modeling assumptions explicitly.

Let's say you borrow a principal of P=\$10K at the end of year 0 at interest i=5%. You are expected to return it at the end of year n=10. Your first payment is at the end of year 1. You pay an interest of 5%*\$10K=\$500 and some principal, say \$1000, for a total of \$1500. However, because of d=3% deflation, it feels like paying \$1545 would feel at end of year 0. You now have \$9000 principal left, so at end of year 2 you pay 5%*\$9K=\$450 interest, and say \$1000 principal again, for a total of \$1450 which feels like \$1450*1.03^2=\$1538.3. And so on.

What we are looking for is a payment scheme that ensures every payment feels the same. So let's call this feeling-equivalent x, we are looking for the x which makes the principal owed 0 after n years.

For an equivalent of x at the end of year k, the actual payment is x*(1+d)^(-k). So for the principal at the end of year k you have P_k = P_{k-1}(1+i) - x*(1+d)^(-k). Denoting R = (1+i)(1+d), this has general solution P_k = A(1+i)^k + [x(1+d)^(-k)]/(R-1). Because P_n=0 we have A = (-xR^(-n))/(R-1) and hence P_k = x * [(1+d)^(-k)-(1+i)^kR^(-n)]/(R-1). Letting k=0 gives us x = P_0*(R-1)/(1-R^(-n)), and so the actual payment at end of year k is P_0*[(R-1)/(1-R^(-n))]*(1+d)^(-k).

I don't currently have access to my CAS so you'll have to verify these calculations. But the fact that for d=0 you have R=1+i and this reduces to the original formula is encouraging.

1) 5% + 3% = 8% is probably the wrong intuition. If you have 50% interest per year, then the interest in two years will be 125% = (1+50%)(1+50%)-1, not 100%=50%+50%. The same probably happens when you combine the interest with deflation. They are combined multiplicatively, not additively, and you'll notice that R=(1+i)(1+d) plays a key role in my above calculation.

2) Check.

3) My formula gives an equal feeling-equivalent for every payment, and the derivation should be easy to modify for any desired increase or decrease in the equivalents.

About the philosophical issues, how much a payment feels is proportional to the person's salary, not its purchasing power. I expect that in a stable Bitcoin economy, salaries will remain more or less fixed in numerical value while their purchasing power will increase. So d would be 0 for Bitcoin.

First of all, thank you for explaining how to do the algebra for this. Gave me A LOT of fun work

Second, tested this out with numbers on a spreadsheet, and they didn't work. Used WolframAlpha.com to run the algebra.

R = (1+i)(1+d) was not quite right, since the formula comes out looking like this:

I ran the whole calculation thing through, but was still getting slightly increasing monthly payments, though at least increase was constant.

Something about the x*(1+d)^(-k) formula didn't seem right, either. After a while and a lot of wrangling and testing the algebra, I figured out that, due to this step calculating deflation, it should be -d, and to push the x value into the future instead of the present, the k should be positive. Final formula for that is

After running all of this through WolframAlpha.com, the final formula I got was this:

P: original loan amount
d: deflation rate
i: loan interest rate
n: term length of loan
k: current pay period payment is being calculated for

In copyable plaintext format, the formula is
((1-d)^k P(d+i))/((d-1) (-1+(1+i)^(-n) (1-d)^n))

I plugged it into Excel and ran the numbers. Pays off at \$0.00, and each month's payment is level when adjusted for inflation (using = Pmt*(1-d)^-k method)

The sad thing is, that is NOT a very pretty formula. But at least it works.
So, THANK YOU!

hugolp
Hero Member

Offline

Activity: 742

 July 15, 2011, 09:58:34 PM

EDIT: Ended reading it. You are now appliying the price deflation rate to the loan. I dont know if you realize that you should also aply the price inflation rate to calculate the difference between the two loans.

Could you elaborate please? Price inflation to two loans?

If you are comparing the real interest rate on the loans you have to apply the price inflation/deflation in both loans, not only in one.
Rassah
Legendary

Offline

Activity: 1680

Director of Bitcoin100

 July 16, 2011, 12:13:14 AM

EDIT: Ended reading it. You are now appliying the price deflation rate to the loan. I dont know if you realize that you should also aply the price inflation rate to calculate the difference between the two loans.

Could you elaborate please? Price inflation to two loans?

If you are comparing the real interest rate on the loans you have to apply the price inflation/deflation in both loans, not only in one.

Ah, yeah. Was thinking about that, but sadly, just bumping up the interest in the inflationary calculation by the deflation rate didn't help reduce the monthly payment value.

kwhcoin
Jr. Member

Offline

Activity: 42

 July 16, 2011, 04:04:31 AM

I get weird numbers. Can you provide an Open Document Spreadsheet with an example?

I did the calculation with some real numbers and included the output of an excel spreadsheet.

P: original loan amount (i.e. \$10000)
d: deflation rate (i.e. 3%)
D = 1-d (i.e. 0.97)
i: loan interest rate (i.e. 5%)
I = 1+i (i.e. 1.05)
n: term length of loan (i.e. 10)
k: current pay period payment is being calculated for

Here is a general formula for the k'th payment amount.

payment[k] = P*I*(1-D/I)/(1-(D/I)^n)*D^(k-1)

Here is the first payment using the numbers:
Payment[1] = 10500*(1-0.97/1.05)/(1-(0.97/1.05)^10) = \$1,461.76

Here is what it looks like in excel.
Note: Outstanding is 1.05 times the remaining principle. The Payment is per the formula above, and the Remain is the Outstanding minus the Payment.

k     Outstanding   Payment       Remain
1     \$10,500.00    \$1,461.76     \$9,038.24
2     \$9,490.15     \$1,417.91     \$8,072.25
3     \$8,475.86     \$1,375.37     \$7,100.49
4     \$7,455.51     \$1,334.11     \$6,121.40
5     \$6,427.47     \$1,294.09     \$5,133.39
6     \$5,390.06     \$1,255.26     \$4,134.79
7     \$4,341.53     \$1,217.60     \$3,123.93
8     \$3,280.13     \$1,181.08     \$2,099.05
9     \$2,204.00     \$1,145.64     \$1,058.36
10   \$1,111.28     \$1,111.28     \$0.00

As required, each payment is 3% less than the previous payment and the balance is paid in full.

I found the following URL helpful in understanding the formulas:
http://www.mathpages.com/home/kmath297.htm
(Note: In the mathpages' URL they talk about inflation instead of deflation so their "I" is my "D" and my "I" is their "Y". I just picked "I" and "D" to correspond to the "i" and "d" already being used in this thread.)
Rassah
Legendary

Offline

Activity: 1680

Director of Bitcoin100

 July 16, 2011, 05:46:50 AM

I get weird numbers. Can you provide an Open Document Spreadsheet with an example?

I did the calculation with some real numbers and included the output of an excel spreadsheet.

Yep, I get the same numbers.
The only thing that still concerns me though is that the lender needs to get (1+i)*(1+d) return on his investment, yet this calculates each k outstanding balance to be paid off as just Bal*(1+i)...

 Pages: [1] 2  All