1. This evening I have an "Aha!" moment and the joy and happiness of that moment was priceless. I will do a blog post about it, but here is quick story. Since Friday, I am trying to fit a model called Hyperbolic Cosine Model, a latent trait model for binary response outcomes.
3. I first wrote a Stan code for the model. It seemed easy. For model identifiability, I implemented a classic approach by fixing the mean and variance for the latent trait to 0 and 1.

Then, I simulated a dataset to test the Stan code and fitted the model to simulated data.
4. After I fitted the model, I checked the outcome, and it was strange. Rhat values were kind of small, but the estimated parameters were not even close, and looked like total garbage. I mean how hard it could be to fit a model like this!
5. When I checked the posterior distributions, it was totally bizarre! The posterior for some of the item location parameters were bi-modal. That was the point a typical episode of obsession started.
6. I spent the whole saturday playing with the model, changing priors or the way model was identified, and re-run the model zillion times. Each took 10-15 minutes. I came back every time just to see another failure. Nothing worked. I was up until 4 am this morning. Frustrated.
7. As I was searching some papers about estimation of these models, I found this paper https://doi.org/10.3102/10769986028003195

It was the aha moment when I read these two pieces.
8. I never thought about putting a directional constrain, as I think this is never an issue for typical IRT models and concern for model identification.
9. When there is no directional constrain for this model, some chains hang out on one side of the continuum while the others hang out on the other side, and there are two peaks almost symmetrically. So,the mean of posterior is always close to zero no matter what the parameter is.
10. I tweaked the Stan code a little bit to force the sign of first parameter to be negative, and hey the result was almost perfecto!
11. Would this be a case study?

@betanalpha @mcmc_stan

I have no formal training in Bayesian other than a couple workshops, but this is the first time I feel the real power of it. Is there an official ceremony to convert?
You can follow @cengizzopluoglu.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: