parts = formula.split("~")
parts[1] = " 0 + " + parts[1]
parts[1], entity_effect = PanelOLS._parse_effect(parts[1], "EntityEffect")
parts[1], fixed_effect = PanelOLS._parse_effect(parts[1], "FixedEffect")
if entity_effect and fixed_effect:
raise ValueError("Cannot use both FixedEffect and EntityEffect")
entity_effect |= fixed_effect
After Change
effects = {"EntityEffect":False, "FixedEffect":False, "TimeEffect":False}
for term in mod_descr.rhs_termlist:
if term.name() in effects:
effects[term.name()] = True
rm_list.append(term)
for term in rm_list:
mod_descr.rhs_termlist.remove(term)
if effects["EntityEffect"] and effects["FixedEffect"]:
raise ValueError("Cannot use both FixedEffect and EntityEffect")
entity_effect = effects["EntityEffect"] or effects["FixedEffect"]
time_effect = effects["TimeEffect"]