| fml |
str |
A two-sided formula string using fixest formula syntax. Syntax: “Y ~ X1 + X2 | FE1 + FE2”. “|” separates left-hand side and fixed effects. Special syntax includes: - Stepwise regressions (sw, sw0) - Cumulative stepwise regression (csw, csw0) - Multiple dependent variables (Y1 + Y2 ~ X) - Interaction of variables (i(X1,X2)) - Interacted fixed effects (fe1^fe2) Compatible with formula parsing via the formulaic module. |
required |
| data |
DataFrameType |
A pandas or polars dataframe containing the variables in the formula. |
required |
| vcov |
Union[VcovTypeOptions, dict[str, str]] |
Type of variance-covariance matrix for inference. Options include “iid”, “hetero”, “HC1”, “HC2”, “HC3”, “NW” for Newey-West HAC standard errors, “DK” for Driscoll-Kraay HAC standard errors, or a dictionary for CRV1/CRV3 inference. Note that NW and DK require to pass additional keyword arguments via the vcov_kwargs argument. For time-series HAC, you need to pass the ‘time_id’ column. For panel-HAC, you need to add pass both ‘time_id’ and ‘panel_id’. See vcov_kwargs for details. |
None |
| vcov_kwargs |
Optional[dict[str, any]] |
Additional keyword arguments to pass to the vcov function. These keywoards include “lag” for the number of lag to use in the Newey-West (NW) and Driscoll-Kraay (DK) HAC standard errors. “time_id” for the time ID used for NW and DK standard errors, and “panel_id” for the panel identifier used for NW and DK standard errors. Currently, the the time difference between consecutive time periods is always treated as 1. More flexible time-step selection is work in progress. |
None |
| ssc |
str |
A ssc object specifying the small sample correction for inference. |
None |
| fixef_rm |
FixedRmOptions |
Specifies whether to drop singleton fixed effects. Can be equal to “singletons” (default) or “none”. “singletons” will drop singleton fixed effects. This will not impact point estimates but it will impact standard errors. |
'singleton' |
| fixef_tol |
float |
Tolerance for the fixed effects demeaning algorithm. Defaults to 1e-08. |
1e-08 |
| fixef_maxiter |
int |
Maximum number of iterations for the demeaning algorithm. Defaults to 100,000. |
100000 |
| iwls_tol |
Optional[float] |
Tolerance for IWLS convergence, by default 1e-08. |
1e-08 |
| iwls_maxiter |
Optional[float] |
Maximum number of iterations for IWLS convergence, by default 25. |
25 |
| collin_tol |
float |
Tolerance for collinearity check, by default 1e-10. |
1e-09 |
| separation_check |
Optional[list[str]] |
Methods to identify and drop separated observations. Either “fe” or “ir”. Executes “fe” by default (when None). |
None |
| solver |
SolverOptions, optional. |
The solver to use for the regression. Can be “np.linalg.lstsq”, “np.linalg.solve”, “scipy.linalg.solve”, “scipy.sparse.linalg.lsqr” and “jax”. Defaults to “scipy.linalg.solve”. |
'scipy.linalg.solve' |
| demeaner_backend |
DemeanerBackendOptions |
The backend to use for demeaning. Options include: - “numba” (default): CPU-based demeaning using Numba JIT via the Alternating Projections Algorithm. - “rust”: CPU-based demeaning implemented in Rust via the Alternating Projections Algorithm. - “jax”: CPU or GPU-accelerated using JAX (requires jax/jaxlib) via the Alternating Projections Algorithm. - “cupy” or “cupy64”: GPU-accelerated using CuPy with float64 precision via direct application of the Frisch-Waugh-Lovell Theorem on sparse matrices (requires cupy & GPU, defaults to scipy/CPU if no GPU available) - “cupy32”: GPU-accelerated using CuPy with float32 precision via direct application of the Frisch-Waugh-Lovell Theorem on sparse matrices (requires cupy & GPU, defaults to scipy/CPU and float64 if no GPU available) - “scipy”: Direct application of the Frisch-Waugh-Lovell Theorem on sparse matrice. Forces to use a scipy-sparse backend even when cupy is installed and GPU is available. Defaults to “numba”. |
'numba' |
| drop_intercept |
bool |
Whether to drop the intercept from the model, by default False. |
False |
| copy_data |
bool |
Whether to copy the data before estimation, by default True. If set to False, the data is not copied, which can save memory but may lead to unintended changes in the input data outside of fepois. For example, the input data set is re-index within the function. As far as I know, the only other relevant case is when using interacted fixed effects, in which case you’ll find a column with interacted fixed effects in the data set. |
True |
| store_data |
bool |
Whether to store the data in the model object, by default True. If set to False, the data is not stored in the model object, which can improve performance and save memory. However, it will no longer be possible to access the data via the data attribute of the model object. This has impact on post-estimation capabilities that rely on the data, e.g. predict() or vcov(). |
True |
| lean |
bool |
False by default. If True, then all large objects are removed from the returned result: this will save memory but will block the possibility to use many methods. It is recommended to use the argument vcov to obtain the appropriate standard-errors at estimation time, since obtaining different SEs won’t be possible afterwards. |
False |
| context |
int or Mapping[str, Any] |
A dictionary containing additional context variables to be used by formulaic during the creation of the model matrix. This can include custom factorization functions, transformations, or any other variables that need to be available in the formula environment. |
None |
| split |
Optional[str] |
A character string, i.e. ‘split = var’. If provided, the sample is split according to the variable and one estimation is performed for each value of that variable. If you also want to include the estimation for the full sample, use the argument fsplit instead. |
None |
| fsplit |
Optional[str] |
This argument is the same as split but also includes the full sample as the first estimation. |
None |