Usage
# S3 method for fixest
coef(object, keep, drop, order, collin = FALSE, agg = TRUE, ...)
# S3 method for fixest
coefficients(object, keep, drop, order, collin = FALSE, agg = TRUE, ...)
Arguments
- object
A
fixest
object. Obtained using the functionsfemlm
,feols
orfeglm
.- keep
Character vector. This element is used to display only a subset of variables. This should be a vector of regular expressions (see
base::regex
help for more info). Each variable satisfying any of the regular expressions will be kept. This argument is applied post aliasing (see argumentdict
). Example: you have the variablex1
tox55
and want to display onlyx1
tox9
, then you could usekeep = "x[[:digit:]]$"
. If the first character is an exclamation mark, the effect is reversed (e.g. keep = "!Intercept" means: every variable that does not contain “Intercept” is kept). See details.- drop
Character vector. This element is used if some variables are not to be displayed. This should be a vector of regular expressions (see
base::regex
help for more info). Each variable satisfying any of the regular expressions will be discarded. This argument is applied post aliasing (see argumentdict
). Example: you have the variablex1
tox55
and want to display onlyx1
tox9
, then you could usedrop = "x[[:digit:]]{2}
". If the first character is an exclamation mark, the effect is reversed (e.g. drop = "!Intercept" means: every variable that does not contain “Intercept” is dropped). See details.- order
Character vector. This element is used if the user wants the variables to be ordered in a certain way. This should be a vector of regular expressions (see
base::regex
help for more info). The variables satisfying the first regular expression will be placed first, then the order follows the sequence of regular expressions. This argument is applied post aliasing (see argumentdict
). Example: you have the following variables:month1
tomonth6
, thenx1
tox5
, thenyear1
toyear6
. If you want to display first the x's, then the years, then the months you could use:order = c("x", "year")
. If the first character is an exclamation mark, the effect is reversed (e.g. order = "!Intercept" means: every variable that does not contain “Intercept” goes first). See details.- collin
Logical, default is
FALSE
. Whether the coefficients removed because of collinearity should be also returned asNA
. It cannot be used when coefficients aggregation is also used.- agg
Logical scalar, default is
TRUE
. If the coefficients of the estimation have been aggregated, whether to report the aggregated coefficients. IfFALSE
, the raw coefficients will be returned.- ...
Not currently used.
Details
The coefficients are the ones that have been found to maximize the log-likelihood of the specified model. More information can be found on the models from the estimations help pages: femlm
, feols
or feglm
.
Note that if the model has been estimated with fixed-effects, to obtain the fixed-effect coefficients, you need to use the function fixef.fixest
.
See also
See also the main estimation functions femlm
, feols
or feglm
. summary.fixest
, confint.fixest
, vcov.fixest
, etable
, fixef.fixest
.
Examples
# simple estimation on iris data, using "Species" fixed-effects
res = femlm(Sepal.Length ~ Sepal.Width + Petal.Length +
Petal.Width | Species, iris)
# the coefficients of the variables:
coef(res)
#> Sepal.Width Petal.Length Petal.Width
#> 0.08866057 0.12992811 -0.04957634
# the fixed-effects coefficients:
fixef(res)
#> $Species
#> setosa versicolor virginica
#> 1.1280816 1.0451815 0.9973101
#>
#> attr(,"class")
#> [1] "fixest.fixef" "list"
#> attr(,"exponential")
#> [1] TRUE