Jongerling, J. (Joran)
2012-Jan-11 13:45 UTC
[R] Problem concerning withRestarts and R2WinBUGS
Dear R-users, I have a question regarding the withRestarts function in R. I´m running a simulation code in which I analyse data using both lme and R2WinBUGS. Now, I want to run this code for 1000 replications, however the model I´m using is a little ´sensitive´, so sometimes the WinBUGS analysis crashes. In that case I want the code to ignore the current results, and redo all steps. This means drawing new data, analysing the data with lme, and than analysing the data using WinBUGS. So basically, I want my code to continue untill I get 1000 succesful replications, and ignore the replications that failed. I figured I might be able to do so by putting the data generation and analysis steps in a second function embedded in the overall one, and calling this second function using the withRestarts and invokeRestart options, but I can´t get this to work. Can somebody help me figure this out by telling me if this is even possible, and if so, how withRestarts and invokeRestarts should be called to do this? Alternatively, if any of you know an other way to aqcuire the desired effect I´m also very interested. Kind regards, Joran Jongerling [[alternative HTML version deleted]]