Comments (2)
Stata is choosing to use a student's t. Since there is no obvious justification aside from strong assumptions (gaussian residuals), I do not follow that practice. If you use an appropriate student's t to compute the p-value, you will get the same value.
from linearmodels.
It does not seem to be the problem of Student's t
vs Gaussian residuals. Rather, the difference seems to be caused by degree of freedom.
Define the following:
N
: number of observations
n
: number of entities
k
: number of parameters
In the example above, linearmodels
uses Student's t
with degree of freedom df_resid
which is N-n-k
, whereas Stata uses n-1
(I have not written n-k
, see blelow). This is numerically confirmed by the following code:
(resc
in the above code is used)
import numpy as np
from scipy.stats import t
pval_manual_calc = 2*t.cdf(resc.tstats['hrsemp'], resc.df_resid)
pval_auto_calc = resc.pvalues['hrsemp']
np.isclose(pval_auto_calc, pval_manual_calc)
which gives True
.
To reproduce the Stata result
n_1 = int(resc.entity_info['total']-1)
2*t.cdf(resc.tstats['hrsemp'], n_1)
giving 0.007087663950431981
, which is the value Stata returns.
See the following links for discussion on the use of n-1
(not n-k
) for Stata.
from linearmodels.
Related Issues (20)
- ENH: Add average adjusted R2 in FamaMacBeth HOT 3
- Add Adjusted R-Square to linearmodels.panel.results.PanelEffectsResults HOT 1
- Variables order in results HOT 8
- Tests fail to run: E ModuleNotFoundError: No module named 'interface_meta' HOT 7
- wald_test HOT 4
- Option to avoid MissingValueWarning warning. HOT 3
- Suggestion: Implement a `.remove_data` function for Results
- Min. obs pr Entities/Time Periods is sometimes reported as 0 HOT 3
- Small sample correction clustered avaialble? HOT 2
- Clustered standard errors in `lineramodels` and `statsmodels` HOT 3
- PanelOLS : Dropping absorbed variables doesn't work with sample weights HOT 2
- 14 tests fail HOT 2
- ENH: Implement 2+ fixed-effect with multi-way clustering OLS
- Estimated Effects in random effect HOT 7
- Different results for Random Effects models for Python vs Stata HOT 5
- Fixed effects std. error and p-values HOT 2
- Sanitize extra text from summary
- Interaction terms for Categorical Variables in a RE Model HOT 4
- Typo in doc in Driscoll-Kraay formula
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linearmodels.