Open taiwoakinyemi opened 2 years ago
Kindly revisit my earlier question. Thanks
I have been able to resolve this.
Hi Taiwo, how did you resolve this? I am having a similar issue. Thanks for your help.
Hi, thanks for the message! Can you please provide a minimal working example of the code you ran that produced this error. Thank you.
Hi Jon,
Thanks for your reply. The steps I took:
Step 1: house.attgt <- ghsm_solar %>% att_gt( yname = 'own_house', tname = 'year', idname = 'UqNr', gname = 'solar.first.treat', xformla = controls, data = ., panel = F, control_group = 'nevertreated', anticipation = 2, weightsname = 'House_wgt', bstrap = T, cband = T, biters = 1000, clustervars = 'UqNr', est_method = "reg", base_period = "universal", print_details = F, )
Step2: agg.es.house.attgt <- aggte(house.attgt, type = 'dynamic', min_e = -Inf, max_e = Inf, na.rm = T)
Step 3: I ran the honest_did and honest_did.AGGTEobj functions
Step 4: hd.smooth.never <- honest_did(es = agg.es.house.attgt, e = 0, type = "smoothness") hd.rm.never <- honest_did(es = agg.es.house.attgt, e = 0, type = "relative_magnitude")
hd.smooth.never <- honest_did.AGGTEobj(es = agg.es.house.attgt, e = 0, type = "smoothness") hd.rm.never <- honest_did.AGGTEobj(es = agg.es.house.attgt, e = 0, type = "relative_magnitude")
None of the codes in step 4 worked.
#####################
#####################
hd.smooth.never <- honest_did(es = agg.es.house.attgt, e = 0, type = "smoothness") Warning in n * n : NAs produced by integer overflow
Error in seq.default(from = 0, to = Mub, length.out = 10) (solar.R#1587): 'to' must be a finite number Show stack trace
hd.rm.never <- honest_did(es = agg.es.house.attgt, e = 0, type = "relative_magnitude") Warning in n * n : NAs produced by integer overflow
Error in { (solar.R#1571): task 1 failed - "non-conformable arguments" Show stack trace
hd.smooth.never <- honest_did.AGGTEobj(es = agg.es.house.attgt, e = 0, type = "smoothness") Warning in n * n : NAs produced by integer overflow
Error in seq.default(from = 0, to = Mub, length.out = 10) (solar.R#1587): 'to' must be a finite number Show stack trace
hd.rm.never <- honest_did.AGGTEobj(es = agg.es.house.attgt, e = 0, type = "relative_magnitude") Warning in n * n : NAs produced by integer overflow
Error in { (solar.R#1571): task 1 failed - "non-conformable arguments" Show stack trace
Thanks! @Mauricio Caceres Bravo @.***> can you try to track this down
On Sun, May 7, 2023, 8:17 PM Davidmac O. Ekeocha @.***> wrote:
Hi Jon,
Thanks for your reply. The steps I took:
Step 1: house.attgt <- ghsm_solar %>% att_gt( yname = 'own_house', tname = 'year', idname = 'UqNr', gname = 'solar.first.treat', xformla = controls, data = ., panel = F, control_group = 'nevertreated', anticipation = 2, weightsname = 'House_wgt', bstrap = T, cband = T, biters = 1000, clustervars = 'UqNr', est_method = "reg", base_period = "universal", print_details = F, )
Step2: agg.es.house.attgt <- aggte(house.attgt, type = 'dynamic', min_e = -Inf, max_e = Inf, na.rm = T)
Step 3: I ran the honest_did and honest_did.AGGTEobj functions
Step 4: hd.smooth.never <- honest_did(es = agg.es.house.attgt, e = 0, type = "smoothness") hd.rm.never <- honest_did(es = agg.es.house.attgt, e = 0, type = "relative_magnitude")
hd.smooth.never <- honest_did.AGGTEobj(es = agg.es.house.attgt, e = 0, type = "smoothness") hd.rm.never <- honest_did.AGGTEobj(es = agg.es.house.attgt, e = 0, type = "relative_magnitude")
None of the codes in step 4 worked.
##################### THE ERRORS
#####################
hd.smooth.never <- honest_did(es = agg.es.house.attgt, e = 0, type = "smoothness") Warning in n * n : NAs produced by integer overflow
Error in seq.default(from = 0, to = Mub, length.out = 10) (solar.R#1587): 'to' must be a finite number Show stack trace
hd.rm.never <- honest_did(es = agg.es.house.attgt, e = 0, type = "relative_magnitude") Warning in n * n : NAs produced by integer overflow
Error in { (solar.R#1571): task 1 failed - "non-conformable arguments" Show stack trace
hd.smooth.never <- honest_did.AGGTEobj(es = agg.es.house.attgt, e = 0, type = "smoothness") Warning in n * n : NAs produced by integer overflow
Error in seq.default(from = 0, to = Mub, length.out = 10) (solar.R#1587): 'to' must be a finite number Show stack trace
hd.rm.never <- honest_did.AGGTEobj(es = agg.es.house.attgt, e = 0, type = "relative_magnitude") Warning in n * n : NAs produced by integer overflow
Error in { (solar.R#1571): task 1 failed - "non-conformable arguments" Show stack trace
— Reply to this email directly, view it on GitHub https://github.com/pedrohcgs/CS_RR/issues/1#issuecomment-1537520993, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE6EXFGSOC6B2LWYNTXJ2NDXE7YL5ANCNFSM5MV4ERLA . You are receiving this because you commented.Message ID: @.***>
@jonathandroth In the snippet here, shouldn't betahat=beta
instead of beatahat=es$att.egt
?
Yes that looks right to me
On Sun, May 7, 2023, 11:21 PM Mauricio Caceres Bravo < @.***> wrote:
@jonathandroth https://github.com/jonathandroth In the snippet here https://github.com/pedrohcgs/CS_RR#auxiliary-functions, shouldn't betahat=beta instead of beatahat=es$att.egt?
— Reply to this email directly, view it on GitHub https://github.com/pedrohcgs/CS_RR/issues/1#issuecomment-1537553228, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE6EXFDEAZ2Q3XYN3ZLCKELXFAN7FANCNFSM5MV4ERLA . You are receiving this because you were mentioned.Message ID: @.***>
Ps this appears to be what we have on the honestdid readme
https://github.com/asheshrambachan/HonestDiD
On Sun, May 7, 2023, 11:26 PM Jonathan Roth @.***> wrote:
Yes that looks right to me
On Sun, May 7, 2023, 11:21 PM Mauricio Caceres Bravo < @.***> wrote:
@jonathandroth https://github.com/jonathandroth In the snippet here https://github.com/pedrohcgs/CS_RR#auxiliary-functions, shouldn't betahat=beta instead of beatahat=es$att.egt?
— Reply to this email directly, view it on GitHub https://github.com/pedrohcgs/CS_RR/issues/1#issuecomment-1537553228, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE6EXFDEAZ2Q3XYN3ZLCKELXFAN7FANCNFSM5MV4ERLA . You are receiving this because you were mentioned.Message ID: @.***>
@davidmacolisa You can use the functions as defined here instead.
@jonathandroth See #4
I will double check but the function we created there seems to eliminare the reference period within the function.
On Sun, May 7, 2023 at 18:20 Mauricio Caceres Bravo < @.***> wrote:
@davidmacolisa https://github.com/davidmacolisa You can use the functions as defined here https://github.com/asheshrambachan/HonestDiD#staggered-timing instead.
@jonathandroth https://github.com/jonathandroth See #4 https://github.com/pedrohcgs/CS_RR/pull/4
— Reply to this email directly, view it on GitHub https://github.com/pedrohcgs/CS_RR/issues/1#issuecomment-1537565202, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABE7347WBXYVHWKMAX3UMPLXFAU37ANCNFSM5MV4ERLA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
--
Pedro H. C. Sant'Anna https://psantanna.com https://psantanna.com
Hi @pedrohcgs , @jonathandroth, @mcaceresb,
Thanks so much for your help so far. However, the error persists with a new error emerging in the "relative_magnitude" test.
#############
#############
hd.smooth.never <- honest_did.AGGTEobj(es = agg.es.house.attgt, e = 0, type = "smoothness") Warning in n * n : NAs produced by integer overflow
Error in seq.default(from = 0, to = Mub, length.out = 10) (solar.R#1577): 'to' must be a finite number Show stack trace
hd.rm.never <- honest_did.AGGTEobj(es = agg.es.house.attgt, e = 0, type = "relative_magnitude", Mbarvec = seq(from = 0.5, to = 2, by = 0.5)) Warning in n * n : NAs produced by integer overflow
Error in { (solar.R#1563): task 1 failed - "'from' must be a finite number" Show stack trace
Hi @pedrohcgs , @jonathandroth, @mcaceresb,
Is the function "honest_did.AGGTEobj" restricted to only event study object from a panel data DF?
I replicated your exact codes, but when I adapted them to my data (repeated cross-sections) and variables, the function still returned the above error using my event study object.
I suspect it may be from the DF structure from which the ES object comes. Is it possible to modify the "honest_did.AGGTEobj" function to such objects (from repeated cross-sections DF)?
Otherwise, what alternatives do you suggest I follow?
Thanks for all your help.
@davidmacolisa Some debugging advice:
Ideally you would be able to provide a minimal working example (MWE). This is code that can be run on other machines and a fresh R session. Your code snippet, while initially helpful, cannot be run because it's not clear which objects and libraries are in your R session. While it's often possible to debug code that is not a MWE, it can be difficult. Here I don't get an error with example data, so I'm not immediately sure what the issue is.
Often it is not possible to share the data that gives the issue.
One alternative is to construct or simulate a version of the problem dataset that gives the same error.
Another is to delete data
from the results object and share a link to the results object. For example, agg.es.house.attgt$DIDparams$data <- NULL
then save agg.es.house.attgt
to a file, upload it somewhere, and share the link here.
However, I understand sometimes the above is not feasible. If you cannot provide a MWE for us to investigate, you can do a bit of investigating to help: Define
es = agg.es.house.attgt
Mbarvec = seq(from = 0.5, to = 2, by = 0.5)
type = "relative_magnitude"
method = NULL
bound = "deviation from parallel trends"
Mvec = NULL
Mbarvec = NULL
monotonicityDirection = NULL
biasDirection = NULL
alpha = 0.05
parallel = FALSE
then run honest_did.AGGTEobj
line by line. You should only see the error when you run createSensitivityResults_relativeMagnitudes
. Now inspect each object created in the function for NAs. If any of the objects have missing values it will give a clue as to what is going on.
Hi @mcaceresb ,
I have attached the link to the sample data https://drive.google.com/file/d/1TYhMB5SxLTZX4Zm9J6Whs0hv10VXYdDZ/view?usp=share_link. It's a repeated cross-section. Please, see if you can conduct this test. It's obvious I'm missing something. The code I ran is this https://github.com/pedrohcgs/CS_RR/issues/1#issuecomment-1537520993, with the new one as follows: hd.smooth.never <- honest_did.AGGTEobj(es = agg.es.house.attgt, e = 0, type = "smoothness", Mbarvec = seq(from = 0.5, to = 2, by = 0.5)) hd.rm.never <- honest_did.AGGTEobj(es = agg.es.house.attgt, e = 0, type = "relative_magnitude", Mbarvec = seq(from = 0.5, to = 2, by = 0.5))
Thanks so much.
@davidmacolisa EDIT: Never-mind. Had a brief lapse; debugging.
The non-controls are UqNr, solar.first.treat, House_wgt, and year. All other variables in the sample data are controls.
@davidmacolisa TIL that R only has native support for 32-bit integers, which is pretty shocking tbh. Anyway, you can replace
V <- t(es_inf_func) %*% es_inf_func / (n*n)
with
V <- t(es_inf_func) %*% es_inf_func / n / n
and it would work.
@jonathandroth Apparently doing powers (e.g. n^2
) automagically upgrades the type to a double, which goes up to 2^53 instead of 2^31
Thanks so much @pedrohcgs , @jonathandroth , and especially @mcaceresb. You've saved a soul today. Cheers mates.
Mauricio saves several souls on a daily basis ;-)
On Mon, May 8, 2023 at 5:11 PM Davidmac Ekeocha @.***> wrote:
Thanks so much @pedrohcgs https://github.com/pedrohcgs , @jonathandroth https://github.com/jonathandroth , and especially @mcaceresb https://github.com/mcaceresb. You've saved a soul today. Cheers mates.
— Reply to this email directly, view it on GitHub https://github.com/pedrohcgs/CS_RR/issues/1#issuecomment-1538664884, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE6EXFAOYNUOYATJBJ6YTI3XFELJ5ANCNFSM5MV4ERLA . You are receiving this because you were mentioned.Message ID: @.***>
When I input the code for honest_did, I receive the error below. Error in seq.default(from = 0, to = Mub, length.out = 10) : 'to' must be a finite number In addition: Warning message: In n * n : Error in seq.default(from = 0, to = Mub, length.out = 10) : 'to' must be a finite number Kindly help out, I can't figure why this is happening