bugfix: Erroneous values in line 2400 (net profit)#8
Merged
memoryfull merged 4 commits intomainfrom May 13, 2025
Merged
Conversation
a05b811 to
1465ce3
Compare
1465ce3 to
2e2b960
Compare
Author
|
Upon further investigation, I found bugs in adjustment of lines 1300 and 2500 (#9) and, more importantly, inconsistency in of handling signs in negative-only and signed variables (#10). As resolving both #7 and #9 were dependent on resolving #10 they are all fixed in one commit #8. The updated lines 2400 are quite different from the original values. The value of line 2400 changed in 6-11% of observations in 2011-2018 and in about 25% observations in 2019-2023, the summed difference in the original and new values ranges from 5% to 110% depending on year. The fix for sign inconsistency implies revising scripts for all calculations where negative-only, those ()-ed in statement forms, variables were used. |
Contributor
|
LGTM, thank you. |
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.
The reason for the incorrect values was the sign with which the profit tax (line 2410) enters the calculation for adjusting net profit (2400).
In the reporting forms, there are lines with values enclosed in parentheses: this means that they can only be negative, but they need to be entered as positive. However, it sometimes happens that companies enter negative values in these fields. To correct this, during the data preparation stage, we make all values of the ()-ed lines positive. At first, I thought it was there that the problem occurred, because I missed line 2410 while compiling the list of ()-ed lines. But this was not the case: the list is correct, and line 2410 can indeed be both negative and positive — but only in the full statement form. In simplified form it is strictly negative, in parentheses. This is a useful side finding: now the correction of the ()-ed lines occurs separately for the firms that use simplified and non-simplified forms for their statements.
The error was further down the process, in the values adjustment part, where we check summary lines like 2400 against their recalculated values and change them if the difference is more than 4000 rubles. To subtract the profit tax from profit, we multiplied line 2410 by -1, as if it were ()-ed while it wasn't. I corrected this and changed the logic for adjusting line 2410 itself: previously, we adjusted it based on lines 2411 and 2412 only starting from 2020, when its content changed, but now the logic is expanded to all years. This should help with companies that were the first to implement the changes back in 2019, and it does not break anything for others. I checked it on a random set of selected companies, and it looks fine.