fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Resampled Efficient Frontier

Install and import#

bash
npm install fintech-algorithms
ts
import { resampledEfficientFrontier } from "fintech-algorithms/portfolio-construction/bayesian-and-robust-allocation/resampled-efficient-frontier";

Signature#

resampledEfficientFrontier(returns, resampleIndices, ranks)

Averages optimizer weights across seeded bootstrap resamples at matching return rank, so the reported allocation reflects estimation noise rather than one sample.

Parameters#

NameTypeNotes
returns`T x n` matrixdecimal simple return/period
resampleIndicesnumber[][]
ranksvector[0,1]

Worked example#

executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.

Input#

returns
[
  [0.2, 0.1],
  [0, 0.1],
  [0.1, 0.2]
]

Showing 3 of 4 elements.

resampleIndices
[
  [0, 1, 2, 3]
]
ranks
[0, 0.5, 1]

Call#

resampledEfficientFrontier(returns, resampleIndices, ranks)

Returns#

object with 4 fields: ranks, averagedWeights, replicates, status

{
  "ranks": [0, 0.5, 1],
  "averagedWeights": [
    [0.5, 0.5],
    [0.5, 0.5],
    [0.5, 0.5]
  ],
  "replicates": [
    {
      "indices": [0, 1, 2, 3],
      "mean": [0.1, 0.1],
      "covariance": [
        [0.005000000000000001, 0],
        [0, 0.005000000000000001]
      ],
      "gmvReturn": 0.1,
      "maxReturn": 0.1,
      "weightsByRank": [
        [0.5, 0.5],
        [0.5, 0.5],
        [0.5, 0.5]
      ]
    }
  ],
  "status": "optimal"
}

Other exports#

This module also exports seededBootstrapIndices. Every module additionally exports run as an alias of its primary function, and a meta object carrying its catalog id, domain, family, shape and article URL.

Diagrams#

Resampled Efficient Frontier — article hero

Calculation flow#

Diagram
flowchart TB
    N0[Select aligned rows] --> N1
    N1[Estimate moments] --> N2
    N2[Map common ranks] --> N3
    N3[Solve each frontier] --> N4
    N4[Average matching ranks]

How it works#

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References#

  • Portfolio optimization by means of resampled efficient frontiers — US patent record; inventors Richard O. Michaud and Robert Michaud.
  • Resampled optimization — MOSEK ApS.
  • Efficient Asset Management — Richard O. Michaud.

The rest of the Bayesian and Robust Allocation family#