This function retrieves the fixed effects from a fixest
estimation. It is useful only
when there are one or more fixed-effect dimensions.
Usage
# S3 method for fixest
fixef(
object,
notes = getFixest_notes(),
sorted = TRUE,
nthreads = getFixest_nthreads(),
fixef.tol = 1e-05,
fixef.iter = 10000,
...
)
Arguments
- object
- notes
Logical. Whether to display a note when the fixed-effects coefficients are not regular.
- sorted
Logical, default is
TRUE
. Whether to order the fixed-effects by their names. IfFALSE
, then the order used in the demeaning algorithm is used.- nthreads
The number of threads. Can be: a) an integer lower than, or equal to, the maximum number of threads; b) 0: meaning all available threads will be used; c) a number strictly between 0 and 1 which represents the fraction of all threads to use. The default is to use 50% of all threads. You can set permanently the number of threads used within this package using the function
setFixest_nthreads
.- fixef.tol
Precision used to obtain the fixed-effects. Defaults to
1e-5
. It corresponds to the maximum absolute difference allowed between two coefficients of successive iterations. Argumentfixef.tol
cannot be lower than10000*.Machine$double.eps
. Note that this parameter is dynamically controlled by the algorithm.- fixef.iter
Maximum number of iterations in fixed-effects algorithm (only in use for 2+ fixed-effects). Default is 10000.
- ...
Not currently used.
Value
A list containing the vectors of the fixed effects.
If there is more than 1 fixed-effect, then the attribute “references” is created. This is a vector of length the number of fixed-effects, each element contains the number of coefficients set as references. By construction, the elements of the first fixed-effect dimension are never set as references. In the presence of regular fixed-effects, there should be Q-1 references (with Q the number of fixed-effects).
Details
If the fixed-effect coefficients are not regular, then several reference points need to be set: this means that the fixed-effects coefficients cannot be directly interpreted. If this is the case, then a warning is raised.
See also
plot.fixest.fixef
. See also the main estimation functions femlm
, feols
or feglm
. Use summary.fixest
to see the results with the appropriate
standard-errors, fixef.fixest
to extract the fixed-effect coefficients, and
the function etable
to visualize the results of multiple estimations.
Examples
data(trade)
# We estimate the effect of distance on trade => we account for 3 fixed-effects
est_pois = femlm(Euros ~ log(dist_km)|Origin+Destination+Product, trade)
# Obtaining the fixed-effects coefficients:
fe_trade = fixef(est_pois)
# The fixed-effects of the first fixed-effect dimension:
head(fe_trade$Origin)
#> AT BE DE DK ES FI
#> 22.67038 23.72304 24.86999 23.60329 25.12917 21.80906
# Summary information:
summary(fe_trade)
#> Fixed_effects coefficients
#> Origin Destination Product
#> Number of fixed-effects 15 15 20
#> Number of references 0 1 1
#> Mean 23.5 3.09 0.0127
#> Standard-deviation 1.28 1.11 1.36
#>
#> COEFFICIENTS:
#> Origin: AT BE DE DK ES
#> 22.67 23.72 24.87 23.6 25.13 ... 10 remaining
#> -----
#> Destination: AT BE DE DK ES
#> 2.436 2.696 4.323 2.451 4.043 ... 10 remaining
#> -----
#> Product: 1 2 3 4 5
#> 0 1.414 0.656 1.449 -1.521 ... 15 remaining
# Plotting them:
plot(fe_trade)