linearmodels.panel.model.PanelOLS.fit¶
-
PanelOLS.fit(*, use_lsdv: bool =
False
, use_lsmr: bool =False
, low_memory: bool | None =None
, cov_type: str ='unadjusted'
, debiased: bool =True
, auto_df: bool =True
, count_effects: bool =True
, **cov_config: bool | float | str | ndarray | DataFrame | PanelData) PanelEffectsResults [source]¶ Estimate model parameters
- Parameters:¶
- use_lsdv: bool =
False
¶ 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_lsmr: bool =
False
¶ Flag indicating to use LSDV with the Sparse Equations and Least Squares estimator to eliminate the fixed effects.
- low_memory: bool | None =
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_type: str =
'unadjusted'
¶ Name of covariance estimator. See Notes.
- debiased: bool =
True
¶ Flag indicating whether to debiased the covariance estimator using a degree of freedom adjustment.
- auto_df: bool =
True
¶ 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_effects: bool =
True
¶ 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
.- **cov_config
Additional covariance-specific options. See Notes.
- use_lsdv: bool =
- Returns:¶
Estimation results
- Return type:¶
Examples
>>> from linearmodels import PanelOLS >>> mod = PanelOLS(y, x, entity_effects=True) >>> res = mod.fit(cov_type="clustered", cluster_entity=True)
Notes
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 1 or 2 variables. Clusters should be integer valued, although other types will be coerced to integer values by treating as categorical variablescluster_entity
- Boolean flag indicating to use entity clusterscluster_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.