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

QUESTION: Adding covariets/controls #91

Open emilmirzayev opened 2 years ago

emilmirzayev commented 2 years ago

Hi there!

is it possible to add additional covariates into estimators? For example, replicating the Germany's unification study by Abadie but by using synthdid ? I saw stata implementation here. There by using covariates keyword one can achieve that.

thank you!

kartechbabu commented 1 year ago

It looks like the synthdid_estimate method provides a way to add covariates (X). It would be nice if you could provide a working example. I am not sure how the units and the covariates are aligned properly.

` synthdid_estimate( Y, N0, T0, X = array(dim = c(dim(Y), 0)), noise.level = sd(apply(Y[1:N0, 1:T0], 1, diff)), eta.omega = ((nrow(Y) - N0) (ncol(Y) - T0))^(1/4), eta.lambda = 1e-06, zeta.omega = eta.omega noise.level, zeta.lambda = eta.lambda noise.level, omega.intercept = TRUE, lambda.intercept = TRUE, weights = list(omega = NULL, lambda = NULL), update.omega = is.null(weights$omega), update.lambda = is.null(weights$lambda), min.decrease = 1e-05 noise.level, max.iter = 10000, sparsify = sparsify_function, max.iter.pre.sparsify = 100 )

X an optional 3-D array of time-varying covariates. Shape should be N X T X C for C covariates.

`

ireneb612 commented 11 months ago

any news?

rawls238 commented 8 months ago

I'm guessing it's still not possible to add covariates?

davidahirshberg commented 8 months ago

There's a way. I'll get back to you this weekend.

On Wed, Nov 8, 2023 at 11:38 AM Guy Aridor @.***> wrote:

I'm guessing it's still not possible to add covariates?

— Reply to this email directly, view it on GitHub https://github.com/synth-inference/synthdid/issues/91#issuecomment-1802260205, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANV7XCGHMH33PA6B4N47PLYDOYRBAVCNFSM5WR3UKLKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBQGIZDMMBSGA2Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

rawls238 commented 8 months ago

@davidahirshberg following up on this.

changshengspecial commented 7 months ago

I'm guessing it's still not possible to add covariates?

read the latest question ,my friend

rawls238 commented 7 months ago

It would still be really useful to be able to add controls.

changshengspecial commented 7 months ago

It would still be really useful to be able to add controls.

The latest question is mine, could you please tell me how to add controls correctly?

changshengspecial commented 7 months ago

It would still be really useful to be able to add controls. before: image

after adding controls: image