Terminate batch job error when using Stan in Stata

I am conducting a simulation study which processes a model in Stan (i.e., repeatedly, a dataset is simulated under a data-generating model and then analysed using Bayesian model implemented in Stan). This is all implemented in Stata. It ran fine for 164 simulations but for the 165th Stata reported “Terminate batch job”. The data for this 165th simulation looks fine. Any ideas why this termination notice popped up?

The termination notice popped up during the compiling stage and Stata reported the following “The system cannot find the file C:\rachaelh\cmdstan-2.23.0\model_simStudy-inline-YlinearmissbinU.exe.”

Note, “model_simStudy-inline-YlinearmissbinU.do” is the name of the Stata do-file which contains my Stan code and my call of Stata’s stan command.

I am using Stata V15.1, cmdstan V2.23, Rtools


No idea. That seems like a pretty vague error so this is probably a problem where it’s worth more time investigating how to trigger the error than necessarily wondering exactly what is causing it yet.

I guess I’d start with can you run the 165th data on it’s own. After that maybe check if this is deterministic (if you repeat this, does it happen exactly in the same place)? After that maybe simplify the model to something dirt simple (estimate the mean of a normal).

At this point it’s not clear if it’s Stata or Stan or something on the computer this is running, etc. Gotta narrow down the conditions to make that determination.