Get the covariance in log returns from a blob of curves.
Description
Get the covariance in log returns from a blob of curves.
Details
The function treats each row of the blob as a curve. For the result to be sensible each row must be the same length and each column must relate the same maturities across rows.
The result is a covariance matrix of the log returns.
More precisely, if the original blob is a matrix \( M_{rate} \) where element \( (i,j) \) is the rate with maturity \( (j) \) in row \( (i) \) then we construct a new matrix:
$$ M_{return}(i,j) = \ln \left( \frac{M_{rate}(i+1,j)}{M_{rate}(i,j)} \right) $$
And the result is a matrix where:
$$ M_{result}(i,j) = Cov\left( M_{return}(,i),M_{return}(,j) \right) $$
Example Sheet
PCA.xlsx
Arguments
- curves Blob of curves, each row is a curve of the same length.