Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lotka-Volterra example not running #161

Open
josswright opened this issue Feb 2, 2020 · 1 comment
Open

Lotka-Volterra example not running #161

josswright opened this issue Feb 2, 2020 · 1 comment

Comments

@josswright
Copy link

josswright commented Feb 2, 2020

I just went through the Lotka-Volterra example via the .Rmd, and also by pulling out the R code directly. There's a bug that seems to come from the creation of the lynx_hare_data list without named elements.

With the current specification (line 527 of the lotka-volterra-predator-prey.Rmd ):

lynx_hare_data <- list(N, ts, y_init, y)

I get the following error when trying to fit the model:

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 'model328085d4d633a_lotka_volterra' at line 21)

failed to create the sampler; sampling not done

This can be fixed by naming the list elements appropriately:

lynx_hare_data <- list(N=N, ts=ts, y_init=y_init, y=y)

I'm assuming that this must be a changed behaviour in some recent version of rstan?

@bob-carpenter
Copy link
Contributor

Thanks for reporting and providing the appropriate patch. Behavior may have changed, but I don't know how this ran before. RStan can just read out of the environment, so that might've been happening somewhere before.

I just patched and added an acknowledgement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants