Comments (8)
@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.
Could you give some more info? The stack trace, and the function call in particular?
from augsynth.
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.
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.
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!
from augsynth.
@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.
@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.
Great, glad this worked!
from augsynth.
Related Issues (20)
- scm = F broken in multisynth
- Stata package
- Suppress message `Joining with `by = join_by(Level)`
- Conformal prediction for the example from the vignette returns NAs HOT 2
- No confidence intervals of average ATT for conformal inference type
- Adding auxiliary covariates causes fatal error HOT 1
- Examples of how to use `cov_agg`?
- Codes for result plots and tables?
- Weighted ATT HOT 1
- 'list' object cannot be coerced to type 'double'
- Changing the setting alpha does not alter the confidence intervals when using multisynth HOT 1
- GSYN model not working HOT 1
- Problem with installation since Apr 14th 2023
- Conformal Inference procedure p-value potential issue HOT 1
- Examples for SCM with staggered adoption HOT 1
- Very ram consuming HOT 3
- Base year of Event time Plot
- Standard Errors
- about subsample augsynth
- Cannot recognize data
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from augsynth.