-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FamaMacBeth Std. Errors / T-Stats #168
Comments
Can you produce an example using simulated data that makes this happen? A small self-contained example makes it much easier to understand what is specifically happening. If not, could you describe the size of the data you are using, and provide the function call the produces issues? Are you rolling through the data and it occasionally occurs when rolling? Broadly something in the covariance matrix estimation is not positive definite. This is producing nan values which then propagate. |
Unfortunately, I have not been able to produce the error with simulated data. Thus, to create a minimal example, I have disguised my data and made it accessible via this dropbox link: https://www.dropbox.com/s/d7apc41c0pc86x3/FM_MinExampleData.pkl?dl=0 The data consists of roughly 30,000 observations, 700 entities and 50 times. The underlying panel is unbalanced. The function call is static, i.e. non-rolling. The function call (using the pickle provided in the dropbox link) is: import pandas as pd
import statsmodels.api as sm
from linearmodels import FamaMacBeth
#Load Sample
temp = pd.read_pickle('FM_MinExampleData.pkl')
temp.set_index(['Entity','Time'],inplace=True)
#FM Regression
fmbobj = FamaMacBeth(temp['Y'],sm.add_constant(temp[['X1','X2','X3','X4','X5','X6']]))
FMBres = fmbobj.fit(cov_type='kernel', kernel='parzen')
print(FMBres) |
Thanks - I found the issue, a bug (wrong place for parentheses) |
Fabulous! Many thanks |
I have encountered an issue pertaining to the computation of standard errors and measures dependent on them such as t-stats and p-values in the FamaMacBeth function. On some occasions the function will produce a parameter estimate, but no error statistics. More specifically, I receive a runtime warning of the following sort:
..../linearmodels/panel/results.py:70: RuntimeWarning: invalid value encountered in sqrt
Any suggestions are very welcome :)
The text was updated successfully, but these errors were encountered: