You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Very often in panel regression, the fixed effect is implemented as categorical variable. Currently, unless using some hacky way, patsy cannot read put index as variables. See below example panel dataset,
import statsmodels.api as sm
df_raw = sm.datasets.get_rdataset('pwt_sample', 'stevedata').data.set_index(['isocode', 'year']).drop(['country'], axis=1)
df = df_raw.dropna()
print(df)
Very often we need patsy to do a regression with from_formula which indeed uses patsy.dmatrices:
sm.OLS.from_formula('pop ~ rgdpna + year + C(isocode)', df_raw).fit().summary()
This prompts errors:
PatsyError: Error evaluating factor: NameError: name 'isocode' is not defined
pop ~ rgdpna + year + C(isocode)
^^^^^^^^^^
Very often it has the panel dimension is in the index level and users would like to use them in fixed effect and endog. Any chance patsy could support to use dataframe index? Thanks.
The text was updated successfully, but these errors were encountered:
patsy is in maintenance (only) mode, and so this behavior is unlikely to change. Looking in the index is also potentially problematic since there might be named indices with the same names as columns. Enabling this could mean perfectly valid code under the existing rules becomes ambiguous.
Very often in panel regression, the fixed effect is implemented as categorical variable. Currently, unless using some hacky way,
patsy
cannot read put index as variables. See below example panel dataset,And the panel dataframe looks like:
Very often we need patsy to do a regression with
from_formula
which indeed usespatsy.dmatrices
:This prompts errors:
Very often it has the panel dimension is in the index level and users would like to use them in fixed effect and endog. Any chance
patsy
could support to use dataframe index? Thanks.The text was updated successfully, but these errors were encountered: