Repository navigation
BUG: Make nobs of the system results the number of observations of ea… - #803
Merged
Merged
Conversation
…ch equation
SystemResults.nobs of SUR, IV3SLS and IVSystemGMM was the number of observations
of all the equations, nobs * neq, the number of elements of the residuals. The
summary of the same results reports the number of observations of each equation,
as "No. Observations", the results of each equation have nobs equal to that
number, and every other model has the number of observations of the sample. A
system of 3 equations with 120 observations had nobs equal to 360.
nobs is now the number of observations of each equation: 120 in the example.
All the equations of a system use the same observations. A missing value in a
variable of any equation drops the row from all the equations, and the models
raise an error if the equations are given with different numbers of
observations ("All equations must have the same number of observations"), so
that this number is the same for every equation and there is no other rule to
choose.
The count of the observations of all the equations is still needed, by
df_resid (nobs * neq less the number of parameters), and so by the p-values and
the confidence intervals of a debiased covariance. SystemResults computes it
from nobs and the number of equations, and nothing else changes: df_resid, the
p-values and the confidence intervals are numerically the same. The summary
prints nobs. The results of each equation already had nobs per equation, and
their F-statistics do not change. There is no model comparison for the system
models.
test_nobs.py checks nobs, the summary, the shapes of the residuals, df_resid and
the degrees of freedom of the p-values and confidence intervals against an
independent computation, the effect of missing values, and the error for
equations with different numbers of observations, for SUR, IV3SLS and
IVSystemGMM with GLS and OLS (10 of its 23 tests fail before the change, the
others check what does not change). test_missing_values.py compared nobs with
nobs * neq for the system model.
The docstring of SystemResults, nobs and df_resid describe the definitions and
the change.
| for key in results.individual: | ||
| self._individual[key] = SystemEquationResult(results.individual[key]) | ||
| # The residual degrees of freedom count the observations of all equations | ||
| self._df_resid = len(self._individual) * self._nobs - self._df_model |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #803 +/- ##
==========================================
+ Coverage 99.60% 99.61% +0.01%
==========================================
Files 136 140 +4
Lines 26057 28098 +2041
Branches 1873 1976 +103
==========================================
+ Hits 25954 27991 +2037
- Misses 38 41 +3
- Partials 65 66 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
…ch equation
SystemResults.nobs of SUR, IV3SLS and IVSystemGMM was the number of observations of all the equations, nobs * neq, the number of elements of the residuals. The summary of the same results reports the number of observations of each equation, as "No. Observations", the results of each equation have nobs equal to that number, and every other model has the number of observations of the sample. A system of 3 equations with 120 observations had nobs equal to 360.
nobs is now the number of observations of each equation: 120 in the example. All the equations of a system use the same observations. A missing value in a variable of any equation drops the row from all the equations, and the models raise an error if the equations are given with different numbers of observations ("All equations must have the same number of observations"), so that this number is the same for every equation and there is no other rule to choose.
The count of the observations of all the equations is still needed, by df_resid (nobs * neq less the number of parameters), and so by the p-values and the confidence intervals of a debiased covariance. SystemResults computes it from nobs and the number of equations, and nothing else changes: df_resid, the p-values and the confidence intervals are numerically the same. The summary prints nobs. The results of each equation already had nobs per equation, and their F-statistics do not change. There is no model comparison for the system models.
test_nobs.py checks nobs, the summary, the shapes of the residuals, df_resid and the degrees of freedom of the p-values and confidence intervals against an independent computation, the effect of missing values, and the error for equations with different numbers of observations, for SUR, IV3SLS and IVSystemGMM with GLS and OLS (10 of its 23 tests fail before the change, the others check what does not change). test_missing_values.py compared nobs with nobs * neq for the system model.
The docstring of SystemResults, nobs and df_resid describe the definitions and the change.