Thanks for including the models.
You can ignore the Jacobian warning for subtract(rt,c) (corresponding
to model code "(rt - c) ~ ...". Because c is a transformed parameter,
Stan can't track what might have happened to it at compile time (at least
in general, or in specific cases without a lot of work).
We should change wording of "contains a non-linear transform" to "may contain
a non-linear transform".
The other message is serious, because it's telling you that (rt - c) is
negative in some cases. I have no idea what the [475] is doing there. Daniel?
Given that rt[i] is data and c[i] == (shift + shift_u[subj[i]]),
and shift is a scalar parameter, you need to constrain shift properly
to make sure
shift < rt[i] - shift_u[subj[i]]
for all i in 1:num_elements(rt).
functions {
real shift_max(vector shift_u, int[] subj, vector rt) {
real shift_max <- infinity();
for (i in 1:num_elements(rt))
shift_max <- min(shift_max, rt[i] - shift_u[subj[i]]);
return shift_max;
}
}
You should most definitely check all my algebra here. Then you
can declare:
real<lower=0, upper=shift_max(shift_u,subj,rt)> shift;
Given that you're not averse to reading, I'd recommend the sections on
priors in the manual chapter on regression. We've been advocating against
using this kind of thing
real<lower=0,upper=10000> sigma;
in favor of unconstrained variables with at least weakly informative priors (e.g.,
if you expect sigma to be in the unit range, something like cauchy(0,5) or even
cauchy(0,2.5)). The manual cites some papers by Andrew going over why the other
priors are bad news for inference.
As to fitting the data better, if you can afford the computation, and it
makes sense given your groupings, just use cross-validation. You can build that
right in Stan. I have it on my to-do list to add an example to the manual.
I think the issue you're going to have to deal with is marginalizing out all the latent
parameters if you want to properly compute a likelihood here. But others are much
better than me at WAIC. If the model comparison question gets buried in the noise
here, feel free to repost with a more directed title so those in the know (usually Andrew
or Aki, since they're most invested) see it.
- Bob
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
stan-users+...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
> <logshifted_lmm.stan><lmm.stan><evallmm.R><fakedata.Rda>