mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-31 12:10:31 +08:00
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:
@@ -1,3 +1,4 @@
|
||||
3ac0773c4be4e9e5bacd9c6fa0e03e15
|
||||
3a5fae958c8bac684f1773fa8dff7810
|
||||
19d580890e211a122e9e746f07c80cbc
|
||||
70cfe3677a0ff401c801b8628e125d8f
|
||||
|
||||
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user