Checks the convergence of a feols
estimation by computing the first-order conditions of all fixed-effects (all should be close to 0)
Usage
check_conv_feols(x)
# S3 method for fixest_check_conv
summary(object, type = "short", ...)
Arguments
- x
A
feols
estimation that should contain fixed-effects.- object
An object returned by
check_conv_feols
.- type
Either "short" (default) or "detail". If "short", only the maximum absolute FOC are displayed, otherwise the 2 smallest and the 2 largest FOC are reported for each fixed-effect and each variable.
- ...
Not currently used.
Note that this function first re-demeans the variables, thus possibly incurring some extra computation time.
Value
It returns a list of N
elements, N
being the number of variables in the estimation
(dependent variable + explanatory variables +, if IV, endogenous variables and instruments). For
each variable, all the first-order conditions for each fixed-effect are returned.
Examples
base = setNames(iris, c("y", "x1", "x2", "x3", "species"))
base$FE = rep(1:30, 5)
# one estimation with fixed-effects + varying slopes
est = feols(y ~ x1 | species[x2] + FE[x3], base)
# Checking the convergence
conv = check_conv_feols(est)
# We can check that al values are close to 0
summary(conv)
#> Maximum absolute value of the first-order conditions:
#>
#> FE FE[[x3]] species species[[x2]]
#> y 1.421084e-15 7.251882e-16 7.551502e-08 4.485712e-08
#> x1 6.217249e-16 4.415660e-16 5.099228e-07 3.421662e-07
summary(conv, "detail")
#> Smallest and largest values of the first-order conditions:
#>
#> y
#> | FE: -1.42e-15, -1.24e-15, ..., 1.07e-15, 1.07e-15
#> | FE[[x3]]: -7.25e-16, -7.10e-16, ..., 5.15e-16, 5.75e-16
#> | species: -7.55e-08, 1.84e-08, 5.71e-08
#> |species[[x2]]: -4.49e-08, 4.54e-09, 1.02e-08
#> __|
#>
#> x1
#> | FE: -5.33e-16, -3.55e-16, ..., 5.33e-16, 6.22e-16
#> | FE[[x3]]: -4.42e-16, -3.01e-16, ..., 2.49e-16, 3.58e-16
#> | species: -5.10e-07, 7.51e-08, 4.35e-07
#> |species[[x2]]: -3.42e-07, 1.93e-08, 7.82e-08
#> __|