---
title: "Clustering-Based Linearly Shrunk Empirical Covariance Matrix"
method: POST
path: "/assets/covariance/matrix/estimation/empirical/shrunk/clustering-based"
tags: ["Assets / Covariance Matrix Estimation"]
---

# Clustering-Based Linearly Shrunk Empirical Covariance Matrix

`POST /assets/covariance/matrix/estimation/empirical/shrunk/clustering-based`

## Request

- Base URL: `https://api.portfoliooptimizer.io/v1`
- URL: `https://api.portfoliooptimizer.io/v1/assets/covariance/matrix/estimation/empirical/shrunk/clustering-based`
- Auth: API key in header `X-API-Key`

Compute a clustering-based linearly shrunk empirical asset covariance matrix, which is a convex combination of the empirical covariance matrix of these assets' and a clustering-based target covariance matrix.

The available clustering-based target covariance matrices are the same as those available in the endpoint /assets/covariance/matrix/estimation/empirical/shrunk, extended to a clustering-based context.

References
* [Olivier Ledoit, Michael Wolf, The Power of (Non-)Linear Shrinking: A Review and Guide to Covariance Matrix Estimation, Journal of Financial Econometrics, Volume 20, Issue 1, Winter 2022, Pages 187–218](https://academic.oup.com/jfec/article-abstract/20/1/187/5861007?redirectedFrom=fulltext)
* [Gianluca De Nard, Oops! I Shrunk the Sample Covariance Matrix Again: Blockbuster Meets Shrinkage, Journal of Financial Econometrics, Volume 20, Issue 4, Fall 2022, Pages 569–611](https://academic.oup.com/jfec/article-abstract/20/4/569/5960228)
* [O. Ledoit, M. Wolf, Honey, I Shrunk the Sample Covariance Matrix, The Journal of Portfolio Management Summer 2004, 30 (4) 110-119](https://jpm.pm-research.com/content/30/4/110)
* [Schafer J, Strimmer K. A shrinkage approach to large-scale covariance matrix estimation and implications for functional genomics. Stat Appl Genet Mol Biol. 2005;4:Article32](https://pubmed.ncbi.nlm.nih.gov/16646851/)
* [Guillaume Becquin and Saher Esmeir. 2023. Semantic Similarity Covariance Matrix Shrinkage. In Findings of the Association for Computational Linguistics: EMNLP 2023, pages 9977–9992, Singapore. Association for Computational Linguistics](https://aclanthology.org/2023.findings-emnlp.668/)

## Request body

- object
  - `assets` object[], required
    - `assetReturns` number[], required: assetReturns[t] is the return of the asset at the time t; all assetReturns arrays must have the same length
  - `assetsGroups` array[], required
    - integer[]: assetsGroups[k] is the indexes of the assets belonging to the assets group k
  - `shrinkageTargetCovarianceMatrix` 'constantVarianceBlockCovarianceMatrix' | 'diagonalBlockCovarianceMatrix' | 'constantVarianceCovarianceBlockCovarianceMatrix' | 'constantCorrelationBlockCovarianceMatrix': The clustering-based target covariance matrix towards which to shrink the empirical covariance matrix of the assets returns
  - `shrinkageIntensityComputationMethod` 'manual' | 'quadraticMeanLossMinimization' | 'quadraticLossMinimization': The method to compute the shrinkage intensity; if not provided, defaults to the quadratic mean loss minimization procedure described in the references
  - `shrinkageIntensity` number: The shrinkage intensity to apply to the empirical covariance matrix of the assets returns when shrinkageIntensityComputationMethod is equal to 'manual'

## Response `200`

OK

- object
  - `assetsCovarianceMatrix` array[], required: assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
    - number[]

---

[API](https://skmtc.dev/portfoliooptimizer/apis/portfolio-optimizer.md) - [All operations](https://skmtc.dev/portfoliooptimizer/apis/portfolio-optimizer/llms.txt) - [OpenAPI document](https://skmtc.dev/portfoliooptimizer/apis/portfolio-optimizer/revisions/9d075aa717bf?raw)
