-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
wald_test #523
Comments
Hi, Can you provide me with a copy-pastable example that raises the issue? Thanks, |
import linearmodels as plm
from linearmodels.datasets import wage_panel
df = wage_panel.load()
df = df.set_index(["nr","year"])
idx = df.index
df = df.reset_index()
df.index=idx
fm = 'lwage ~ C(year)*educ + union + EntityEffects'
model2 = plm.PooledOLS.from_formula(formula=fm,data=df).fit(cov_type='clustered',debiased=True, cluster_entity=True) |
Kevin, Python implementation: CPython Compiler : MSC v.1916 64 bit (AMD64) import linearmodels as plm df = wage_panel.load() null = 'C(year)[T.1984]:educ = 0' FormulaSyntaxError: Unknown operator '['. null = 'C(year,Treatment(1984)):educ = 0' FormulaSyntaxError: Unknown operator ':'. |
I think you need to escale terms that are not valid Python, e.g., null = '`C(year,Treatment(1984)):educ` = 0' Note the ticks around the entire variable name. I'll need to check that this works, but it should. Note: There was a recently fixed regression in formulaic that might affect escaping. This should be fixed in the next release of formulaic. |
Sorry, I did not know where to place this issue of mine. I have not found a solution online either.
The wald_test does not allow for brackets [ ] or semicolon :, which seems to be an issue when you use the formula operators like C( ) and interacting terms. Below is a sample of the code.
fm = 'lwage ~ C(year)*educ + union + EntityEffects'
model2 = plm.PooledOLS.from_formula(formula=fm,data=df).fit(cov_type='clustered',debiased=True, cluster_entity=True)
null = "C(year)[T.1987]:educ = 0, C(year)[T.1986]:educ = 0"
model2.wald_test(formula=null)
FormulaSyntaxError: Unknown operator '['.
C(year)⧛[⧚T.1987]:educ
I have tried replacing C(year, Treatment(1987)):educ, C(year, Treatment(1987))*educ with no joy. I have tested the similar syntax in statsmodels and it works fine with [ ] and :.
The text was updated successfully, but these errors were encountered: