An Adjustable-Rate Mortgage (ARM) is a type of mortgage that has a variable interest rate. This calculator helps you understand how much your monthly payment might change when your ARM's interest rate adjusts.
function calculateArmAdjustment() {
var initialRate = parseFloat(document.getElementById("initialRate").value);
var margin = parseFloat(document.getElementById("margin").value);
var adjustmentPeriodMonths = parseInt(document.getElementById("adjustmentPeriodMonths").value);
var indexChange = parseFloat(document.getElementById("indexChange").value);
var paymentCap = parseFloat(document.getElementById("paymentCap").value);
var loanBalance = parseFloat(document.getElementById("loanBalance").value);
var remainingTermMonths = parseInt(document.getElementById("remainingTermMonths").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
if (isNaN(initialRate) || isNaN(margin) || isNaN(adjustmentPeriodMonths) || isNaN(indexChange) || isNaN(paymentCap) || isNaN(loanBalance) || isNaN(remainingTermMonths)) {
resultDiv.innerHTML = "Please enter valid numbers for all fields.";
return;
}
if (initialRate < 0 || margin < 0 || adjustmentPeriodMonths <= 0 || indexChange < 0 || paymentCap <= 0 || loanBalance <= 0 || remainingTermMonths maxAllowedPayment) {
adjustedRate = calculateRateFromPayment(loanBalance, maxAllowedPayment, remainingTermMonths);
capApplied = true;
} else {
adjustedRate = newFullyIndexedRate;
}
// Ensure the adjusted rate does not exceed a theoretical life-of-loan cap (often an additional 5-6% above initial rate)
// For simplicity, we'll just ensure it doesn't go wildly out of bounds. A real ARM has specific limits.
var theoreticalMaxRate = initialFullyIndexedRate + 6; // Example: Assuming a 6% life-of-loan cap above initial fully-indexed rate.
if (adjustedRate > theoreticalMaxRate) {
adjustedRate = theoreticalMaxRate;
capApplied = true; // Could be payment cap or life-of-loan cap
}
var adjustmentResult = "Initial Fully-Indexed Rate: " + initialFullyIndexedRate.toFixed(3) + "%";
adjustmentResult += "New Index Rate: " + newIndexRate.toFixed(3) + "%";
adjustmentResult += "New Fully-Indexed Rate: " + newFullyIndexedRate.toFixed(3) + "%";
adjustmentResult += "Initial Monthly Payment (P&I): $" + initialMonthlyPayment.toFixed(2) + "";
adjustmentResult += "Projected Monthly Payment (P&I) with New Rate: $" + calculateMortgagePayment(loanBalance, adjustedRate / 100, remainingTermMonths).toFixed(2) + "";
if (capApplied) {
adjustmentResult += "Note: The calculated rate adjustment may be limited by the annual payment cap or other loan provisions.";
adjustmentResult += "Calculated Adjusted Rate (after caps): " + adjustedRate.toFixed(3) + "%";
} else {
adjustmentResult += "Calculated Adjusted Rate: " + adjustedRate.toFixed(3) + "%";
}
resultDiv.innerHTML = adjustmentResult;
}
// Helper function to calculate monthly mortgage payment
function calculateMortgagePayment(principal, annualRate, termMonths) {
if (annualRate === 0) {
return principal / termMonths;
}
var monthlyRate = annualRate / 12;
var payment = principal * (monthlyRate * Math.pow(1 + monthlyRate, termMonths)) / (Math.pow(1 + monthlyRate, termMonths) – 1);
return isNaN(payment) ? 0 : payment;
}
// Helper function to calculate rate from payment (used when caps are applied)
function calculateRateFromPayment(principal, monthlyPayment, termMonths) {
// This is an iterative or numerical solution. A simple approximation or solver might be needed.
// For simplicity here, we'll use a bisection method approximation.
var lowRate = 0.000001; // Avoid division by zero
var highRate = 1.0; // Assume a rate up to 100% is sufficient for search space
var tolerance = 0.00001; // Precision
var maxIterations = 100;
for (var i = 0; i < maxIterations; i++) {
var midRate = (lowRate + highRate) / 2;
var payment = calculateMortgagePayment(principal, midRate, termMonths);
if (Math.abs(payment – monthlyPayment) < tolerance) {
return midRate * 100; // Return in percentage
} else if (payment monthlyPayment ? lowRate * 100 : highRate * 100;
}