Skip to content

New module: StudentLoan.fs — UK Plans 1/2/4/5 and US IBR income-contingent repayment - #63

Draft
simontreanor with Copilot wants to merge 2 commits into
mainfrom
copilot/add-studentloan-module
Draft

simontreanor with Copilot wants to merge 2 commits into
mainfrom
copilot/add-studentloan-module

Conversation

Copilot AI commented Apr 28, 2026

Copy link
Copy Markdown

Adds a StudentLoan module modelling income-contingent student loan repayments for UK Plans 1, 2, 4, and 5 and the US IBR scheme.

Types

  • PlanUkPlan1 | UkPlan2 | UkPlan4 | UkPlan5 | UsIbr
  • RepaymentRate — percentage of income above threshold applied annually
  • ThresholdUpratingFixed | Rpi | GovernmentPolicy
  • InterestMethodNoInterest | Fixed | RpiOnly | RpiPlusScaledMargin (Plan 2 linearly scales from RPI to RPI+3% between ~£27,295–£49,130)
  • WriteOffCondition — years until remaining balance is written off
  • WriteOffEstimateFullyRepaid of year | PartialWriteOff of remainingBalance
  • ProjectionYear — annual snapshot (income, threshold, repayment, interest charged, closing balance)

Core functions

  • planDefaults — returns (RepaymentRate, WriteOffCondition, InterestMethod) for a given plan and RPI rate
  • annualRepaymentrate% × max(income − threshold, 0)
  • annualInterestRate — resolves the applicable rate for a given income and InterestMethod
  • uprateThreshold — applies RPI or policy-rate uprating
  • projectBalance — builds a ProjectionYear array up to write-off or full repayment
  • estimatedWriteOff — top-level summary returning FullyRepaid or PartialWriteOff

Example

open FSharp.Finance.Personal.StudentLoan

// Project a Plan 2 borrower with £45,000 balance, £35,000 income, 2% income growth, 3.1% RPI
let (repRate, writeOff, interest) = planDefaults Plan.UkPlan2 (Percent 3.1m)

let projection =
    projectBalance
        4500_000L<Cent>          // £45,000
        3500_000L<Cent>          // £35,000 income
        2729_500L<Cent>          // Plan 2 threshold
        (Percent 2m)             // income growth
        (ThresholdUprating.Rpi (Percent 3.1m))
        repRate
        interest
        writeOff

let outcome = estimatedWriteOff ... // WriteOffEstimate.PartialWriteOff or FullyRepaid

All monetary values follow the existing int64<Cent> convention; percentages use Calculation.Percent.

Copilot AI linked an issue Apr 28, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add new module to model student loan repayments New module: StudentLoan.fs — UK Plans 1/2/4/5 and US IBR income-contingent repayment Apr 28, 2026
Copilot AI requested a review from simontreanor April 28, 2026 23:10

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New module: StudentLoan.fs (UK Plans 1/2/4/5 and US IBR)

2 participants