BUG: Revert returns cov to use ddof of 1.

Fix the spreadsheet to apply a factor of COUNT / COUNT - 1
to the COVAR value.

Also, go back to using the C[1][1] index instead of calculating
var independently.
This commit is contained in:
Eddie Hebert
2013-07-23 13:17:10 -04:00
parent f451efe483
commit 9b73373978
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -1,3 +1,4 @@
3ac0773c4be4e9e5bacd9c6fa0e03e15
3a5fae958c8bac684f1773fa8dff7810
19d580890e211a122e9e746f07c80cbc
70cfe3677a0ff401c801b8628e125d8f
+2 -2
View File
@@ -482,11 +482,11 @@ class RiskMetricsBase(object):
returns_matrix = np.vstack([self.algorithm_returns,
self.benchmark_returns])
C = np.cov(returns_matrix, ddof=0)
C = np.cov(returns_matrix, ddof=1)
eigen_values = la.eigvals(C)
condition_number = max(eigen_values) / min(eigen_values)
algorithm_covariance = C[0][1]
benchmark_variance = np.var(self.benchmark_returns, ddof=1)
benchmark_variance = C[1][1]
beta = algorithm_covariance / benchmark_variance
return (