class PanelOLS(dependent, exog, *, weights=None, entity_effects=False, time_effects=False, other_effects=None, singletons=True, drop_absorbed=False)[source]

One- and two-way fixed effects estimator for panel data


Dependent (left-hand-side) variable (time by entity).


Exogenous or right-hand-side variables (variable by time by entity).

weightsarray_like, optional

Weights to use in estimation. Assumes residual variance is proportional to inverse of weight to that the residual time the weight should be homoskedastic.

entity_effectsbool, optional

Flag whether to include entity (fixed) effects in the model

time_effectsbool, optional

Flag whether to include time effects in the model

other_effectsarray_like, optional

Category codes to use for any effects that are not entity or time effects. Each variable is treated as an effect.

singletonsbool, optional

Flag indicating whether to drop singleton observation

drop_absorbedbool, optional

Flag indicating whether to drop absorbed variables


Many models can be estimated. The most common included entity effects and can be described

\[y_{it} = \alpha_i + \beta^{\prime}x_{it} + \epsilon_{it}\]

where \(\alpha_i\) is included if entity_effects=True.

Time effect are also supported, which leads to a model of the form

\[y_{it}= \gamma_t + \beta^{\prime}x_{it} + \epsilon_{it}\]

where \(\gamma_i\) is included if time_effects=True.

Both effects can be simultaneously used,

\[y_{it}=\alpha_i + \gamma_t + \beta^{\prime}x_{it} + \epsilon_{it}\]

Additionally , arbitrary effects can be specified using categorical variables.

If both entity_effect and``time_effects`` are False, and no other effects are included, the model reduces to PooledOLS.

Model supports at most 2 effects. These can be entity-time, entity-other, time-other or 2 other.


fit(self, \*, use_lsdv, use_lsmr, …)

Estimate model parameters

from_formula(formula, data, numpy.ndarray, …)

Create a model from a formula

predict(self, params, …)

Predict values for additional data

reformat_clusters(self, clusters, …)

Reformat cluster variables



Flag indicating whether entity effects are included


Formula used to construct the model


Flag indicating the model a constant or implicit constant


Locations of non-missing observations


Flag indicating whether other (generic) effects are included


Flag indicating whether time effects are included