I am trying to fit a TWFE linear regression, so I have an endogenous (y) variable, entity effects and time effects. I just want to fit this regression: Y_it = \lambda_t + \gamma_i But, if I do not use an exogenous variable (X), I get the error of "missing exogenous positional argument". Here is some code to replicate the error: import pandas as pd from linearmodels.panel import PanelOLS # generate fake Panel data df = pd.DataFrame({ 'entity_id': [1, 1, 2, 2, 3, 3], 'time_id': [1, 2, 1, 2, 1, 2], 'y': [10, 15, 10, 20, 30, 40] }) # Set index for panel data (entity and time identifiers) df = df.set_index(['entity_id', 'time_id']) # Define the dependent variable y = df['y'] # Create and fit the Two-Way Fixed Effects model (without X) mod = PanelOLS(y, entity_effects=True, time_effects=True) res = mod.fit() On how to solve it: I know I can do it by creating the dummies with pd.concat, but I have a huge dataset so creating dummies is not a good idea. There has to be a way to do it, since in R and Stata this is possible. Thanks in advance Continue reading...