/** // // flexibleRetirementPlanner Source Code Module. // // Copyright 2006-2008 by Jim Richmond // You may not use, distribute, or modify this code without the consent of the copyright holder. // // for more information, visit: http://www.flexibleRetirementPlanner.com // // // The attached is a partial listing of source code provided for example only. This code is // not intended to be useable in its current form. Although this example was reflective of the // actual code at the time it was copied, the actual source code used by the planner may differ. // */ package retirementsim; public class SimCalc { // Method: ComputeFundingUsingConservativePolicy() // // Computes the percentage of expenses that will be funded for the next year // using the CONSERVATIVE spending policy. // // The general idea of this policy is to skip COLAs (cost of living adjustments) on // the spending during periods of poor portfolio performance to save cash. // The code implements this by subtracting out the current period's inflation rate // from the percent of expenses that will be funded. // In real life, the retiree's withdrawal wouldn't be reduced, be would be frozen at // the same level as it was in the year prior to when the conservation action kicked in. // // Finally, notice that with this method, if the portfolio is doing well, ie. growing and // worth more than at retirement start, previously missed COLA's can be partly made up. // However, the percentage can never be greater than 100% of the desired amount public static double ComputeFundingUsingConservativePolicy( double currentBalance, double previousBalance, double startBalance, double previousFundingPercent, double adjustmentRate, double spendingPercentFloor, double spendingPercentCeiling) { double percentOfExpensesToFund; // if portfolio is not doing well so the retiree doesn't get a cost of living increase if ( (currentBalance < previousBalance) && (currentBalance < startBalance)) { // Protect from turning the percent negative. if (adjustmentRate > 1.0) adjustmentRate = 0.99; // Need to subtract percent by inflation rate to reduce purchasing power. percentOfExpensesToFund = previousFundingPercent * (1 - adjustmentRate); } else if ( (currentBalance > startBalance) && (previousFundingPercent < 1.0)) { // Portfolio is bigger than starting value, so add some purchasing power back percentOfExpensesToFund = previousFundingPercent * (1 + adjustmentRate); if (percentOfExpensesToFund > 1.0) { percentOfExpensesToFund = 1.0; } } else { // The portfolio is doing ok so the retiree gets a standard COLA based on the // inflation rate. percentOfExpensesToFund = previousFundingPercent; } if (percentOfExpensesToFund > spendingPercentCeiling) percentOfExpensesToFund = spendingPercentCeiling; else if (percentOfExpensesToFund < spendingPercentFloor) percentOfExpensesToFund = spendingPercentFloor; return percentOfExpensesToFund; } // Method: ComputeFundingUsingFlexiblePolicy() // // Computes the funding percent for the next year using the FLEXIBLE policy. // // Same as Conservative policy in the lean years, but this policy allows funding // percent to increase to more than 100% if the portfolio is doing really // well. The extra increase in any year can be as high as the inflation rate // (which is like applying a double COLA) if the portfolio has doubled in value // since the start. If the portfolio is above the starting value, but hasn't doubled, // the extra increase is one forth of the inflation rate. public static double ComputeFundingUsingFlexiblePolicy( double currentBalance, double previousBalance, double startBalance, double previousFundingPercent, double adjustmentRate, double spendingPercentFloor, double spendingPercentCeiling) { double percentOfExpensesToFund; if ( (currentBalance < previousBalance) && (currentBalance < startBalance)) { // Protect from turning the percent negative. if (adjustmentRate > 1.0) adjustmentRate = 0.99; // Portfolio Value is shrinking, no COLA this year (reduce withdrawal by inflation rate) percentOfExpensesToFund = previousFundingPercent * (1 - (adjustmentRate)); } else { if (currentBalance > startBalance) { // if portfolio balance is ok, then add some extra purchasing power // by increasing withdrawal by the inflation rate, this increase // results in the retiree getting a double COLA for the year if (currentBalance > (2 * startBalance)) { // Portfolio has doubled in size, increase withdrawal by inflation rate twice // (note: if percentOfExpensesToFund = previousFundingPercent * (1 + adjustmentRate); } else { // Portfolio is above the start value, but not doubled, give a smaller increase. percentOfExpensesToFund = previousFundingPercent * (1 + (adjustmentRate / 4)); } } else { // Not a bad year, but portfolio isn't growing much so just give a normal COLA percentOfExpensesToFund = previousFundingPercent; } } if (percentOfExpensesToFund > spendingPercentCeiling) percentOfExpensesToFund = spendingPercentCeiling; else if (percentOfExpensesToFund < spendingPercentFloor) percentOfExpensesToFund = spendingPercentFloor; return percentOfExpensesToFund; } }