stan-dev / example-models

Example models for Stan
http://mc-stan.org/
772 stars 479 forks source link

sampling() fails in Lotka-Volterra example #155

Closed mabuimo closed 5 years ago

mabuimo commented 5 years ago

Error in new_CppObject_xp(fields$.module, fields$.pointer, ...) : Exception: variable does not exist; processing stage=data initialization; variable name=N; base type=int (in 'model6d34530f74d5_lotka_volterra' at line 21)

failed to create the sampler; sampling not done

bob-carpenter commented 5 years ago

It would help us debug if you could report the command that you tried to execute that led to the error (and the context or directory from which it's being run).

mabuimo commented 5 years ago

Hello, I was just trying to execute the code of the example line by line. It fails when executing this line: fit <- sampling(model, data = lynx_hare_data, seed = 123) Thank you for the article by the way. I am interested in LV models and will come back to you with some questions if you don't mind.

bob-carpenter commented 5 years ago

The best place to ask questions is Discourse. If there's a particular question you have for me, please ping me via email as I don't see all the modeling questions going by. Fair warning---that was just a simple example I put up as it's kind of a "hello world" for ODE models in a lot of applied math settings. I'm neither an expert in ODE models nor population dynamics.

I'm guessing your problem here is that data is not defined yet when that call is made. I'm going to close this issue. If you have a reproducible bug (in the form of a sequence of commands that if we run them, tickles the bug), this is the place to post it.