| setFixest_estimation | R Documentation |
This function sets globally the default arguments of fixest estimations.
setFixest_estimation(
data = NULL,
panel.id = NULL,
fixef.rm = "perfect_fit",
fixef.tol = 1e-06,
fixef.iter = 10000,
collin.tol = 1e-10,
lean = FALSE,
verbose = 0,
warn = TRUE,
fixef.keep_names = NULL,
demeaned = FALSE,
mem.clean = FALSE,
glm.iter = 25,
glm.tol = 1e-08,
data.save = FALSE,
reset = FALSE
)
getFixest_estimation()
data |
A data.frame containing the necessary variables to run the model.
The variables of the non-linear right hand side of the formula are identified
with this |
panel.id |
The panel identifiers. Can either be: i) a one sided formula
(e.g. |
fixef.rm |
Can be equal to "perfect_fit" (default), "singletons", "infinite_coef" or "none". This option controls which observations should be removed prior to the estimation. If "singletons", fixed-effects associated to a single observation are removed (since they perfectly explain it). The value "infinite_coef" only works with GLM families with limited left hand sides (LHS)
and exponential link.
For instance the Poisson family for which the LHS cannot be lower than 0, or the logit
family for which the LHS lies within 0 and 1.
In that case the fixed-effects (FEs) with only-0 LHS would lead to infinite coefficients
(FE = -Inf would explain perfectly the LHS).
The value If "perfect_fit", it is equivalent to "singletons" and "infinite_coef" combined. That means all observations that are perfectly explained by the FEs are removed. If "none": no observation is removed. Note that whathever the value of this options: the coefficient estimates will remain the same. It only affects inference (the standard-errors). The algorithm is recursive, meaning that, e.g. in the presence of several fixed-effects (FEs), removing singletons in one FE can create singletons (or perfect fits) in another FE. The algorithm continues until there is no singleton/perfect-fit remaining. |
fixef.tol |
Precision used to obtain the fixed-effects. Defaults to |
fixef.iter |
Maximum number of iterations in fixed-effects algorithm (only in use for 2+ fixed-effects). Default is 10000. |
collin.tol |
Numeric scalar, default is |
lean |
Logical scalar, default is |
verbose |
Integer. Higher values give more information. In particular, it can detail the number of iterations in the demeaning algorithm (the first number is the left-hand-side, the other numbers are the right-hand-side variables). |
warn |
Logical, default is |
fixef.keep_names |
Logical or |
demeaned |
Logical, default is |
mem.clean |
Logical scalar, default is |
glm.iter |
Number of iterations of the glm algorithm. Default is 25. |
glm.tol |
Tolerance level for the glm algorithm. Default is |
data.save |
Logical scalar, default is |
reset |
Logical scalar, default is |
The function getFixest_estimation returns the currently set global defaults.
#
# Example: removing singletons is FALSE by default
#
# => changing this default
# Let's create data with singletons
base = iris
names(base) = c("y", "x1", "x2", "x3", "species")
base$fe_singletons = as.character(base$species)
base$fe_singletons[1:5] = letters[1:5]
res = feols(y ~ x1 + x2 | fe_singletons, base)
res_noSingle = feols(y ~ x1 + x2 | fe_singletons, base, fixef.rm = "single")
# New defaults
setFixest_estimation(fixef.rm = "single")
res_newDefault = feols(y ~ x1 + x2 | fe_singletons, base)
etable(res, res_noSingle, res_newDefault)
# Resetting the defaults
setFixest_estimation(reset = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.