DrPaulBrewer/Unofficial-Loan-Modification-HAMP

Initial distribution of v2.5 Beta

1 parent dadcabe commit 482a3ed26ad19db01c5da8b8367d61acd6065bd9 Dr Paul Brewer committed Oct 16, 2012
Showing with 1,822 additions and 423 deletions.
2. +104 −0 TVM.js
3. +0 −361 UnofficialHampLib2.js
4. +806 −0 UnofficialHampLib3.js
5. +339 −0 gpl-2.0.txt
6. +259 −0 jquery.jqplot.css
7. +57 −0 jquery.jqplot.min.js
9. +180 −44 skin.html
10. +12 −0 style.css
11. +32 −0 underscore-min.js
104 TVM.js
 @@ -0,0 +1,104 @@ +// (c) 2012 Paul Brewer +// Part of Unofficial HAMP Loan Modification Calculator +// This File Licensed to the Public under the GNU GPL v2.0 License +// or any later version +// see license file: gpl-2.0.txt +// +// These six functions are textbook time-value-of-money factors. +// Go read wikipeia "Time Value of Money" for a crash course on this subject. +// The original software author, Dr Brewer, taught this subject as part of +// "Engineering Economics" in Hong Kong for about 4 years. +// +// These function convert between +// present values P, future values F, flow values A +// rates are 8 for 8%/year, but n is in months so r is scaled at the +// beginning of each function by 1/1200 so that we can correctly +// apply the classic formulas. +// + +TVM = { + 'PoverA': function PoverA(r, n) { + r = r / 1200.0; + return (r<0.000001)? n: ( (1.0 - Math.pow(1.0 + r, -n)) / r); + }, + + 'AoverP': function AoverP(r, n) { + r = r / 1200.0; + return (r<0.000001)? (1/n) : (r / (1.0 - Math.pow(1.0 + r, -n))); + }, + + 'FoverP': function FoverP(r, n) { + r = r / 1200.0; + return Math.pow(1.0 + r, n); + }, + + 'PoverF': function PoverF(r, n) { + r = r / 1200.0; + return Math.pow(1.0 + r, -n); + }, + + 'FoverA': function FoverA(r, n) { + r = r / 1200.0; + return (r<0.000001)? n : ( (Math.pow(1.0 + r, n) - 1) / r); + }, + + 'AoverF': function AoverF(r, n) { + r = r / 1200.0; + return (r<0.000001)? (1/n) : ( r / (Math.pow(1.0 + r, n) - 1) ); + } +}; +// end standard time-value-of-money functions + + +TVM.StandardLoanPayment = function StandardLoanPayment(Rate, LoanAmt, TermInMonths) { + return TVM.AoverP(Rate, TermInMonths) * LoanAmt; +}; + + +TVM.StandardLoanFutureBalance = function StandardLoanFutureBalance(Rate, LoanAmt, Month, MonthlyPayment) { + return TVM.FoverP(Rate, Month) * LoanAmt - TVM.FoverA(Rate, Month) * MonthlyPayment; +}; + +TVM.VariableRateLoanPaymentArray=function VariableRateLoanPaymentArray(LoanAmt, TermInMonths, startRate, MonthArray, RateArray) { + // This calculates a payment array for a single complex loan. + // The payment array is a sparse array and shows the changes in payments. + // + // Payments at other months match the previous step, the entire payment + // profile can be determined as a stairstep function with steps months + // given in the MonthArray rates in the RateArray and payments + // in the output of this function which we call a PaymentArray + // + // the loan is for an amortizing, interest-bearing amount LoanAmt + // the term is TermInMonths + // the initial interest rate is startRate + // the MonthArray lists the months when the rates change + // this array should be strictly increasing + // the RateArray lists what the rates will be + // rates may go up or down but the length of the array should match + // the length of MonthArray + // the output will be an array of identical length giving monthly payments + // (to get the start rate monthly payment use "StandardLoanPayment()") + + var changes = MonthArray.length; + var payments = new Array(changes); + + // initial state for the for loop; will be updated each iteration + var RemainingBalance = LoanAmt; + var prevMonth = 0; + var prevRate = startRate; + var prevPayment = TVM.StandardLoanPayment(prevRate, LoanAmt, TermInMonths); + var j=0,newMonth=0,newRate=0; + + for(j = 0; j < changes; ++j) { + newMonth = MonthArray[j]; + newRate = RateArray[j]; + RemainingBalance = TVM.StandardLoanFutureBalance(prevRate, RemainingBalance, newMonth - prevMonth, prevPayment); + payments[j] = TVM.StandardLoanPayment(newRate, RemainingBalance, TermInMonths - newMonth); + prevMonth = newMonth; + prevRate = newRate; + prevPayment = payments[j]; + } + + return payments; + +};
