Docs / nablatensor-quant / com.nablatensor.quant.estimate

final class

CorrelationEstimator

Sample and exponentially weighted covariance / correlation matrices for a panel of return series — the multivariate companions of Ewma, and the input Pca decomposes.

returns[k] is the k-th series (all the same length); the result is n x n for n series. Series are treated as zero-mean for the EWMA estimator (the RiskMetrics convention) and demeaned for the sample estimator.

Methods

static double[][] sampleCovariance(double[][] returns)

Demeaned sample covariance, divisor T - 1.

static double[][] toCorrelation(double[][] cov)

Correlation matrix from a covariance matrix.

static double[][] sampleCorrelation(double[][] returns)

Demeaned sample correlation.

static double[][] ewmaCovariance(double[][] returns, double lambda)

EWMA covariance with decay lambda, seeded with the sample covariance and rolled forward over all observations (zero-mean series).

static double[][] ewmaCorrelation(double[][] returns, double lambda)

EWMA correlation with decay lambda.