synth-inference / synthdid

Synthetic difference in differences
https://synth-inference.github.io/synthdid
BSD 3-Clause "New" or "Revised" License
261 stars 96 forks source link

I would like to know if it is feasible to add a control group in this way. #113

Open changshengspecial opened 7 months ago

changshengspecial commented 7 months ago

My code: synthdid_estimate(setup$Y,setup$N0,setup$T0, X=array(dim = c(dim(setup$Y), 7), c(gdp,people,kaifang,chanye2,chanye3,keji,jinrong)));print(tau.hat) before I add these groups, it is such as image

but when I add them ,then it changed so much: image

==I want to know that if my method of setting control groups was wrong?Many thanks!!!==

changshengspecial commented 7 months ago

This is the code I use to convert the control variables into a data format:

gdp <- t(matrix(tryData2$gdp,nrow = 13,ncol = 30,byrow = FALSE)) people <- t(matrix(tryData2$高校学生人数对数值,nrow = 13,ncol = 30,byrow = FALSE)) kaifang <- t(matrix(tryData2$开放规模,nrow = 13,ncol = 30,byrow = FALSE)) chanye2 <- t(matrix(tryData2$产业结构高级化2,nrow = 13,ncol = 30,byrow = FALSE)) chanye3 <- t(matrix(tryData2$产业结构高级化3,nrow = 13,ncol = 30,byrow = FALSE)) keji <- t(matrix(tryData2$科技创新能力,nrow = 13,ncol = 30,byrow = FALSE)) jinrong <- t(matrix(tryData2$金融业发展,nrow = 13,ncol = 30,byrow = FALSE))