Matt's trick / central formulation of beta distribution?

Sorry if this is a very basic question!

I know that “Matt’s trick” can help avoid divergent samples and the sampler getting stuck. I was wondering if there’s an equivalent trick for distributions other than the normal distribution? I’d like to use a Beta distribution for my parameter “beta”.

Matt’s trick for Normal distribution:

with pm.Model() as model:

    beta_mu = pm.Uniform('beta_mu', lower=0, upper=5, testval=1.25)
    beta_sd = pm.Uniform('beta_sd', lower=0, upper=5, testval=0.1)
    beta_matt = pm.Normal('beta_matt', mu=0, sd=1, shape=n_subj, testval=np.random.choice([-0.1, 0, 0.1], n_subj))
    beta = pm.Deterministic('beta', beta_mu + beta_sd * beta_matt)

Is there an equivalent for the Beta distribution? Thanks in advance!!

You can have a look at the recent paper Implicit Reparameterization Gradients, many of the tricks should also apply. Also see https://en.wikipedia.org/wiki/Beta_distribution#Related_distributions

1 Like