Giter VIP home page Giter VIP logo

Comments (8)

ebenmichael avatar ebenmichael commented on September 17, 2024 1

@sethneller thanks for pointing this out!

There are two issues going on. First, if there are always treated units then the method won't work. This seems to be the issue for @frederickluser and @ahmedch92. Second if you're including a fixed effect (fixedeff = TRUE which is the default) and a unit has only 1 pre-treatment outcome, then the optimization problem is ill-specified and R breaks. This was the other problem that @sethneller was having.

I just added some checking code that'll give a more interpretable error message for both these cases, pointing out which units are causing the problems. Let me know if that works.

from augsynth.

ebenmichael avatar ebenmichael commented on September 17, 2024

Could you give some more info? The stack trace, and the function call in particular?

from augsynth.

ahmedchaudhryy avatar ahmedchaudhryy commented on September 17, 2024

Thank you for your reply.

Here is the traceback call; I hope this helps.
Edit: Removing/changing the number of lags/leads also does not help. The same error persists.

Error in Xc[[j]][, (dj - ndim + 1):dj, drop = F] :
subscript out of bounds

traceback()

7: FUN(X[[i]], ...)
6: lapply(1:J, function(j) {
dj <- ncol(Xc[[j]])
ndim <- min(dj, n_lags)
max_dim <- min(d, n_lags)
mat <- Xc[[j]][, (dj - ndim + 1):dj, drop = F]
n0 <- nrow(mat)
zero_mat <- Matrix::Matrix(0, n0, max_dim - ndim)
Matrix::t(cbind(zero_mat, mat))
})
5: do.call(Matrix::bdiag, lapply(1:J, function(j) {
dj <- ncol(Xc[[j]])
ndim <- min(dj, n_lags)
max_dim <- min(d, n_lags)
mat <- Xc[[j]][, (dj - ndim + 1):dj, drop = F]
n0 <- nrow(mat)
zero_mat <- Matrix::Matrix(0, n0, max_dim - ndim)
Matrix::t(cbind(zero_mat, mat))
}))
4: make_constraint_mats(trt, grps, n_leads, n_lags, Xc, Zc, d, n1)
3: multisynth_qp(X = bal_mat, trt = wide$trt, mask = wide$mask,
Z = wide$Z[, !colnames(wide$Z) %in% wide$match_covariates,
drop = F], n_leads = n_leads, n_lags = n_lags, relative = relative,
nu = 0, lambda = lambda, V = V, time_cohort = time_cohort,
donors = donors, eps_rel = eps_rel, eps_abs = eps_abs, verbose = verbose)
2: multisynth_formatted(wide = wide, relative = T, n_leads = n_leads,
n_lags = n_lags, nu = nu, lambda = lambda, V = V, force = force,
n_factors = n_factors, scm = scm, time_cohort = time_cohort,
time_w = F, lambda_t = 0, fit_resids = TRUE, eps_abs = eps_abs,
eps_rel = eps_rel, verbose = verbose, long_df = long_df,
how_match = how_match, ...)
1: multisynth(minwage_binary ~ crb, state, year, cfri, fixedeff = TRUE,
n_lags = 6, n_leads = 6)

from augsynth.

frederickluser avatar frederickluser commented on September 17, 2024

Dear Eli

Thank you for your amazing work and congrats for the publication!
I am getting exactly the same error for my project. Do you have any idea where the problem might be?

Best, Frederic

from augsynth.

sethneller avatar sethneller commented on September 17, 2024

I'm having this exact issue as well. I'm wondering if it has something to do with always-treated units as I can replicate the error message using the vignette data if I recode at least of the states to have cbr=1 for the entire period. Unfortunately, when I drop my always-treated units, R-studio encounters a fatal error so this doesn't really fix things. @frederickluser, do you also have always-treated units in your data?

I'm also attaching the data file that I'm using in case that's helpful in anyway.

Thanks to Eli and team for putting this package together!

analytic_file.txt

from augsynth.

frederickluser avatar frederickluser commented on September 17, 2024

@sethneller Thanks for your comment, I played around with it and deleted all the treatments that took place in the first two and last two periods. Like this it would work.

from augsynth.

sethneller avatar sethneller commented on September 17, 2024

@ebenmichael, thank you so much for your help! That definitely fixed everything on my end and the error messages were super informative. Looking forward to using this method!

from augsynth.

ebenmichael avatar ebenmichael commented on September 17, 2024

Great, glad this worked!

from augsynth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.