Hi,
I am trying to estimate estimate parameters for a hierarchical model with two parameters (alpha and beta) for n subjects.
I have a ground truth (simulated) dataset with alphas ~ Uniform(0,1) and betas ~ Gamma(5,1) and I know that alpha’s range is [0,1], while beta’s range is [0,+inf].
Centered parametrisation of the parameters was giving poor estimates so I’ve been looking into non-centered parametrisation.
I’ve found an example Stan implementation of a model similar to mine, which uses stan’s constrained real variables (alpha_b, beta_a, beta_b > 0, beta > 0) and Phi_approx to restrict alphas to [0,1].
Alpha’s non-centered parametrisation has location ~ Normal(0,3) and scale ~ Cauchy(0,5), while beta’s parametrisation is drawn from a Gamma distribution with shape and scale both drawn from Normal(1,5).
I’ve tried to re-implement this in pymc with the following code but the estimates are not really good.
# alpha priors
alpha_a = pm.Normal('alpha_a', mu=0, sigma=3)
alpha_b = pm.Cauchy('alpha_b', alpha=0, beta=5)
alpha_raw = pm.Normal('alpha_raw', mu=0, sigma=1, shape=n_subj)
# beta priors
beta_a = pm.Normal('beta_a', mu=1, sigma=5)
beta_b = pm.Normal('beta_b', mu=1, sigma=5)
# non-centered parametrisation
alpha = pm.Deterministic('alpha', pm.math.invprobit(alpha_a + alpha_b * alpha_raw))
beta = pm.Gamma('beta', beta_a, beta_b, shape=n_subj)
The estimated alphas and betas are all within a very small range (alphas are tightly packed around 0.5, betas all around 3.5).
Do this non-centered parametrisations make sense or are there better ways to do this for bounded variables?
Thanks!
Filippo