OK, I see what's going on. This is NOT a good way to code
these models. This model relies on Andrew's trick for BUGS of
specifying an ill-defined posterior to sample from, then
attempting to pull it all back into something with reasonable
n_eff and Rhat through standardization. Here's the offending
code in our example:
> transformed parameters {
> vector[J] a;
> vector[K] b;
> vector[K] g;
> vector[N] p;
> real scale;
> real shift;
>
> shift <- mean(a);
> scale <- sd(a);
> a <- (a_raw - shift) / scale;
> b <- (b_raw - shift) / scale;
> g <- g_raw * scale;
>
> for (n in 1:N)
> p[n]<-g[kk[n]]*(a[jj[n]] - b[kk[n]]);
The problem here is that the raw values are not identified.
The problem is that the posterior for the parameters is improper.
And what you see is that Stan's HMC is effcient enough to race all over
the posterior and at least realize it's undefined.
There's a chapter on problematic posteriors that goes through
an example of the effects of such non-identified models. (Look at the
plot of the long ridge, which is what happens for this kind of example.)
This model needs to be recoded so that it's properly identified.
We're working on rewriting all the ARM models, which are a pretty direct translation
of what's in Gelman and Hill, and thus not guaranteed to work.
This looks like a good place to start!
For models that don't have data we can release, we can simulate
data according to the model. I want to bring up the question of how
to simulate predictors for regressions --- it seems like for proper testing
we shouldn't make them all independent.
- Bob
> So I manged to fit the model but I always see to get a very low number of effective samples for the scaled variance and location parameters.Is that a reason to be concerned here? I have attached the model and here is a part of the output.
> mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat
> gamma[47] 3.0 0.0 0.4 2.3 2.8 3.0 3.3 3.9 8000 1.0
> gamma[48] 2.9 0.0 0.4 2.2 2.6 2.8 3.1 3.6 8000 1.0
> gamma[49] 3.3 0.0 0.4 2.6 3.0 3.2 3.5 4.1 8000 1.0
> gamma[50] 3.6 0.0 1.2 1.9 2.7 3.4 4.2 6.4 2581 1.0
> mu_alpha -0.8 0.9 1.9 -4.0 -2.6 -0.6 0.7 2.5 4 2.0
> mu_beta 2.9 1.8 2.8 -1.2 0.7 1.7 5.5 8.1 2 2.7
> mu_gamma 0.8 0.3 0.5 0.3 0.5 0.7 1.2 1.9 3 2.5
> sigma_alpha 3.4 1.1 1.9 1.1 1.8 2.9 4.6 7.9 3 1.9
> sigma_beta 5.1 1.6 2.8 1.6 2.7 4.4 6.9 11.7 3 1.9
> sigma_gamma 0.5 0.2 0.3 0.1 0.3 0.4 0.6 1.1 3 2.1
>
>
> Thanks,
>
> Rick
>
>
>
> <irt.stan>