RetirementCalculator provides various methods to calculate retirement finances, including inflation adjustments, balance after inflation, and compound interest calculations.

Hierarchy

  • default

Constructors

Methods

  • Formats a number with commas and limits it to two decimal places.

    Parameters

    • value: number

      The number to be formatted.

    Returns string

    A string representation of the number with formatted commas.

  • Adjust how much a balance would be with inflation added.

    Parameters

    • desiredBalance: number
    • years: number
    • inflationRate: number

    Returns number

  • Private

    Calculate the value of something subtracting inflation over a period of time.

    Parameters

    • balance: number
    • inflationRate: number
    • years: number

    Returns number

  • Calculate how much would need to be in retirement in order to spend $yearlySpend a year

    Parameters

    • yearlySpend: number
    • yearlyWithdrawalRate: number = 0.04

    Returns number

  • Calculate how much could be spent in retirement based on an x% rule.

    Parameters

    • balance: number
    • yearlyWithdrawalRate: number

    Returns number

  • Private

    Calculate the interest of a balance over a given period of time.

    Parameters

    • startingBalance: number
    • interestRate: number
    • periods: number

    Returns number

  • Private

    Calculate the total interest multiplier used for determining contributions needed to hit a goal. Uses the geometric series formula for efficiency: sum = a(r^n - 1)/(r - 1)

    Parameters

    • interestRate: number
    • periods: number

    Returns number

  • Private

    Calculate the total number of periods based on years and periods per year.

    Parameters

    • years: number
    • periodsPerYear: number

    Returns number

  • Private

    Calculate the interest rate per period based on the frequency of compounding.

    Parameters

    • interestRate: number
    • compoundingFrequency: number

    Returns number

  • Private

    Calculate how often compounding should occur based on contribution and compounding frequencies.

    Parameters

    • contributionFrequency: number
    • compoundingFrequency: number

    Returns number

  • Private

    Calculate the compound multiplier based on contribution and compounding frequencies. ex. If we contribute yearly, but compound monthly, then our compound multiplier would be 12.

    Parameters

    • contributionFrequency: number
    • compoundingFrequency: number

    Returns number

  • Private

    Convert the balance to match contribution and compounding being the same.

    Parameters

    • balance: number
    • contributionFrequency: number
    • compoundingFrequency: number

    Returns number

  • Determine the contribution needed at what frequency to reach a desired balance.

    Parameters

    • startingBalance: number
    • desiredBalance: number
    • years: number
    • interestRate: number
    • contributionFrequency: number
    • compoundingFrequency: number
    • inflationRate: number = 0.02

    Returns DetermineContributionType

  • Calculate compound interest with additional contributions made over a given period of time.

    Parameters

    • initialBalance: number

      The initial balance.

    • additionalContributionAmount: number

      The additional contribution amount.

    • years: number

      The number of years.

    • interestRate: number

      The interest rate.

    • contributionFrequency: number

      The contribution frequency.

    • compoundingFrequency: number

      The compounding frequency.

    Returns CompoundingInterestObjectType

    An object that contains the results, and a history.

  • Calculate compound interest with age-aware glidepath strategies. Supports fixed returns, allocation-based strategies, and custom waypoints.

    Parameters

    • initialBalance: number

      Starting account balance

    • contributionAmount: number

      Amount contributed per contribution period

    • startAge: number

      Starting age for calculation

    • endAge: number

      Ending age for calculation

    • glidepathConfig: DynamicGlidepathConfig

      Strategy configuration (fixed, allocation-based, or custom)

    • contributionFrequency: number = 12

      Number of contributions per year (default: 12)

    • compoundingFrequency: number = 12

      Number of compounding periods per year (default: 12)

    • contributionTiming: ContributionTiming = 'start'

      When contributions are added ('start' or 'end' of period)

    Returns DynamicGlidepathResult

    Detailed glidepath calculation results with timeline data

  • Private

    Calculate the annual return rate for a given age using the specified glidepath strategy.

    Parameters

    • age: number

      Current age for calculation

    • config: DynamicGlidepathConfig

      Glidepath configuration

    • startAge: number

      Starting age for age-based calculations

    • endAge: number

      Ending age for age-based calculations

    Returns number

    Annual return rate (decimal format)

  • Private

    Calculate linear interpolation progress between start and end ages.

    Parameters

    • age: number

      Current age

    • startAge: number

      Starting age

    • endAge: number

      Ending age

    Returns number

    Clamped progress value between 0 and 1

  • Private

    Calculate return for fixed-return glidepath (linear interpolation).

    Parameters

    • age: number

      Current age

    • config: FixedReturnGlidepathConfig

      Fixed return configuration

    • startAge: number

      Starting age for calculation

    • endAge: number

      Ending age for calculation

    Returns number

    Annual return rate

  • Private

    Calculate return for stepped-return glidepath (Money Guy style).

    Parameters

    Returns number

    Annual return rate

  • Private

    Calculate return for allocation-based glidepath.

    Parameters

    • age: number

      Current age

    • config: AllocationBasedGlidepathConfig

      Allocation-based configuration

    • startAge: number

      Starting age for calculation

    • endAge: number

      Ending age for calculation

    Returns number

    Annual return rate

  • Private

    Interpolate a value between waypoints for a given age.

    Parameters

    • age: number

      Current age

    • waypoints: {
          age: number;
          value: number;
      }[]

      Array of waypoints (already sorted)

    Returns number

    Interpolated value at the given age

  • Private

    Calculate blended return based on equity and bond allocation.

    Parameters

    • equityWeight: number

      Equity allocation weight (0.0 to 1.0)

    • equityReturn: number

      Expected annual equity return

    • bondReturn: number

      Expected annual bond return

    Returns number

    Blended annual return rate

  • Private

    Get the current equity weight for allocation-based and custom waypoints configurations. Used for timeline data enrichment.

    Parameters

    • age: number

      Current age

    • config: DynamicGlidepathConfig

      Glidepath configuration

    • startAge: number

      Starting age for age-based calculations

    • endAge: number

      Ending age for age-based calculations

    Returns undefined | number

    Equity weight (0.0 to 1.0) or undefined for non-allocation modes

  • Private

    Convert annual interest rate to monthly compounding rate. Formula: monthlyRate = (1 + annualRate)^(1/12) - 1

    Parameters

    • annualRate: number

      Annual interest rate (decimal)

    Returns number

    Monthly compounding rate (decimal)

Generated using TypeDoc