linearmodels/invalid-compare-precision
| Rule | invalid-compare-precision |
|---|---|
| Pack | linearmodels |
| Severity | error |
| Fix | unsafe, with xpd check --fix --unsafe-fixes |
| Library versions | every version |
compare takes only "tstats", "std_errors" or "pvalues" for precision, so another value raises ValueError. Use the name that compare takes for the same number.
table = compare({"pooled": pooled, "fixed": fixed}, precision="se")table = compare({"pooled": pooled, "fixed": fixed}, precision="std_errors")What the rule reports
Section titled “What the rule reports”The rule reports compare(..., precision=...) of linearmodels.panel or linearmodels.iv with a
string other than "tstats", "std_errors", "std-errors" and "pvalues".
How to fix it
Section titled “How to fix it”xpd check --fix --unsafe-fixes applies the fixes of this rule. Check the result, because an unsafe fix can change what the code does.
The unsafe fix writes "std_errors" for "se", "stderr", "std_err" and "bse", "tstats" for "t", "tstat" and "t-stats", and "pvalues" for "p" and "pvalue". The call raised before the fix. Any other string has no fix.
On 7.1 and 7.0 both functions took the four strings in any case, and raised ValueError: Unknown precision value. Must be one of 'tstats', 'std_errors' or 'pvalues'. for "se", "stderr", "t", "p", "tstat", "std_err", "pvalue", "t-stats" and "bse". The four strings were also read from the source. The rule reads compare only when the file imports it from linearmodels or calls it through the module.
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
compare takes "tstats", "std_errors" or "pvalues" for precision, and $P raises ValueError with "Unknown precision value." Write the name that compare takes for the same number, such as precision="std_errors" for "se".Browse the other rules of the linearmodels pack.