361 UnofficialHampLib2.js
806 UnofficialHampLib3.js
 @@ -0,0 +1,806 @@ +// Unofficial HAMP Library for Javascript v3 +// (C) 2012 Dr Paul Brewer +// Licensed under version 2 of the GNU General Public License +// +// VARIABLE NAMING CONVENTIONS +// +// Hungarian notation prefixes for variable names: +// bo - borrower +// ol - original loan +// fm - Freddie Mac public data +// ml - modified loan +// po - policy +// +// expected elements in Q hash (case study or UI inputs) +// boMoGrossIncome -- borrowers monthly gross income +// boMoMiscHousingExpense -- borrowers (approved) misc housing expense +// olUnpaid -- original loan unpaid balance +// olHomeMarketValue -- home value in todays market +// olMoRemain -- original loan months remaining +// olRate -- original loan interest rate +// fmCap -- freddie mac cap rate (30 yr PMMS rate) +// poDoPR -- 1 for alternative (principal-reduction) waterfall +// poDoLenderVariation -- check if principal reduction exceeds 5% +// if so, lengthen loan then reduce rate +// +// A HAMP result hash contains these elements (outputs) +// all result elements are unformatted strings, should be rounded to nearest dollar for dollar values +// mlTargetAGIPct +// mlPR = Principal Reduction +// mlUnpaid = new Unpaid balance = olUnpaid - mlPR +// mlLTV = 100 * mlUnpaid/olHomeMarketValue +// mlMoTotalTargetPayment = mlTargetAGIPCT % of bMoGrossIncome +// mlMoMiscHousingExpense = copied from bMoMiscHousingExpense +// mlMoTargetPayment = target for loan payment, == total-misc +// mlRate1to5 -- interest rate first 5 years +// mlMoPayment1to5 -- modified monthly loan payment first 5 years +// mlMonths -- term (length) of modified loan in months +// mlChangeMonths -- months for which rate changes occur -- as a string +// mlChangeRates -- new rates that take effect on the months above -- as a string +// mlChangePayments -- new payments that take effect on the months above -- as a string +// mlBalloon -- balloon payment at the end, if any. if none, return a zero. +// mlBalloonMax -- servicers not required to exceed max(30% mlUnpaid, <100%LTV) +// mlTotalPayments -- total of all payments on loan for life of loan +// mlFail -- 1 if the modification fails some policy test +// mlFailReason -- string indicating why the modification failes + +function noFrames() { + if(top != self) { + document.write(''); + alert("The web page you are visiting takes content from www.armdisarm.com and tries to display it as part of their own web page. Pressing OK will attempt to load www.armdisarm.com directly. Thanks -- Dr Paul Brewer armdisarm.com "); + top.location.replace(self.location.href); + } +} + +function numerize(x){ var xx=1*x; return (isNaN(xx)?x:xx)} + +function roundStep(x, step) { + // returns x rounded to the nearest step + return step * Math.round(x / step); +} + +function tagString(tag,opt){ + var s = "<"; + s = s + tag ; + for (var k in opt){ + s = s + ' ' + k + '=' + '"' + opt[k] + '" '; + } + s = s + '>'; + return s; +} + +function ArrayPluckHTML(A, H, order, tableOptions){ + var s = tagString('table',tableOptions); + return s.concat('
', + H.join(''), + '
'+(_(order).map(function(e){ return r[e]; })).join('') + '
339 gpl-2.0.txt
259 jquery.jqplot.css
57 jquery.jqplot.min.js
57 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
 @@ -9,7 +9,7 @@

Freddie Mac data iFrame, is property of Freddie Mac, and distributed under permission given by their public syndication policy as downloaded in July 2010 and under the doctrine of fair use.

-

The original code of the Unofficial HAMP Loan Modification Calculator is (c) Dr Paul Brewer, and is free software licensed to the public under the Free Software Foundation's General Public License version 3 , or any later version. Backup copy of license.

+

The original code of the Unofficial HAMP Loan Modification Calculator is (c) Dr Paul Brewer, and is free software licensed to the public under the Free Software Foundation's General Public License version 2 , or any later version. Backup copy of license.

The software is written in JavaScript. You can examine or download the source code freely at Github DrPaulBrewer/Unofficial-Loan-Modification-HAMP.

224 skin.html
 @@ -4,7 +4,13 @@ - + + + + + + + @@ -13,13 +19,13 @@ - + - + - + @@ -29,32 +35,47 @@ The Unofficial HAMP Loan Modification Calculator - - - + + + + + + + -

The Unofficial HAMP Loan Modification Calculator v2.0

+

The Unofficial HAMP Loan Modification Calculator v2.5-beta

+
-
• All results are provided completely free of charge. Free. \$0.00. Nada. Use "www.armdisarm.com" or "www.unofficialhampcalculator.com". Please beware of ripoffs!
• -
• Calculations are based on independent research of public documents describing HAMP loan modification procedures, particularly The MHA Handbook v3.3
• -
• This unofficial calculator is not associated with the government or any bank and has not been independently reviewed, certified, or tested.
• -
• Computer experts or enthusaists may examine the calculator program's source code, which I make available under the GNU General Public License.
• -
• The software is offered for your free use WITHOUT WARRANTY OF ANY KIND and you agree that ALL USE IS AT YOUR OWN RISK
• -
• Privacy policy: To protect your privacy, the calculator does not ask for personally identifying information. Javascript performs the calculations on your computer web browser, not our server. The loan INPUTS data are not recorded and exist only on your computer. Items that are logged for understanding the audience include: ip address, city, state or country, type of web browser.
• -
• This version: May 19, 2012
• +
• All calculations are provided completely free of charge. Free. \$0.00. Nada. +
• +
• Please beware of scammers and idiots who suggest bizarre schemes like stopping loan payments or signing away your home and leasing it back.
• +
• I do not provide personalized help with loan modifications. Free help is available from the governments toll free numbers listed at www.makinghomeaffordable.gov
• +
• This unofficial calculator is not associated with the government or any bank . Calculations are based on independent research of public documents describing HAMP loan modification procedures. Docs can be downloaded below. +
• +
• The calculator is implemented in 100% javascript and may be examined at the source code repository. This code is available under the GNU General Public License.
• +
• This free software is WITHOUT WARRANTY OF ANY KIND and you agree that ALL USE IS AT YOUR OWN RISK.
• +
• Calculations shown here may differ from those provided elsewhere for many reasons. Never make public accusations of fraud where a mistake, or different inputs, might also provide an explanation.
• +
• Privacy policy: Your name, email, or other personal information is never needed for calculations. Javascript performs the calculations on your computer web browser, not on our server -- therefore calculator inputs and outputs exist only on your computer and are never recorded on our server or transmitted across the internet. By visiting, you agree our web server may record standard technical information useful for measuring audience statistics and resolving technical issues and that Google Analytics may use their tracking cookies and other technologies to record and provide audience statistics.
• +
• This version: Oct 16, 2012
-

Web sites for official information include: makinghomeaffordable.gov -- Fannie Mae -- Freddie Mac

+

Web sites for official information include: makinghomeaffordable.gov -- Fannie Mae (loan workout programs) -- Freddie Mac -- sigtarp.gov -- +Keep Your Home CA +

+

+

Cheating? Fraud? + Independent Foreclosure Review (ends Dec 31, 2012) -- Office of Mortgage Settlement Oversight -- +preventLoanScams.org +

+

Inputs

- +
@@ -70,21 +91,31 @@ Market Value, i.e. home value if sold in todays marketplace
+ + +Procedure to Calculate Loan Modification. Choose "Tier 1" or "Tier 2". Borrowers who fail HAMP Tier 1 can be considered for HAMP Tier 2. +
Calculate Principal Reduction.Calculate Principal Reduction. Uncheck this box to calculate without PR.
In opposition to principal reduction, on July 31, 2012 Fannie Mae/Freddie Mac's acting director released a statement, research paper, and technical appendix.
Calculate Lender's Variation. -MHA Handbook v3.3, 6.4.3, allows lenders to lengthen loan before reducing rates
-whenever the forgiven principal exceeds 5% of the unpaid balance +MHA Handbook v3.3(sect 6.4.3) and v4.0(6.4.4) allows lenders to lengthen loan before reducing rates whenever the forgiven principal exceeds 5% of the unpaid balance
Borrowers combined Monthly Gross Income
-include all wages, retirement, rental or investment income, before deductions +include all work, retirement, investment or other income, before deductions
- + Freddie Mac 30YR FRM Avg rate in %
Please re-enter by hand from the table below:
+ + + + - + @@ -110,26 +141,37 @@ -

freddie mac iframe goes here -see link below to add back into the site

+ +

Freddie Mac copyrighted loan market data provided "as is", under a public syndication policy of Freddie Mac and with no warranty of any kind. See how to add Freddie Mac data to your website

+ +

Outputs

-

+

+
@@ -198,22 +240,114 @@
-Balloon payment at end of loan +Balloon payment at end of loan (suggested max: \$) \$
+Total of Loan Payments + +\$ +
+ + + + +

These results are provided "as-is" and with no warranty of any kind. Procedures and calculations are subject to change and should not be relied upon for any particular case. Actual results may vary. If you need advice specific to your case, please consult a legal or financial professional.

-
+
+
+

Sensitivity Analysis

+

+This tool does multiple calculations, then graphs the results. +

+
1. Up top, run a calculation to get a "base" result
2. +
3. Here, tell it what to vary and what to monitor
4. +
5. Repeat #2 until you are satisfied you understand what is happening.
6. +
+Requires a modern web browser to work properly (Firefox 3.5+, Safari 4+, Chrome 8.0+, IE 9+)
+On Smartphones/Tablets show only single outputs, on "Main 7" it may hang. +

+

+Vary Rules +Include "bad" mods +

+

+Vary + + From + + To + + Show + + +

+
+
+colors for Tier 1 Calculations: +No Principal Reduction, +With Principal Reduction, +With PR + Lender's Variation +
+colors for Tier 2 Calculations: +No Principal Reduction, +With Principal Reduction +
+
+
+
+

+
+
+

+
+
+

+
+
+

+
+
+

+
+
+

+
+
+

+
+
+