I am using the command simulate to check the size of a statistical test.
Specifically, my code looks like
Depending on the generated X and Y, the testing command sometimes returns an error, and I know that the error can be solved only by increasing the sample size.
But, I want to simulate the testing method only in a moderate sample size.
Therefore, I am looking for a way to retry the command my_prog when an error occurs.
In other words, I want that my_prog regenerates the data and implements the test again when the simulation result is "x" not "."
Is there a good way to do this?
Specifically, my code looks like
Code:
*** This is just an example presenting the structure of my command *** program my_prog, rclass version 18 drop _all set obs 3000 gen Y = rnormal() gen X = rnormal() a command for the test return scalar reject = r(reject) end simulate reject = r(reject), reps(1000): my_prog
But, I want to simulate the testing method only in a moderate sample size.
Therefore, I am looking for a way to retry the command my_prog when an error occurs.
In other words, I want that my_prog regenerates the data and implements the test again when the simulation result is "x" not "."
Is there a good way to do this?
Comment