Skip to content

fixest: Incorrect standard errors and error #1039

@vincentarelbundock

Description

@vincentarelbundock

Two problems with the fixest package, initially reported by @passtar

  1. Incorrect standard errors
  2. Error

Incorrect standard errors

The parameters() function does not return the same summary() function:

library(did)
library(parameters)
library(fixest)

data(mpdta) # from the did package

model_att <- feols(
    lemp ~ sunab(first.treat, year, ref.p = -1:-4, att = TRUE) | countyreal + year,
    data = mpdta, cluster = ~countyreal)

summary(model_att)
> OLS estimation, Dep. Var.: lemp
> Observations: 2,500
> Fixed-effects: countyreal: 500,  year: 5
> Standard-errors: Clustered (countyreal) 
>     Estimate Std. Error  t value   Pr(>|t|)    
> ATT -0.04771   0.013265 -3.59669 0.00035438 ***
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> RMSE: 0.123851     Adj. R2: 0.991531
>                  Within R2: 0.01012

parameters(model_att, digits = 5)
> # Fixed Effects
> 
> Parameter | Coefficient |      SE |               95% CI |   t(499) |      p
> ----------------------------------------------------------------------------
> ATT       |    -0.04771 | 0.02238 | [-0.09168, -0.00374] | -3.59669 | < .001
> 
> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
>   using a Wald t-distribution approximation.

Error

model_es <- feols(
    lemp ~ sunab(first.treat, year, ref.p = -1:-4) | countyreal + year,
    data = mpdta, cluster = ~countyreal)

summary(model_es)
> OLS estimation, Dep. Var.: lemp
> Observations: 2,500
> Fixed-effects: countyreal: 500,  year: 5
> Standard-errors: Clustered (countyreal) 
>          Estimate Std. Error  t value   Pr(>|t|)    
> year::0 -0.031067   0.013621 -2.28083 0.02297891 *  
> year::1 -0.052235   0.018873 -2.76772 0.00585468 ** 
> year::2 -0.136078   0.035455 -3.83800 0.00013997 ***
> year::3 -0.104707   0.033874 -3.09106 0.00210591 ** 
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> RMSE: 0.123851     Adj. R2: 0.991531
>                  Within R2: 0.01012

parameters(model_es, digits = 5)
> Error: Something went wrong... :-/

Metadata

Metadata

Assignees

Labels

Bug 🐛Something isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions