*, use_lsdv=False, use_lsmr=False, low_memory=None, cov_type='unadjusted', debiased=True, auto_df=True, count_effects=True, **cov_config)[source]

Estimate model parameters

use_lsdvbool, optional

Flag indicating to use the Least Squares Dummy Variable estimator to eliminate effects. The default value uses only means and does note require constructing dummy variables for each effect.

use_lsmrbool, optional

Flag indicating to use LSDV with the Sparse Equations and Least Squares estimator to eliminate the fixed effects.

low_memory{bool, None}

Flag indicating whether to use a low-memory algorithm when a model contains two-way fixed effects. If None, the choice is taken automatically, and the low memory algorithm is used if the required dummy variable array is both larger than then array of regressors in the model and requires more than 1 GiB .

cov_typestr, optional

Name of covariance estimator. See Notes.

debiasedbool, optional

Flag indicating whether to debiased the covariance estimator using a degree of freedom adjustment.

auto_dfbool, optional

Flag indicating that the treatment of estimated effects in degree of freedom adjustment is automatically handled. This is useful since clustered standard errors that are clustered using the same variable as an effect do not require degree of freedom correction while other estimators such as the unadjusted covariance do.

count_effectsbool, optional

Flag indicating that the covariance estimator should be adjusted to account for the estimation of effects in the model. Only used if auto_df=False.


Additional covariance-specific options. See Notes.


Estimation results


Three covariance estimators are supported:

  • ‘unadjusted’, ‘homoskedastic’ - Assume residual are homoskedastic

  • ‘robust’, ‘heteroskedastic’ - Control for heteroskedasticity using White’s estimator

  • ‘clustered` - One or two way clustering. Configuration options are:

    • clusters - Input containing containing 1 or 2 variables. Clusters should be integer valued, although other types will be coerced to integer values by treating as categorical variables

    • cluster_entity - Boolean flag indicating to use entity clusters

    • cluster_time - Boolean indicating to use time clusters

  • ‘kernel’ - Driscoll-Kraay HAC estimator. Configurations options are:

    • kernel - One of the supported kernels (bartlett, parzen, qs). Default is Bartlett’s kernel, which is produces a covariance estimator similar to the Newey-West covariance estimator.

    • bandwidth - Bandwidth to use when computing the kernel. If not provided, a naive default is used.


>>> from linearmodels import PanelOLS
>>> mod = PanelOLS(y, x, entity_effects=True)
>>> res ='clustered', cluster_entity=True)
Return type