-
Notifications
You must be signed in to change notification settings - Fork 41
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
Understanding EM algorithm in gsynth #47
Comments
Licheng, could you look into it and explain to Yafee what's going on?
Dear Yafee, for your application, we actually have a better method
<https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3649226> that adopts
the Bayesian approach. We plan to release the package on R very soon.
…On Thu, Sep 24, 2020 at 12:40 AM yafs123 ***@***.***> wrote:
Hi Yiqing,
Thanks for making such a fantastic package.
I am running an experiment with only 1 treated unit (N_tr = 1) and 38
units in the control group (N_co = 38). The dataset is unbalanced. I have
completed the tutorial you have uploaded on your website. (
http://yiqingxu.org/software/gsynth/gsynth_examples.html). It seems like
"gsynth" can handle unbalanced panel dataset by using the EM algorithm. My
question is related to the output of "gsynth". The output only shows NA
values in the missing rows. To be precise, the algorithm did not estimate
ATT where missing values exists. I thought that the EM algorithm would fill
in missing values. You can find the example code below.
Best regards,
Yafee
#####################
Code
#####################
library(gsynth)
library(data.table)
Datasets
data(gsynth)
names(turnout)
Set seed
set.seed(123456)
Remove rows
turnout.ub <- turnout[-c(which(turnout$abb=="WY")[1:15],
sample(1:nrow(turnout),50,replace=FALSE)),]
Overview of missing values
panelView(turnout ~ policy_edr + policy_mail_in + policy_motor, data =
turnout.ub, index = c("abb","year"), pre.post = TRUE)
Transform to data.table object
setDT(turnout.ub)
Remove all treated units without ID
turnout.ub <- turnout.ub[!(abb %in%
c("CT","IA","ME","MN","MT","NH","WI","WY"))]
Run gsynth
out <- gsynth(turnout ~ policy_edr + policy_mail_in + policy_motor,
data = turnout.ub,
index = c("abb","year"),
se = TRUE,
inference = "parametric",
r = c(0, 5),
CV = TRUE,
force = "two-way",
EM = TRUE,
parallel = TRUE,
min.T0 = 8,
nboots = 1000,
seed = 02139)
print results
out
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#47>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB2PKGFRERKA6K3X35JPEFTSHLZWZANCNFSM4RX6TT2Q>
.
--
Yiqing Xu
Assistant Professor
Department of Political Science
Stanford University
http://yiqingxu.org/
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Yiqing,
Thanks for making such a fantastic package.
I am running an experiment with only 1 treated unit (N_tr = 1) and 38 units in the control group (N_co = 38). The dataset is unbalanced. I have completed the tutorial you have uploaded on your website. (http://yiqingxu.org/software/gsynth/gsynth_examples.html). It seems like "gsynth" can handle unbalanced panel dataset by using the EM algorithm. My question is related to the output of "gsynth". The output only shows NA values in the missing rows. To be precise, the algorithm did not estimate ATT where missing values exists. I thought that the EM algorithm would fill in missing values. You can find the example code below.
Best regards,
Yafee
#####################
Code
#####################
library(gsynth)
library(data.table)
Datasets
data(gsynth)
names(turnout)
Set seed
set.seed(123456)
Remove rows
turnout.ub <- turnout[-c(which(turnout$abb=="WY")[1:15], sample(1:nrow(turnout),50,replace=FALSE)),]
Overview of missing values
panelView(turnout ~ policy_edr + policy_mail_in + policy_motor, data = turnout.ub, index = c("abb","year"), pre.post = TRUE)
Transform to data.table object
setDT(turnout.ub)
Remove all treated units without ID
turnout.ub <- turnout.ub[!(abb %in% c("CT","IA","ME","MN","MT","NH","WI","WY"))]
Run gsynth
out <- gsynth(turnout ~ policy_edr + policy_mail_in + policy_motor,
data = turnout.ub,
index = c("abb","year"),
se = TRUE,
inference = "parametric",
r = c(0, 5),
CV = TRUE,
force = "two-way",
EM = TRUE,
parallel = TRUE,
min.T0 = 8,
nboots = 1000,
seed = 02139)
print results
out
The text was updated successfully, but these errors were encountered: