Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow on-the-fly vcov adjustment #35

Merged
merged 6 commits into from
Dec 12, 2023
Merged

Allow on-the-fly vcov adjustment #35

merged 6 commits into from
Dec 12, 2023

Conversation

grantmcdermott
Copy link
Owner

Closes #34.

Examples.

pkgload::load_all("~/Documents/Projects/ggfixest/")
#> ℹ Loading ggfixest
#> Loading required package: ggplot2
#> 
#> Loading required package: fixest

# ggiplot ----

# default is clustered by id
est_did = feols(y ~ x1 + i(period, treat, 5) | id + period, base_did)

# focusing here on period 6 
ggiplot(est_did, keep = "6", zero = FALSE, vcov = "iid") +
    geom_hline(yintercept = confint(est_did, vcov = "iid")[[1]][6], lty = 2) + 
    geom_hline(yintercept = confint(est_did, vcov = "iid")[[2]][6], lty = 2)
#> Warning: Removed 1 rows containing missing values (`geom_vline()`).

# ggcoefplot ----

est = feols(Petal.Length ~ Petal.Width + Sepal.Length + Sepal.Width | Species, iris)

ggcoefplot(est, zero = FALSE, vcov = "iid") +
    geom_hline(yintercept = confint(est, vcov = "iid")[[1]], lty = 2) + 
    geom_hline(yintercept = confint(est, vcov = "iid")[[2]], lty = 2)

Created on 2023-12-12 with reprex v2.0.2

Two asides:

  1. I don't think the latter option works with the base coefplot option. Need to raise an upstream bug issue.
  2. I have decided against passing other potential arguments through ... to summary.fixest. Just limiting it to these vcov adjustment options, otherwise we risk silent errors.

@grantmcdermott grantmcdermott merged commit c5763e6 into main Dec 12, 2023
3 checks passed
@grantmcdermott grantmcdermott deleted the summary_dots branch December 12, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ggiplot does not support on-the-fly vcov adjustment
1 participant