Pages:
Author

Topic: Bitcoin loan payment formula (WARNING: MATHS AHEAD!) [FORMULAS FIXED] (Read 4253 times)

donator
Activity: 2058
Merit: 1054
...
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
...
In copyable plaintext format, the formula is
((1-d)^k P(d+i))/((d-1) (-1+(1+i)^(-n) (1-d)^n))
...
The sad thing is, that is NOT a very pretty formula. But at least it works.
My derivation, as I explained, is based on the assumption that $1 at year 1 is equivalent to $(1+d) at year 0. It looks like you wanted that $1 at year 0 is equivalent to $(1-d) at year 1. So, let R = (1+i)/(1-d), and use the formula P_0*[(R-1)/(1-R^(-n))]*(1-d)^k.

It shouldn't matter too much, because 1/(1-d) = 1 + d + O(d^2).
sr. member
Activity: 280
Merit: 250
You lost me at unbalanced parenthises
legendary
Activity: 1680
Merit: 1035

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)...

In your example, the loan interest rate is 5% so the lender only needs to get 5% interest on the balance. It may end up "feeling" closer to 8% interest with respect to purchasing power (i.e. 5% interest plus 3% deflation), but the loan interest rate does not include deflation just like a typical 5% loan from a bank in dollars with 3% inflation is still just a loan for 5% even though the inflation makes it feel more like 2% with respect to purchasing power.

*facepalm* Of course. Deflation growth comes from holding the cash, not from the borrower paying it directly.
newbie
Activity: 42
Merit: 0

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)...

In your example, the loan interest rate is 5% so the lender only needs to get 5% interest on the balance. It may end up "feeling" closer to 8% interest with respect to purchasing power (i.e. 5% interest plus 3% deflation), but the loan interest rate does not include deflation just like a typical 5% loan from a bank in dollars with 3% inflation is still just a loan for 5% even though the inflation makes it feel more like 2% with respect to purchasing power.
legendary
Activity: 1680
Merit: 1035

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)...
newbie
Activity: 42
Merit: 0

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.)
legendary
Activity: 1680
Merit: 1035
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.
legendary
Activity: 1148
Merit: 1001
Radix-The Decentralized Finance Protocol
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.
legendary
Activity: 1680
Merit: 1035
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.

Now for your questions:

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 Smiley

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:


(f(k) is your P_k, and c1 is your A)

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!
legendary
Activity: 1680
Merit: 1035
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.
member
Activity: 126
Merit: 60
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.
legendary
Activity: 1680
Merit: 1035
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?
legendary
Activity: 1680
Merit: 1035
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)
legendary
Activity: 1148
Merit: 1001
Radix-The Decentralized Finance Protocol
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.
member
Activity: 96
Merit: 10
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.
newbie
Activity: 42
Merit: 0
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.
donator
Activity: 2058
Merit: 1054
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.

Now for your questions:

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.
newbie
Activity: 56
Merit: 0
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 Smiley
hero member
Activity: 616
Merit: 500
I don't understand the question.


It's as simple as switching $ to ฿
legendary
Activity: 2128
Merit: 1073
How about you start with balancing the parentheses correctly in your formulas? Each and every one of them is missing at least one parenthesis.
Pages:
Jump to: