linearmodels.panel.model.RandomEffects.fit

RandomEffects.fit(*, small_sample: bool = False, cov_type: str = 'unadjusted', debiased: bool = True, **cov_config: bool | float | str | ndarray | DataFrame | PanelData) RandomEffectsResults[source]

Estimate model parameters

Parameters:
small_sample: bool = False

Apply a small-sample correction to the estimate of the variance of the random effect.

cov_type: str = 'unadjusted'

Name of covariance estimator (see notes). Default is “unadjusted”.

debiased: bool = True

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

**cov_config: bool | float | str | ndarray | DataFrame | PanelData

Additional covariance-specific options. See Notes.

Returns:

Estimation results

Return type:

linearmodels.panel.results.RandomEffectsResults

Examples

>>> from linearmodels import RandomEffects
>>> mod = RandomEffects(y, x)
>>> res = mod.fit(cov_type="clustered", cluster_entity=True)

Notes

Four 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 1 or 2 variables. Clusters should be integer values, 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.