HP Forums
(12C) Financial Management Rate of Return - FMRR - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (12C) Financial Management Rate of Return - FMRR (/thread-13155.html)



(12C) Financial Management Rate of Return - FMRR - Joe_H - 06-20-2019 05:22 PM

I went through a program I wrote some days ago to calculate the Modified IRR of a proposed investment cashflow (https://www.hpmuseum.org/forum/thread-13133.html?highlight=%2812c%29). This is seen as an improvement on standard IRR as the investment returns are not compounded at the rate of return of the investment itself but rather a more normal rate of return that the company normally makes (i.e. IRR is often too optimistic). A 'criticism' of MIRR is that the investment outflows in the future (i.e. negative net cashflows in the CF sequence) get discounted back to the present whereas it is argued they really should be funded by intermediate positive cashflows in the sequence. This means they shouldn't be discounted back to the present but only as far back as the next positive cashflow. This is called the Financial Management Rate of Return (FMRR) and is used in the finance industry, particularly in real estate for some reason. The only financial desktop calculator model that calculates it, that I know of, is the HP-30b of which I am a proud owner since around 2011. The TI BAII+ Professional doesn't calculate it and no other one I can find, so it appears it isn't available in any current models. So, enter the 1981 HP-12C which will out perform the rest of the currently available financial models on the market!

Given the difficulty I had with stackrobatics in the MIRR program, I knew that this more complex algorithm was unlikely to be do-able without use of R registers (most are used in the CF itself). Like the MIRR program, the R0-R6 are the CF and I used R7&8 for the interest variables. That gives me 85 steps to get it all done.

Code:

// Financial Management Rate of Return (FMRR) for HP-12C - written by Joe Henry, Dublin - June 2019
// TVM registers are n = {set by CF entry}, [i] = safe/WACC rate i%, PV = 0, PMT = Re-investment rate i*%, FV = 0
// X has the total number of cashflow periods N (different from n if any Nj's > 1)
// R0-R6 are used to store the cashflow series; R7=1.i; R8=1.i*; R9-R.9=used for program


01 RCL PMT
02 EEX
03 2
04 /
05 1
06 +
07 STO 8                // 1.i* 
09 STO PMT        // Store N here it will be used as N-N'
10 RCL i
11 EEX
12 2
13 /
14 1
15 +
16 STO 7        // 1.i
17 0
18 STO i        // Set N' to 0
19 STO PV        // Set PV & FV accumulators to 0
20 STO FV        // nothing on stack for start of loop
21 RCL g Nj        // ::5 - ***** Start of main outer loop ******
22 RCL g CFj    
23 RCL PV        // ::2 - ****** Start of inner loop ****** stack: PV, CFj, Nj
24 X/Y                // swap PV & CFj
25 +                // Add this year's CFj to accumulated PV (new var called PV') 
26 STO PV              // temporary storage of PV' to re-arrange stack
27 g LSTx            // !!! this overwrites PV in X stack: CFj, Nj
28 X/Y
29 RCL PV            // stack: PV',Nj, CFj,- 
30 0                // if PV' is 0 or positive
31 x<=y?
32 g GTO 43         // goto ::1 - positive PV' [1]
33 Rv                    // negative PV' - remove 0; stack: PV', Nj, CFj
34 RCL PMT                // recall N-N' to check if zero
35 x=0?
36 g GTO 41                // goto ::6 N-N'=0 so don't discount [2]
37 Rv                    // discounting here as N>0
38 RCL 7                // recover 1.i and discount it 1 period
39 /
40 0                    // Padding so PV' ends at top of stack after Rv below 
41 Rv                    // ::6 if N-N'=0 come to here
42 g GTO 54                // goto ::2 - common section to + & -    [3]    
43 Rv                // ::1 - Start of positive PV' stack after this exec: PV', Nj, CFj, 0            
44 STO PV                // temporary storage of PV' in [PV]
45 RCL 8                // 1.i*  !!! this overwrites PV in X
46 RCL i                // N' stack: N', 1.i*, Nj, CFj
47 y^x                    // Future value factor for N' periods
48 RCL PV                // get PV' back on stack: PV', factor, Nj, CFj
49 *                    // Get future value of this year's cashflow PV'*factor (call it FV')
50 RCL FV                // Add FV' to FV accumulator
51 +
52 STO FV                // last part of specific positive loop stack: FV, Nj, CFj
53 0                    // reset PV to zero stack: 0, FV, Nj, CFj
54 STO PV            // :: 2 - Common inner loop section stack: PV' or FV', Nj, CFj        
55 RCL i                // Recall N'  !!! N' over writes FV'/PV' in X
56 1                    // Increase N' by 1 and store
57 +
58 STO i
59 RCL PMT                // Reduce N-N' by 1 and store
60 1
61 -
62 STO PMT
63 1                    // Reduce Nj by 1 and check if 0  !!! this over writes the N in X 
64 -
65 x=0?
66 g GTO 69                // goto ::3 - Nj=0 then go to outer loop [4]
67 X/Y                    // set up stack: CFj, Nj-1
68 g GTO 23            // goto ::2 - start inner loop  [5]
69 RCL n        // ::3 - end of outer loop starts here
70 1
71 CHS
72 X/Y
73 x<=y?        // if n=-1 then at end of cashflow
74 g GTO 76        // goto ::4 - carry out the final stages with PV, FV and N [6]
75 g GTO 21        // goto ::5 - back to start of outer loop        [7]
76 RCL i        // ::4 - n=-1, i=N+1, PV-ok, pmt=-1, FV-ok
77 1            // N' is N + 1
78 -
79 STO n        // Place N into [n]
80 0
81 STO PMT        // payment needs to be 0 but is -1
82 i            // Calculate i for the N,PV,0,FV and store in [i]

I'll put some results in the next post.


RE: (12C) Financial Management Rate of Return - Joe_H - 06-20-2019 06:04 PM

Running this on the cashflow used for MIRR:

CF0 -€105,222
CF1 +€8,792
CF2 +€9,700
CF3 +€10,480
CF4 -€2,472
CF5 +€12,093
CF6 +€182,188

with i=i*=10%

IRR calculated as 15.0% and MIRR as 14.25% & FMRR now as 14.31%. Trying now on a significantly longer and more complex cashflow:

CF0 -€25,000 * 1
CF1 +€10,000 * 1
CF2 -€7,000 * 1
CF3 +€5,000 * 8
CF4 -€4,000 * 12
CF5 +€35,000 * 2
CF6 +€29,000 * 2

Safe rate i=3.75%; re-investment rate i*=8.35%; N=26

IRR = 11.08%; MIRR = 7.87%; and finally........FMRR = 8.47%.

I have checked these results against the HP-30b and also Excel for some simpler ones. It's surprisingly hard to do right in Excel and I kept making mistakes Sad

The HP-30b ran it instantly and the HP-12C ran it in less than a second. However, the HP-12C platinum took 26 seconds!! I didn't realise it was such a poor performer compared to its little brother.

Overall, this was an interesting algorithm that took me a while to debug as I was doing it on the 12C and 12CP at the same time and didn't realise that the 12C disables the stack lift for a STO to TVM register but the 12CP doesn't (on another thread here). While the 12CP is simpler to understand the program is 7 steps shorter for 12C with the disabled stack lift.

As before, the CF is limited to 7 entries including 0th period. 10 would be about acceptable and I will set it up for that on the 12CP.


RE: (12C) Financial Management Rate of Return - FMRR - fhub - 06-20-2019 08:00 PM

(06-20-2019 05:22 PM)Joe_H Wrote:  The only financial desktop calculator model that calculates it, that I know of, is the HP-30b ...
Do you know my program TVM-Calc Pro 2015, that I've written a few years ago?
It's a PC program (not for calculators), but it also does all those financial calculations, so if you're interested (maybe to test some examples?) -
you can find it on my website:
https://fhub.jimdo.com/

Regards,
Franz


RE: (12C) Financial Management Rate of Return - FMRR - rprosperi - 06-21-2019 01:30 PM

(06-20-2019 06:04 PM)Joe_H Wrote:  [snip]
The HP-30b ran it instantly and the HP-12C ran it in less than a second. However, the HP-12C platinum took 26 seconds!! I didn't realise it was such a poor performer compared to its little brother.

The most recent 12C machines are dramatically faster than the early 12C's and the 12CP's as well. Here are some results of a very simple performance test (adding 1's for 1 minute):

Original 12C: 500
2003 12C (1x20332): 571
30th Ann 12C: 72,680

Initial Silver 12CP (no undo): 3150
Silver 12CP w/Undo: 1425
Recent 12CP (w/2x2032): 1378

So, yeah there is a huge variation of the performance of the 12C family members as the production configuration has matured.

For more info, read these threads:

https://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv021.cgi?read=217927

https://www.hpmuseum.org/forum/thread-5180.html?highlight=12c

Jose's thread and the document therein contains LOTS of info on the 12C evolution.


RE: (12C) Financial Management Rate of Return - FMRR - Joe_H - 06-21-2019 04:08 PM

Thanks fhub wish I had known about TVM-Calc Pro 2015 as it would have saved me some hassle! I'll download it now.

Bob - I ran the following on mine for 1 minute:

01 STO + 1
02 g GTO 01

and got the following results:

HP-12C 83,464
HP-12CP 2,771
HP-30b 68,659 (however GTO has to use a label so maybe this is an extra step)

The 12C is about 30 times faster than the 12CP (corresponds with the results of the FMRR program as the 12C was somewhat less than a second). I'm surprised the 30b wasn't a lot higher - it is supposed to be a very fast calculator.


RE: (12C) Financial Management Rate of Return - FMRR - Gene - 06-21-2019 10:04 PM

These discussions really don't belong in the Software Library section of the forum.

The goal is to post software here and comments on how to run it. The discussion is fine :-) but please consider starting a thread for things not specifically related to the original program.