CrystalMath
CrystalMath
  • Threads: 8
  • Posts: 1911
Joined: May 10, 2011
September 11th, 2014 at 10:35:12 AM permalink
It seems that there are some problems, possibly introduced in this last revision. The investment balance calculations are off, not even including inflation adjustments. If the rate of investment return is greater than the 15 and 30 year interest rates, then you should end up with a higher investment balance with the 30 year loan, given that the 30 year rate is higher than the 15 year rate.
I heart Crystal Math.
MichaelBluejay
MichaelBluejay
  • Threads: 81
  • Posts: 1618
Joined: Sep 17, 2010
September 11th, 2014 at 10:57:09 AM permalink
Note #2 mentions that the amounts reported for investments have been reduced by the tax you'd pay on the sale. Does that account for the discrepancy you found?
Presidential Election polls and odds: https://2605.me/p
CrystalMath
CrystalMath
  • Threads: 8
  • Posts: 1911
Joined: May 10, 2011
September 11th, 2014 at 11:47:39 AM permalink
I found the error here:


tCashInvested15+=cashInv15/RDrate;
intEarned15+=tCashInvested15*ror/RDrate;
investBalance15=tCashInvested15+intEarned15;


Interest earned is only being calculated on the cash invested, not on the compounded balance.

I would do something like:


tCashInvested15+=cashInv15/RDrate;
investBalance15+=cashInv15/RDrate;
intEarned15+=investBalance15*ror/RDrate;
investBalance15+=investBalance15*ror/RDrate;
I heart Crystal Math.
MichaelBluejay
MichaelBluejay
  • Threads: 81
  • Posts: 1618
Joined: Sep 17, 2010
September 16th, 2014 at 8:45:43 AM permalink
Thank you as usual for your continued help.

I just removed the tCashInvested variable. I was using it to track the total cash invested, so I could adjust it for inflation later, but that seems unnecessary. My current code is this:

intEarned15 = cashInv15 * ror /RDrate; // cashInv has already been adjusted for inflation.  So the interest it earns is already adj.
intEarned15+= investBalance15 * ror /RDrate; // Add the interest earned on the balance, and adjust it for the inflation rate.
investBalance15 += cashInv15 + intEarned15; // Since I pre-adjusted the $ invested and int. earned, no further adj. should be necessary.


That seems to work okay for the normal version, but the real-dollars version still appears to be way off. Take the figures in the "Invest. Balance" column: I look at the values it gives for non-adjusted and RD-adjusted, then I take the non-adjusted values and calculate the adjusted values by hand (with a spreadsheet), but the hand-adjusted values don't match the calculator-adjusted values. But as I showed in my code notes above, I thought I accounted for everything -- though clearly I didn't.

That suggests a solution: behind the scenes I calculate everything non-adjusted, and then I just adjust the "Invest. Balance" for the purposes of reporting it. While that should work, that bypasses my inflation-adjusted input, and I want to make sure the input is good, because I might be reporting the input wrong.

I hope this makes sense.
Presidential Election polls and odds: https://2605.me/p
  • Jump to: