15 vs 30-year Mortgage
by skibulk
JavaScript
console.clear();
// 15-year 100% Mortgage, 15-year 100% Stock
function run15(){
var paid = 0;
var bill = 2058; // 240K, 15-year, 6.25%
var stock = 0;
for(var i=0; i<12*15; i++){
paid += bill;
}
for(var i=0; i<12*15; i++){
stock += bill;
stock *= Math.pow(1.1, 1/12);
}
stock = Math.round((stock-paid)*100)/100;
console.log(stock);
}
run15();
// 30-year 50% Mortgage, 30-year 50% Stock
function run30(){
var paid = 0;
var bill = 1497; // 240K, 30-year, 6.375%
var save = 357;
var stock = 0;
for(var i=0; i<12*30; i++){
paid += bill;
stock += save;
stock *= Math.pow(1.1, 1/12);
}
stock = Math.round((stock-paid)*100)/100;
console.log(stock);
}
run30();
// Calculate Mortgage Early Payment =================
// Post-Tax Disposable Income
var monthlyIncome = 2200 * 2;
// Non-mortgage expenses, see "Expenses" spreadsheet
var monthlyExpenses = 2700;
var borrowed = 250000;
var rate15 = 5.5;
var rate30 = 5.625;
//15-year paid in 15
crunch(15, rate15, borrowed, 15);
//15-year paid in 10
crunch(15, rate15, borrowed, 10);
//30-year paid in 30
crunch(30, rate30, borrowed, 30);
//30-year paid in 20
crunch(30, rate30, borrowed, 20);
//30-year paid in 15
crunch(30, rate30, borrowed, 15);
//30-year paid in 12
crunch(30, rate30, borrowed, 12);
//30-year paid in 10
crunch(30, rate30, borrowed, 10);
function crunch(maxTerm, interestRate, amountBorrowed, myTerm) {
const monthlyInterestRate = (interestRate / 12) / 100;
const totalPayments = myTerm * 12;
const monthlyPayment = (monthlyInterestRate * amountBorrowed) / (1 - Math.pow(1 + monthlyInterestRate, -totalPayments));
const monthlyRemainder = monthlyIncome - monthlyExpenses - monthlyPayment;
// Calculate paid interest, paid principal, and paid total assuming early payoff
const paidInterest = (monthlyPayment * totalPayments) - amountBorrowed;
const paidTotal = paidInterest + amountBorrowed;
const result = {
maxTerm,
myTerm,
...