Mean-Absolute-Deviation Optimization
Install and import#
npm install fintech-algorithmsimport { meanMad } from "fintech-algorithms/portfolio-construction/mean-risk-optimization/mean-absolute-deviation-optimization";Signature#
meanMad(assetIdsInput, returnsInput, probabilitiesInput, targetReturnInput, options)Minimizes mean absolute deviation subject to a return target by solving the linear program the absolute value reduces to, over a discrete scenario set.
Parameters#
| Name | Type | Notes |
|---|---|---|
assetIdsInput | unique string array | stable input order |
returnsInput | finite `T×N` matrix | simple returns, one horizon and base currency |
probabilitiesInput | finite length-`T` array | scenario mass |
targetReturnInput | finite number | same horizon/unit as returns |
options | { maxIterations?: unknown; } | optional |
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#
["DISPERSED", "STABLE"][
[0.2, 0.03],
[0.1, 0.03],
[0.05, 0.03]
]Showing 3 of 4 elements.
[0.25, 0.25, 0.25, 0.25]0.055Call#
meanMad(assetIdsInput, returnsInput, probabilitiesInput, targetReturnInput, options)Returns#
object with 17 fields: status, variant, method, assetIds, weights, meanReturns, expectedReturn, mad, …
{
"status": "optimal",
"variant": "mean-mad-return-floor-long-only",
"method": "lp-vertex-enumeration",
"assetIds": ["DISPERSED", "STABLE"],
"weights": [0.49999999999999983, 0.5000000000000002],
"meanReturns": [0.08000000000000002, 0.03],
"expectedReturn": 0.05499999999999999,
"mad": 0.03499999999999999,
"targetReturn": 0.05499999999999999,
"budgetResidual": 0,
"lowerBoundResidual": 0,
"targetResidual": 0,
"probabilityResidual": 0,
"iterations": 3003
}Showing 14 of 17 fields.
Diagrams#
Calculation flow#
Diagram
flowchart TB A["Validate rows and mass"] B["Center around the mean"] C["Build deviation LP"] D["Impose return floor"] E["Audit MAD and feasibility"] A --> B --> C --> D --> E
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.
References#
- Primary source
- Implementation corroboration
- Evidence classification
- Source roles
- 2026-09-16