bcallaway11 / did

Difference in Differences with Multiple Periods, website: https://bcallaway11.github.io/did
287 stars 91 forks source link

Error Message with Replacement Length #164

Closed ahu6 closed 1 year ago

ahu6 commented 1 year ago

Hello,

I am trying to run the att_gt function on a dataset with institutional holdings of stocks of firms and time periods in which those firms disclose certain information. I am getting the error message:

Error in replCmat4(x, i1 = if (iMi) seq.int(from = 0L, length.out = di[1L]) else .ind.prep2(i, : number of items to replace is not a multiple of replacement length

I was wondering if anyone would be willing to help on how to fix this error. Happy to provide more information as helpful.

bcallaway11 commented 1 year ago

I am not sure about this error message. If I were to guess, I'd say this looks like some issue with the bootstrap, though I have never seen this one before. Will the code run if you set boot=FALSE?

ahu6 commented 1 year ago

I've changed the code to add allow_unbalanced_panel = TRUE (and also tried with bstrap = FALSE), and am now getting the error message:

Error in aggregate.data.frame(as.data.frame(x), ...) : arguments must have same length

but I do not see the function aggregate.data.frame being used in the att_gt documentation. Any clue on where this may be coming from?

pedrohcgs commented 1 year ago

Can you share a sample of your data and codes that replicate this issue?

Thanks

On Mon, Feb 6, 2023 at 22:29 ahu6 @.***> wrote:

I've changed the code to add allow_unbalanced_panel = TRUE (and also tried with bstrap = FALSE), and am now getting the error message:

Error in aggregate.data.frame(as.data.frame(x), ...) : arguments must have same length

but I do not see the function aggregate.data.frame being used in the att_gt documentation. Any clue on where this may be coming from?

— Reply to this email directly, view it on GitHub https://github.com/bcallaway11/did/issues/164#issuecomment-1420184503, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABE734YRG4NVFQB2SON3BMDWWHFQ7ANCNFSM6AAAAAAUQ7DN4E . You are receiving this because you are subscribed to this thread.Message ID: @.***>

--

Pedro H. C. Sant'Anna Department of Economics Vanderbilt University 615-875-8448 (phone) @.*** https://pedrohcgs.github.io

ahu6 commented 1 year ago

Sure, here is the dataset:

Screenshot 2023-02-06 at 11 32 45 PM

and I am trying to run:

att_gt(yname = "inst_hold", tname = "year", idname = "ID", gname = "first_disclose", xformla = NULL, allow_unbalanced_panel = TRUE, data = test_df1)

pedrohcgs commented 1 year ago

Would you mind sending to our email address? Here it is showing a screenshot only and I cant use thatto replicate the issue.

Thanks a lot

On Mon, Feb 6, 2023 at 22:33 ahu6 @.***> wrote:

Sure, here is the dataset:

[image: Screenshot 2023-02-06 at 11 32 45 PM] https://user-images.githubusercontent.com/55068184/217149004-225df102-820f-4197-93e1-6c1754519ca7.png

and I am trying to run:

att_gt(yname = "inst_hold", tname = "year", idname = "ID", gname = "first_disclose", xformla = NULL, allow_unbalanced_panel = TRUE, data = test_df1)

— Reply to this email directly, view it on GitHub https://github.com/bcallaway11/did/issues/164#issuecomment-1420187530, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABE7347HRXV5HYPH4QW6VFLWWHGAXANCNFSM6AAAAAAUQ7DN4E . You are receiving this because you commented.Message ID: @.***>

--

Pedro H. C. Sant'Anna Department of Economics Vanderbilt University 615-875-8448 (phone) @.*** https://pedrohcgs.github.io

ahu6 commented 1 year ago

Just sent, thank you.

bcallaway11 commented 1 year ago

Just checked this, it is a data issue, not a code issue, ids are not unique.