> On May 31, 2016, at 10:16 PM,
pcoll...@berkeley.edu wrote:
>
> Hi Bob,
>
> Thanks for the reply. Didn't see it until just now.
>
> On Tuesday, May 17, 2016 at 12:03:35 PM UTC-7, Bob Carpenter wrote:
>
> > On May 16, 2016, at 4:10 PM,
pcoll...@berkeley.edu wrote:
> >
> > Hi Dr. Gelman,
> >
> > Strange... I can see the attachment in the original post on google groups.
>
> It didn't come through on my mailer, either. I had 9 attachments.
>
> The 9th attachment is the STAN model. What showed up in the email? Sorry for all the confusion around this, I'm still not sure what's going on...
I really don't want to type the name of 9 files out.
There were 6 .pdf, 2 .rdump, and 1 .rda file. I was
looking for something ending in .stan.
But really 9 attachments are more than we realistically
have time to inspect.
> You really need to consider the non-centered parameterizations for
> efficiency if there are small data sizes int he groups.
>
> Thank you for suggesting this. I'm struggling somewhat to understand how centered vs. non-centered parameterizations work.
See:
https://arxiv.org/pdf/1312.0906.pdf
> Basically the sampling of the estimated parameters is more independent from the likelihood estimation? In the case of the above model, if for example I wanted to have a non-centered parameterization for K1, would I declare it like so?
>
> Centered:
> model{
> K1~normal(mu_K1, sigma_K1)
> mu_K1~normal(0,100)
> sigma_K1~cauchy(0,15)
> }
>
> Non-centered:
> transformed parameters{
> K1<-mu_K1+sigma_K1*z_K1
> }
>
> model{
> mu_K1~normal(0,100)
> sigma_K1~cauchy(0,15)
> z_K1~normal(0,1)
> }
Exactly. I'd recommend spaces and indentation for readability.
Do you really expect mu_K1 to take absolute values > 100
and sigma_K1 to take arbitrarily large values? If not, you can
tighten these priors, too.
> And you don't want super-diffuse gamma priors (I didn't try to
> figure out how to inspect your data).
>
> The gamma distribution estimated from the known variances is not very diffuse, I think. Parameters are .4 and .54, tails don't get out beyond ~25.
>
>
>
>
>
> And you can just mode scales
> directly --- Stan doesn't use any conjugacy information.
>
>
> Meaning I should go ahead and draw samples of the sigma parameters directly, rather than worrying about doing it through the variances?
We usually just model sigma directly (with a prior).
The reason it's easier than variance or precision is that
it's on the natural scale of the data, so easier to formulate
reasonable priors for.
Stan samples everything jointly, though --- so you never sample
sigma directly all by itself.
> > At any rate, I was able to improve things a bit by creating dynamic constraints for the parameters of the model that vary according to properties of each dataset I want to run the model for. I also was able to get a bit better performance by making the prior distributions for variance and mean parameters a bit less flat. Examining trace plots of problematic runs, I noticed that periods where sampling efficiency of a chain was very poor seemed to correspond to times when a couple of key variance parameters were simultaneously very close to 0. Placing constraints on these parameters so that they could not take on values below 1E-6 seemed to prevent the worst of the inefficient mixing behavior.
>
> If lower=1e-6 makes a difference, then you have a problem with estimates
> near the boundary and adding that lower bound is just going to mask that.
>
> What do the posteriors look like?
>
> - Bob
>
> Ah, I was afraid that might be a bit cheaty. I'll rerun the models overnight with all parameters saved and post some posterior distributions (I assume you were interested in the scale parameters?) tomorrow.
The problem is that if the properly formulated models wants to draw values
near 1E-6, then you don't want to put an artificial wall there.
- Bob