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

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

dependent : array_like

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

exog : array_like

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

weights : array_like

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_effects : bool

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

time_effects : bool

Flag whether to include time effects in the model

other_effects : array_like

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

singletons : bool

Flag indicating whether to drop singleton observation

drop_absorbed : bool

Flag indicating whether to drop absorbed variables

check_rank : bool

Flag indicating whether to perform a rank check on the exogenous variables to ensure that the model is identified. Skipping this check can reduce the time required to validate a model specification. Results may be numerically unstable if this check is skipped and the matrix is not full rank.


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(*[, use_lsdv, use_lsmr, low_memory, ...])

Estimate model parameters

from_formula(formula, data, *[, weights, ...])

Create a model from a formula

predict(params, *[, exog, data, eval_env, ...])

Predict values for additional data


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