xuyiqing / gsynth

Generalized Synthetic Control Method
Other
134 stars 41 forks source link

Documentation issue: `est.att.avg` does not exist, is it rather `est.avg` #92

Open MatthieuStigler opened 1 week ago

MatthieuStigler commented 1 week ago

The documentation of gsynth mentions est.att.avg=inference for att.avg. but the slot does not exist!?

It seems it is instead called est.avg it is called?

https://github.com/xuyiqing/gsynth/blob/114fdce450ade235fe666b458759c67f9cf0b6c2/R/core.R#L2868

library(gsynth)
#> ## Syntax has been updated since v.1.2.0.
#> ## Comments and suggestions -> yiqingxu@stanford.edu.
data(gsynth)
out <- gsynth(Y ~ D + X1 + X2, data = simdata, parallel = FALSE, 
              index = c("id","time"), force = "two-way",
              CV = TRUE, r = c(0, 2), se = TRUE, inference ="parametric") 
#> Cross-validating ... 
#>  r = 0; sigma2 = 1.84865; IC = 1.02023; PC = 1.74458; MSPE = 2.37280
#>  r = 1; sigma2 = 1.51541; IC = 1.20588; PC = 1.99818; MSPE = 1.71743
#>  r = 2; sigma2 = 0.99737; IC = 1.16130; PC = 1.69046; MSPE = 1.14540
#> 
#>  r* = 2
#> 
#> Simulating errors .....Bootstrapping ...
#> ..
out$est.att.avg
#> NULL
out$est.avg
#>         Estimate     S.E. CI.lower CI.upper p.value
#> ATT.avg 5.543534 0.260916 5.032148  6.05492       0

Created on 2024-09-30 with reprex v2.1.1

MatthieuStigler commented 2 days ago

it seems also Y.tr.cnt and Y.ct.cnt are mentioned in the doc, but not present in the data?

library(gsynth)
#> ## Syntax has been updated since v.1.2.0.
#> ## Comments and suggestions -> yiqingxu@stanford.edu.
data(gsynth)
out <- gsynth(Y ~ D + X1 + X2, data = simdata, parallel = FALSE, 
              index = c("id","time"), force = "two-way",
              CV = TRUE, r = c(0, 5), se = FALSE) 
#> Cross-validating ... 
#>  r = 0; sigma2 = 1.84865; IC = 1.02023; PC = 1.74458; MSPE = 2.37280
#>  r = 1; sigma2 = 1.51541; IC = 1.20588; PC = 1.99818; MSPE = 1.71743
#>  r = 2; sigma2 = 0.99737; IC = 1.16130; PC = 1.69046; MSPE = 1.14540*
#>  r = 3; sigma2 = 0.94664; IC = 1.47216; PC = 1.96215; MSPE = 1.15032
#>  r = 4; sigma2 = 0.89411; IC = 1.76745; PC = 2.19241; MSPE = 1.21397
#>  r = 5; sigma2 = 0.85060; IC = 2.05928; PC = 2.40964; MSPE = 1.23876
#> 
#>  r* = 2
"Y.tr.cnt" %in% names(out)
#> [1] FALSE
"Y.ct.cnt" %in% names(out)
#> [1] FALSE

Created on 2024-10-07 with reprex v2.1.1

xuyiqing commented 1 day ago

Dear Matthieu,

Does your data require recentering? Could you attached a panelView plot so that it is easier to diagnose?

We're also migrating the package to "fect". We will make sure this get addressed in the new version.

---------- Forwarded message --------- From: Matthieu @.> Date: Mon, Oct 7, 2024 at 4:14 AM Subject: Re: [xuyiqing/gsynth] Documentation issue: est.att.avg does not exist, is it rather est.avg (Issue #92) To: xuyiqing/gsynth @.> Cc: Subscribed @.***>

it seems also Y.tr.cnt and Y.ct.cnt are mentioned in the doc, but not present in the data?

library(gsynth)#> ## Syntax has been updated since v.1.2.0.#> ## Comments and suggestions -> @.** data(gsynth)out <- gsynth(Y ~ D + X1 + X2, data = simdata, parallel = FALSE, index = c("id","time"), force = "two-way", CV = TRUE, r = c(0, 5), se = FALSE) #> Cross-validating ... #> r = 0; sigma2 = 1.84865; IC = 1.02023; PC = 1.74458; MSPE = 2.37280#> r = 1; sigma2 = 1.51541; IC = 1.20588; PC = 1.99818; MSPE = 1.71743#> r = 2; sigma2 = 0.99737; IC = 1.16130; PC = 1.69046; MSPE = 1.14540#> r = 3; sigma2 = 0.94664; IC = 1.47216; PC = 1.96215; MSPE = 1.15032#> r = 4; sigma2 = 0.89411; IC = 1.76745; PC = 2.19241; MSPE = 1.21397#> r = 5; sigma2 = 0.85060; IC = 2.05928; PC = 2.40964; MSPE = 1.23876#> #> r* = 2"Y.tr.cnt" %in% names(out)#> [1] FALSE"Y.ct.cnt" %in% names(out)#> [1] FALSE

Created on 2024-10-07 with reprex v2.1.1 https://reprex.tidyverse.org

— Reply to this email directly, view it on GitHub https://github.com/xuyiqing/gsynth/issues/92#issuecomment-2396631525, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2PKGBDCCXQ3AAEFMYK7N3Z2JULDAVCNFSM6AAAAABPCZSK6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJWGYZTCNJSGU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Yiqing Xu

Assistant Professor Department of Political Science Stanford University https://yiqingxu.org/

MatthieuStigler commented 1 day ago

Hi

This is just a reprex using the default simdata, so should be easy to diagnose?

Ok, are you saying Y.tr.cnt is only present when the data is centered/has X? If so, might be worth mentioning it in the doc?

Thank a lot!

MatthieuStigler commented 1 day ago

also, interesting to hear about fect. Do you have a page discussing the migration (i.e. advantages/differences of fect vs gsynth, timeline of migration, etc)? If fect is mature, it might be good to ope an issue on gsynth redicreting users to fect? Thanks!