N best tips & tricks (or the go-to checklist) for new Stan model builders?

  • Build a non-Bayes model first and get it to run. It’s useful as crosscheck later against Stan.
  • Check your matrices have full rank.
  • Try to get to run your Stan with low iterations 50 and one chain.
  • Use multiple chains to detect multi-modalities
  • Always look at neff for low values, these indicate problematic parameters.
  • Do a traceplot of problematic parameters, find suspicious interactions with pairs plot.
  • Buy a fast computer with lots of CPU cache.
  • Use exponential / half-normal distribution instead of half-cauchy in case of problems with standarddev.
  • Suppress the output of large arrays/matrices you don’t need in RStan or use Cmdstan.
  • Check the problematic scaling of the mass-matrix given from Cmdstan. Adjust parameterization.
  • Run optimizing instead of NUTS to check if the values look reasonable, if not find out why.
  • Step back and think about what you model should do, and don’t limit yourself to a key algorithm. There are many ways. Learn about your data and apply different models, the output will help to understand your data in many ways.
  • Use a routine, always save.image (complete dump) your session, before running a model.
  • Keep all models and simulations runs.
8 Likes