# Coding method 1 from linearmodels.panel import PanelOLS import statsmodels.api as sm exog = sm.add_constant(fatalities[['beertax','mlda','jaild', 'comserd','vmiles','unrate','perinc']]) fe = PanelOLS(fatalities['mrall'], exog, entity_effects=True, time_effects=True) fe = fe.fit() print(fe) # Coding method 2 from linearmodels.panel import PanelOLS fe = PanelOLS.from_formula("mrall ~ beertax + mlda + jaild + comserd + vmiles + unrate + perinc + EntityEffects + TimeEffects", data=fatalities) print(fe.fit())