lfe icon indicating copy to clipboard operation
lfe copied to clipboard

`summary(mod, robust=TRUE)` returns standard errors equal to zero (0.00) for dropped terms

Open vincentarelbundock opened this issue 3 years ago • 0 comments

As initially reported in this thread , applying the summary(mod, robust=TRUE) to a model estimated by felm will return zero-valued standard errors for terms that are otherwise NA because of rank-deficiency.

In the example below, I think it would make more sense for the standard errors to be NA for the first three terms:

library(lfe)

set.seed(1234)
n <- 1000
example <- data.frame(
  outcome = rnorm(n),
  month = sample(1:12, n, replace = TRUE),
  running = sample(1:50, n, replace = TRUE))
example$post <- example$month > 6
example$treatment1 <- example$running > 25
example$treatment2 <- example$running > 40

mod <- felm(outcome ~ treatment1 * post + treatment2 * post | 
            month + running,
            data = example)
#> Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
#> rank-deficient or indefinite

summary(mod, robust=TRUE)
#> Warning in chol.default(mat, pivot = TRUE, tol = tol): the matrix is either
#> rank-deficient or indefinite
#> 
#> Call:
#>    felm(formula = outcome ~ treatment1 * post + treatment2 * post |      month + running, data = example) 
#> 
#> Residuals:
#>     Min      1Q  Median      3Q     Max 
#> -3.2371 -0.6478 -0.0002  0.6151  2.9811 
#> 
#> Coefficients:
#>                         Estimate Robust s.e t value Pr(>|t|)
#> treatment1TRUE                NA    0.00000      NA       NA
#> postTRUE                      NA    0.00000      NA       NA
#> treatment2TRUE                NA    0.00000      NA       NA
#> treatment1TRUE:postTRUE -0.05536    0.14777  -0.375    0.708
#> postTRUE:treatment2TRUE -0.14059    0.18224  -0.771    0.441
#> 
#> Residual standard error: 0.997 on 937 degrees of freedom
#> Multiple R-squared(full model): 0.06278   Adjusted R-squared: 0.0007696 
#> Multiple R-squared(proj model): 0.001447   Adjusted R-squared: -0.06463 
#> F-statistic(full model, *iid*):1.012 on 62 and 937 DF, p-value: 0.4519 
#> F-statistic(proj model): 0.2713 on 5 and 937 DF, p-value: 0.9289

vincentarelbundock avatar Oct 11 '20 23:10 vincentarelbundock