TheEconomist / us-potus-model

Code for a dynamic multilevel Bayesian model to predict US presidential elections. Written in R and Stan.
https://projects.economist.com/us-2020-forecast/president
MIT License
1.25k stars 191 forks source link

Error running 2008_model.R #26

Closed johnbeaumont closed 4 years ago

johnbeaumont commented 4 years ago

I am running final_2008.R script (in RStudio on a mac). I believe the model is using Rstan as opposed to cmdstanr - therefore I comment out lines 561 to 571 and un-comment 555-559.

When I run the model I get the following error:

Error in mod$fit_ptr() : 
  Exception: variable does not exist; processing stage=data initialization; variable name=poll_mode_state; base type=int  (in 'modela29f20816b55_poll_model_2020' at line 14)

failed to create the sampler; sampling not done  

If I go to line 519-522 where these variables have been commented out and change it I get the following error:

Error in eval(ei, envir) : object 'poll_mode_state' not found

I am clearly not using the model correctly. Can someone help? Apologies, I am sure this is a basic issue