Skip to contents

If emmeans is installed, its functionality is supported for fixest or fixest_multi objects. Its reference grid is based on the main part of the model, and does not include fixed effects or instrumental variables. Note that any desired arguments to vcov() may be passed as optional arguments in emmeans::emmeans() or emmeans::ref_grid().

Note

When fixed effects are present, estimated marginal means (EMMs) are estimated correctly, provided equal weighting is used. However, the SEs of these EMMs will be incorrect - often dramatically - because the estimated variance of the intercept is not available. However, contrasts among EMMs can be estimated and tested with no issues, because these do not involve the intercept.

Author

Russell V. Lenth

Examples

if(requireNamespace("emmeans") && requireNamespace("AER")) {
    data(Fatalities, package = "AER")
    Fatalities$frate = with(Fatalities, fatal/pop * 10000)
    fat.mod = feols(frate ~ breath * jail * beertax | state + year, data = Fatalities)
    emm = emmeans(fat.mod, ~ breath*jail, cluster = ~ state + year)
    emm   ### SEs and CIs are incorrect

    contrast(emm, "consec", by = "breath")   ### results are reliable
}
#> NOTE: 1 observation removed because of NA values (RHS: 1).
#> NOTE: Results may be misleading due to involvement in interactions
#> breath = no:
#>  contrast estimate     SE  df t.ratio p.value
#>  yes - no    0.118 0.0610 274   1.937  0.0538
#> 
#> breath = yes:
#>  contrast estimate     SE  df t.ratio p.value
#>  yes - no    0.140 0.0532 274   2.638  0.0088
#>