Reject the two point window Beta, Correlation and Covariance describe - #9728
Open
mkzung wants to merge 1 commit into
Open
Reject the two point window Beta, Correlation and Covariance describe#9728mkzung wants to merge 1 commit into
mkzung wants to merge 1 commit into
Conversation
All three carry the comment "assert the period is greater than two" and
raise "must be greater than 2 but was {period}", and all three test
period < 2, so a period of two reaches the calculation.
Two points always correlate perfectly. Fed ten bars of two series that are
not proportional, Correlation at period 2 returns 1 or -1 on every one of
its nine readings, while at period 3 the same series gives values between
-0.40 and 0.33. Beta and Covariance share the window.
ValueAtRisk states the same bound and tests period < 3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Beta,CorrelationandCovariancenow testperiod < 3, which is the bound their comment and their message already state.Related Issue
Closes #9725
Motivation and Context
All three carry the comment "assert the period is greater than two", raise "must be greater than 2 but was {period}", and then test
period < 2, so a period of two reaches the calculation.Two points always correlate perfectly. Fed ten bars of two series that are not proportional,
Correlationat period 2 returns 1 or -1 on every one of its nine readings:BetaandCovarianceshare that window throughDualSymbolIndicator.ValueAtRiskstates the same bound and testsperiod < 3.Requires Documentation Change
No.
How Has This Been Tested?
One test per indicator, copied from
ValueAtRiskTests.PeriodBelowMinimumThrows.Keeping the tests and reverting the three source files:
with them in place, including the Spearman fixture:
Nothing in
Tests/,Algorithm.CSharp/orAlgorithm.Python/constructs any of the three with a period of 2, so no existing caller changes; the smallest literal in use is 3.Types of changes
Checklist:
bug-<issue#>-<description>orfeature-<issue#>-<description>