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

did glance custom #363

Merged

Conversation

grantmcdermott
Copy link
Contributor

Last one of these small PRs for today. Same energy as #356, but for the did package. (Do you want me to add NEWS items for them collectively? Not sure if they warrant it...)

Examples:

devtools::load_all('~/Documents/Projects/modelsummary')
#> ℹ Loading modelsummary
library(did)

data(mpdta, package = 'did')
mpdta$newvar = substr(mpdta$countyreal, 1, 2)

mod0 = att_gt(yname = "lemp",
              gname = "first.treat",
              idname = "countyreal",
              tname = "year",
              xformla = ~1,
              data = mpdta,
              bstrap = FALSE) # turn off default clustering by idname var

mod1 = att_gt(yname = "lemp",
              gname = "first.treat",
              idname = "countyreal",
              tname = "year",
              xformla = ~1,
              data = mpdta)

mod2 = att_gt(yname = "lemp",
              gname = "first.treat",
              idname = "countyreal",
              tname = "year",
              xformla = ~1,
              data = mpdta,
              clustervars = c('countyreal', 'newvar'))

msummary(
    list(mod0, mod1, mod2), 
    'markdown',
    coef_omit = '2005|2006|2007', 
    gof_omit = 'Num|ngroup|ntime|control|method')
Model 1 Model 2 Model 3
ATT(2004,2004) -0.011 -0.011 -0.011
(0.023) (0.024) (0.013)
Std.Errors Clustered (countyreal) Clustered (countyreal & newvar)
## Dyanmic versions
mod0_d = aggte(mod0, type = "dynamic")
#> Warning in compute.aggte(MP = MP, type = type, balance_e = balance_e, min_e =
#> min_e, : Used bootstrap procedure to compute simultaneous confidence band
mod1_d = aggte(mod1, type = "dynamic")
mod2_d = aggte(mod2, type = "dynamic")
msummary(
    list(mod0_d, mod1_d, mod2_d), 
    'markdown',
    coef_omit = paste(-3:2, collapse = "|"),
    gof_omit = 'Num|ngroup|ntime|control|method')
Model 1 Model 2 Model 3
ATT(3) -0.101 -0.101 -0.101
(0.034) (0.037) (0.021)
Std.Errors Clustered (countyreal) Clustered (countyreal & newvar)
type dynamic dynamic dynamic

Created on 2021-08-16 by the reprex package (v2.0.1)

@vincentarelbundock
Copy link
Owner

Looks fantastic. Yeah, adding to NEWS does make sense, I think. These are cool things.

@grantmcdermott
Copy link
Contributor Author

Sweden. I'll wait until this is merged and then just edit the NEWS file separately.

@vincentarelbundock vincentarelbundock merged commit d00164b into vincentarelbundock:main Aug 16, 2021
@grantmcdermott grantmcdermott deleted the did_glance_custom branch August 16, 2021 22:13
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.

None yet

2 participants