bashtage / linearmodels

Additional linear models including instrumental variable and panel data models that are missing from statsmodels.

Home Page:https://bashtage.github.io/linearmodels/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BUG: formula with whitespace isn't parsed despite `formulaic` being able to do the same

amichuda opened this issue · comments

Hi,

I'm using linearmodels==4.26

PanelOLS can't seem to parse a formula with whitespace, while formulaic can:

from formulaic import model_matrix
import pandas as pd
from linearmodels import PanelOLS

d = pd.DataFrame({'var a' : [1,2.3]})

model_matrix("`var a` ~ 1", data=d)

PanelOLS.from_formula('`var a` ~ 1', data=d)

where I get this error from linearmodels:

FormulaSyntaxError: Missing operator between `var` and `a`.

0 + ⧛var a⧚

while formulaic outputs the model.

I think this might a bug?

This is almost certanily my fault as I handle EntityEffect myself, and probably in a way that is not compatible with formulaic. Thanks for the report.