Thanks for your reflections on this process.
Yes, that is how I came up with it. I RTFM which was so helpful once I understood the error message. The stan manual that I have been referencing is from 2015 and there are limited examples of building your own models, I searched the web til I found some Survival Analysis models by DW Bester, but alas they were continuous not discrete.
I was thinking about that myself last night and this morning, so I hear you and agree with you. And yes, you are right reading about the structures was what helped in the end.
Are you speaking of the while loop? It don’t think it’ll work with the rest of the likelihood, but I’ll double check.
What I wrote isn’t true, is it? Sorry. I should’ve said that R is much more flexible than Stan, in my experience. Ross Ihaka argues that it’s too flexible. At the beginning of this presentation he changes + to - in the middle of a function: https://www.stat.auckland.ac.nz/en/about/news-and-events-5/events/events-2017/03/ihaka-ross-ihaka.html and says that it’s flexibility slows down the language. I don’t imagine this is possible in Stan which might be why it’s faster
I had a conversation with Ross about this once and he told me there is coding in R that works and no one knows how. I’m not willing to publicly disclose his state of mind while writing it.
That’s a question I might pose to Ross next time I talk to him, he’s so good at the big picture, one of the best that I’ve ever encountered.
Many people believe R, but if there are things that its founders don’t know how work perhaps we all shouldn’t? Humpf!
Have you seen the wonderful training materials RStudio has for Shiny? It’s amazing what you can learn just by perusing their site. Another thing I learned from Ross is to look at the examples for functions when reading documentation. When I have a better grasp of Stan, I might have time to help you guys write a lot of examples that might make it easier for people to code their own functions.
All the best,