Skip to contents

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.598727e-15 1.154394e-15 2.246661e-07  1.502477e-07
#> x1 9.769908e-16 5.367730e-16 4.490874e-07  3.018886e-07

summary(conv, "detail")
#> Smallest and largest values of the first-order conditions:
#> 
#> y  
#>   |           FE: -1.60e-15, -1.07e-15, ...,  7.11e-16,  7.11e-16
#>   |     FE[[x3]]: -8.50e-16, -7.77e-16, ...,  9.09e-16,  1.15e-15
#>   |      species: -1.91e-07, -3.34e-08,  2.25e-07
#>   |species[[x2]]: -3.45e-08, -8.55e-09,  1.50e-07
#> __| 
#> 
#> x1 
#>   |           FE: -4.44e-16, -3.55e-16, ...,  6.22e-16,  9.77e-16
#>   |     FE[[x3]]: -5.37e-16, -5.33e-16, ...,  3.18e-16,  3.29e-16
#>   |      species: -3.83e-07, -6.57e-08,  4.49e-07
#>   |species[[x2]]: -6.90e-08, -1.69e-08,  3.02e-07
#> __|