Closed lzy318 closed 1 month ago
Thanks for your question. That is odd -- your code and provided data runs fine for me using the latest version of HonestDiD on CRAN on my MacStudio:
Can you try restarting the R session and running it fresh?
The error message you got seems to suggest that it's trying to take the square root of a computed variance which winds up being negative. It's possible that this is the result of some numerical precision error that is somehow different on your machine. You can try adding a very small diagonal matrix to your covariance matrix and see if that fixes it -- e.g. replace vcov.hat
with vcov.hat + 10^(-8) * diag(NROW(vcov.hat))
It is weird, I tried it on my two Windows systems and it reported the same issue. I will try to run it on Mac and keep you posted.
Hi,
Thanks for the great work on this package, super helpful.
I got a bug when running the createSensitivityResults(), it reported the error:
Error in { : task 1 failed - "attempt to apply non-function"
In addition to this, it had several warnings:
Warning messages: 1: In .findLowestH(sigma = sigma, numPrePeriods = numPrePeriods, ... : Error in optimization for h0 2: In base::sqrt(minimalVariance) : NaNs produced 3: In unpack_problem(object, solution) : Solver returned with status solver_error 4: In .findLowestH(sigma = sigma, numPrePeriods = numPrePeriods, ... : Error in optimization for h0 5: In base::sqrt(minimalVariance) : NaNs produced 6: In unpack_problem(object, solution) : Solver returned with status solver_error 7: In .findLowestH(sigma = sigma, numPrePeriods = numPrePeriods, ... : Error in optimization for h0 8: In base::sqrt(minimalVariance) : NaNs produced 9: In unpack_problem(object, solution) : Solver returned with status solver_error 10: In .findLowestH(sigma = sigma, numPrePeriods = numPrePeriods, ... : Error in optimization for h0 11: In base::sqrt(minimalVariance) : NaNs produced 12: In unpack_problem(object, solution) : Solver returned with status solver_error
This is the code to replicate the error: honest.result <- try(createSensitivityResults(betahat = beta.hat, sigma = vcov.hat, numPrePeriods = 6, numPostPeriods = 9, l_vec = count/sum(count), Mvec = seq(from = 0, to = 0.001, by =0.00025)))
This is the data that I use:
https://drive.google.com/file/d/1cJBhnvjit33GuMR_W7w2dBaGgqBwjXxr/view?usp=sharing
Thanks again for the time of debuging.
Best,