### Should I Refinance? PowerShell the Financial Advisor

When it comes to personal finance, research and reading sometimes can’t answer all of your questions. Especially when it comes to projecting the future, many subtle factors are simply too difficult to easily describe in rules of guidance. Because of this, they tend to be ignored. With interest rates sinking, now’s a good time to evaluate a mortgage refinance. The online calculators help you figure out if it’s right for you, but they all miss important facts. Let’s pretend that you refinance 5 years into your current 30-year mortgage (that started at 108k), plan to move in 5 years, and your house value doesn’t change. You’ve now got a 100k mortgage at 6%, and want to re-finance at 5%. The immediate benefit pointed out is that your monthly payment will drop, and that the new interest-heavy payment will be even more tax deductible. At 6%, you’re paying $647 per month. At 5%, you’re paying $585 per month. However,

- All of the re-finance quotes and calculators put your remaining balance into a new 30-year mortgage. That pushes the quoted monthly figures even lower than $585 – to be expected if you spread 25 years of payments over 30 years! If you want to take the approach of not building principal to reduce monthly payments, you might as well go for an interest-only loan, or rent.
- Even if you put yourself into a 25-year mortgage instead, loan amortization over the first 5 years of that new loan may be much more interest-heavy than the mid years of your current loan. That means a reduction in your principal payments, which is a direct loss of money when you sell your house in 5 years. In this specific scenario (you are only 5 years into a mortgage,) you’re actually building principal faster in the new loan.
- Your current loan will build $10,117 in principal in this time
- A new loan will build $11,252 in principal in this time

As we can see from these numbers, this is not a negative impact of the scenario I laid out above. However, it will impact more mature loans.

- Re-financing means paying the closing costs all-over again. If you assume 10k out-of-pocket, you can instead apply that as a balloon payment and drop your monthly payment to $579 per month – lower than the rate you would get from a re-finance.
- If you don’t want to pay the closing costs out of pocket and instead roll them into your mortgage, that gives you a $110k loan @ $643 per month.

These calculations are obviously sensitive to real numbers, but they describe core decision points that are not covered in most literature. Since we have a powerful scripting language at our disposal, however, we are in a position to let a computer model help guide our decisions. We’ve done this before (Traditional or Roth 401(k)?,) so let’s do it again.

```
## Assumptions:
## You will invest the closing fee if you don't need to spend it
## You will bank any improvement in monthly fees
$currentLoan = 100000
$currentRate = 6.125 / 100
$newRate = 4.25 / 100
$origination = 1.00 / 100
$closing = 5000
$monthsTotal = 25 * 12
## Scenarios:
$scenarios = @(
## 0: Current loan. Invest closing fee instead @ 3%
@{
LoanAmount = $currentLoan; Interest = $currentRate;
Saved = $closing * [Math]::Pow(1.03, 10) },
## 1: Put closing fee against principal on current loan
@{
LoanAmount = $currentLoan - $closing; Interest = $currentRate;
Saved = 0 },
## 2: Refi: Add origination fee onto mortage, and spend
## closing fee to refinance
@{
LoanAmount = $currentLoan + ($currentLoan * $origination);
Interest = $newRate; Saved = 0 },
## 3: Refi: Add origination and closing fees onto mortage,
## and invest closing fee
@{
LoanAmount = $currentLoan +
($currentLoan * $origination) + $closing;
Interest = $newRate; Saved = $closing * [Math]::Pow(1.03, 10) }
)
## Calculate the monthly payments
$maxPayment = 0
$counter = 0
foreach($scenario in $scenarios)
{
$scenario.InterestPerPeriod = $scenario.Interest / 12
$scenario.MonthlyPayment = $scenario.LoanAmount *
$scenario.InterestPerPeriod *
[Math]::Pow(1 + $scenario.InterestPerPeriod, $monthsTotal) /
([Math]::Pow(1 + $scenario.InterestPerPeriod, $monthsTotal) - 1)
"Monthly payment $counter is: " + $scenario.MonthlyPayment
if($scenario.MonthlyPayment -gt $maxPayment)
{
$maxPayment = $scenario.MonthlyPayment
}
$scenario.Balance = $scenario.LoanAmount
$counter++
}
## Apply the monthly payments. This applies standard
## amortization, which pays off the interest that built up
## that month before applying payments to principal.
$results = @()
for($month = 1; $month -le $monthsTotal; $month++)
{
$outputObject = New-Object PsObject
Add-Member -in $outputObject NoteProperty Month $month
## Calculate the principal, interest, and total savings
## for each scenario
$counter = 0
foreach($scenario in $scenarios)
{
$scenario.Balance *= (1 + $scenario.InterestPerPeriod)
$interestPayment = $scenario.InterestPerPeriod * $scenario.Balance
$principal = $scenario.MonthlyPayment - $interestPayment
# Put the following into the bank / savings:
# the principal payment, the difference between this payment
# and the most expensive, and the tax-writeoff aspect of the
# interest
$scenario.Saved += $principal
$scenario.Saved += $maxPayment - $scenario.MonthlyPayment
$scenario.Saved += $interestPayment * 0.3
Add-Member -in $outputObject `
NoteProperty Interest_$counter ("{0:C}" -f $interestPayment)
Add-Member -in $outputObject `
NoteProperty Principal_$counter ("{0:C}" -f $principal)
Add-Member -in $outputObject `
NoteProperty Balance_$counter ("{0:C}" -f $scenario.Balance)
Add-Member -in $outputObject `
NoteProperty Saved_$counter ("{0:C}" -f $scenario.Saved)
$scenario.Balance -= $scenario.MonthlyPayment
$counter++
}
$results += $outputObject
}
$results| Format-Table Month,S*,B*
#$results| Format-Table Month,S*,I*,P*,B*
```

This gives you a table of information that lets you easily determine which scenario is best for you, and how long the refinance will take to pay for itself:

```
PS E:\Lee> E:\Lee\RefinanceCalculator_Example.ps1
Monthly payment 0 is: 651.963964563932
Monthly payment 1 is: 619.365766335736
Monthly payment 2 is: 547.155481990353
Monthly payment 3 is: 574.24238703938
Month Saved_0 Saved_1 Saved_2 Saved_3 Balance_0 Balance_1 Balance_2 Balance_3
----- ------- ------- ------- ------- --------- --------- --------- ---------
1 $7,012.43 $310.80 $400.68 $7,107.82 $100,510.42 $95,484.90 $101,357.71 $106,375.42
2 $7,305.79 $622.09 $801.83 $7,496.56 $100,368.15 $95,349.74 $101,167.59 $106,175.89
3 $7,599.66 $933.86 $1,203.46 $7,885.79 $100,225.15 $95,213.89 $100,976.80 $105,975.65
4 $7,894.04 $1,246.12 $1,605.56 $8,275.52 $100,081.43 $95,077.35 $100,785.33 $105,774.70
```

If it doesn’t cover a scenario you’re wondering about, well that’s OK too! That’s the beauty of scripts – you can change them.