0
$\begingroup$

I am considering choices of priors for truncated distributions on a circle. Let's take the truncated normal distribution on the unit circle as an example. It has parameters $\mu \in [-\pi, \pi]$ and $\sigma$ for location and scale, respectively. But it also has parameters $a$ and $b$, which are the lower and upper bound respectively, which I have been tinkering with priors for without success. To protect $a<b$ I have reparametrized with $a := \alpha$ and $b := \alpha + \beta$ where $\beta$ requires a non-negativity constraint. Specifically I am getting a large number of divergences.

Below is an unsuccessful example which attempts to put uniform priors on $\alpha$ and $\beta$. I also tried a normal distribution for $\alpha$ and half-normal for $\beta$, since I had suspected the uniform distributions were the problem at first, but got similar divergence issues.

import pymc as pm
import arviz as az
import matplotlib.pyplot as plt
import numpy as np

from scipy.stats import truncnorm

# True parameter values
m = 10000
loc = 1
scale = 0.5
a = -2
b = 2

# Generate data
Y = truncnorm.rvs(a=a, b=b, loc=loc, scale=scale, size=m)

# Model
basic_model = pm.Model()

with basic_model:

    # Priors for unknown model parameters
    mu = pm.Normal("mu", mu=0, sigma=100)
    sigma = pm.HalfNormal("sigma", sigma=2)
    alpha = pm.Uniform('alpha', lower=-np.pi, upper=np.pi)
    beta = pm.Uniform("beta", lower=0, upper=2*np.pi)


    # Likelihood (sampling distribution) of observations
    Y_obs = pm.TruncatedNormal("Y_obs", mu=mu, sigma=sigma, lower=alpha, upper=alpha+beta, observed=Y)

with basic_model:
    idata = pm.sample(2000)
    az.plot_trace(idata, combined=True)
    plt.tight_layout()
    plt.show()

Here is the trace plot:

enter image description here

What sort of priors could I put on $\alpha$ and $\beta$, or $a$ and $b$, to get few-to-no divergences?

$\endgroup$
2
  • $\begingroup$ What is a Normal distribution on a circle? $\endgroup$
    – Xi'an
    Commented Mar 10, 2023 at 18:30
  • 1
    $\begingroup$ @Xi'an In hindsight that could have been at least a couple of different things. I'll have to check my project notes. (I've enjoyed your blog, btw). $\endgroup$
    – Galen
    Commented Mar 10, 2023 at 18:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.