Gerber IQ covariance (b)
Statistics.cor — Method
Statistics.cor(
ce::GerberIQCovariance,
X::MatNum;
dims::Int = 1,
kwargs...
) -> MatNumCompute the Gerber IQ correlation matrix with the squeezing template in ce.kind and the marker in ce.alg.
The method computes the standard deviations with ce.ve, and it centres the returns with ce.me. gerber_IQ then computes the correlation.
The standard deviations have two uses. They scale the thresholds through gerber_iq_scaling. In cov, they also scale the correlation into a covariance.
Algorithm
- Orient
Xtoobservations × assetswithdims_oriented. - Compute the standard deviation of each asset with
ce.ve. - Raise each standard deviation to at least
eps(eltype(sd)). A constant asset then has a positive scale, and every scaled threshold is positive whencis positive. - Centre the returns with
ce.methroughdemean_returns. - Return the matrix that
gerber_IQcomputes from the centred returns and the standard deviations.
Arguments
ce: Gerber IQ covariance estimator.X: Data matrixobservations × assetsif thedimskeyword does not exist ordims = 1,assets × observationswhendims = 2.dims: Dimension along which the computation runs.kwargs...: Keyword arguments for the standard deviation estimator and fordemean_returns.
Validation
dimsis either1or2.
Returns
rho::MatNum: The Gerber IQ correlation matrix. Its diagonal is one for every asset.
An asset that never leaves its noise zone gets a zero row, because no observation adds to a pair that contains it. comovement_unit_diagonal! writes one on its diagonal entry. So the matrix stays a correlation matrix, and the asset is uncorrelated with every other asset. The sample gives no other information about the asset. To make the asset count, lower c. A short window and a quiet asset make this case more frequent.
Related
GerberIQCovarianceGerberIQCovarianceAlgorithmdemean_returnsgerber_IQcov(ce::GerberIQCovariance, X::MatNum; dims::Int = 1, kwargs...)
References
- [36] S. Gerber, W. Smyth, H. Markowitz, Y. Miao, P. Ernst and P. Sargen. Squeezing financial noise: A novel approach to covariance matrix estimation. Available at SSRN 4986939 (2025). Section 3.5.
Statistics.cov — Method
Statistics.cov(
ce::GerberIQCovariance,
X::MatNum;
dims::Int = 1,
kwargs...
) -> MatNumCompute the Gerber IQ covariance matrix with the squeezing template in ce.kind and the marker in ce.alg.
The method computes the standard deviations with ce.ve, and it centres the returns with ce.me. gerber_IQ then computes the correlation, and the method scales it by the standard deviations.
Mathematical definition
\[\begin{align} \hat{\mathbf{\Sigma}} &= \boldsymbol{\rho} \odot \left(\boldsymbol{\sigma} \boldsymbol{\sigma}^{\intercal}\right)\,. \end{align}\]
Where:
- $\hat{\mathbf{\Sigma}}$: Estimated covariance matrix.
- $\boldsymbol{\rho}$: Gerber IQ correlation matrix.
- $\boldsymbol{\sigma}$: Vector of asset standard deviations.
- $\odot$: Element-wise multiplication.
The covariance is the correlation of cor, scaled by the standard deviations that also scale its thresholds. So its diagonal is exactly $\boldsymbol{\sigma}^2$.
Algorithm
- Do the five steps of
cor(ce::GerberIQCovariance, X::MatNum; dims::Int = 1, kwargs...)to get the correlation matrix and the standard deviations. - Scale that matrix in place with
StatsBase.cor2cov!and the standard deviations, and return it.
Arguments
ce: Gerber IQ covariance estimator.X: Data matrixobservations × assetsif thedimskeyword does not exist ordims = 1,assets × observationswhendims = 2.dims: Dimension along which the computation runs.kwargs...: Keyword arguments for the standard deviation estimator and fordemean_returns.
Validation
dimsis either1or2.
Returns
sigma::MatNum: The Gerber IQ covariance matrix. Its diagonal is the variance of each asset, becausecor2cov!scales the unit diagonal of the correlation by $\boldsymbol{\sigma}^2$.
Related
GerberIQCovarianceGerberIQCovarianceAlgorithmdemean_returnsgerber_IQcor(ce::GerberIQCovariance, X::MatNum; dims::Int = 1, kwargs...)
References
- [36] S. Gerber, W. Smyth, H. Markowitz, Y. Miao, P. Ernst and P. Sargen. Squeezing financial noise: A novel approach to covariance matrix estimation. Available at SSRN 4986939 (2025). Section 3.5.
References
- [36]
- S. Gerber, W. Smyth, H. Markowitz, Y. Miao, P. Ernst and P. Sargen. Squeezing financial noise: A novel approach to covariance matrix estimation. Available at SSRN 4986939 (2025).