Skip to content

Commit

Permalink
add inheritance of ssc and vcov in vcov(), fixes #356
Browse files Browse the repository at this point in the history
  • Loading branch information
lrberge committed Feb 14, 2024
1 parent ed1ba6b commit 2404168
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

- new method `df.residual.fixest`. Thanks to @rferrali, #455

- now the `vcov` method inherits the small sample correction and type of VCOV used in the original estimation. Thanks to @mgoplerud, #356

## Bugs

- fix bug when the covariance matrix was *very* ill-defined. Thanks to Gianluca Russo.
Expand Down
4 changes: 3 additions & 1 deletion R/VCOV.R
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ vcov.fixest = function(object, vcov = NULL, se = NULL, cluster, ssc = NULL, attr
}
return(vcov)
}


# we inherit the vcov/ssc from the summary
assign_flags(object$summary_flags, vcov = vcov, ssc = ssc)

# Default behavior vcov:
suffix = ""
Expand Down
6 changes: 3 additions & 3 deletions tests/fixest_tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -918,14 +918,14 @@ test(v1, v1c)

# Only ssc change
v2 = summary(est, ssc = ssc())$cov.scaled
v2b = vcov(est, cluster = ~clu, ssc = ssc())
v2b = vcov(est, ssc = ssc())

test(v2, v2b)
test(max(abs(v1 - v2)) == 0, FALSE)

# SE change only
# vcov change only
v3 = summary(est, se = "hetero")$cov.scaled
v3b = vcov(est, se = "hetero", ssc = ssc(adj = FALSE))
v3b = vcov(est, se = "hetero")

test(v3, v3b)
test(max(abs(v1 - v3)) == 0, FALSE)
Expand Down

0 comments on commit 2404168

Please sign in to comment.