Marginalize out continuous latent variable (HMC)?

Hi Devs,

I am working on AR1 process with stochastic volatility.

The model is formulated as below:
sigma_t ~ sigma + epsilon_t
y_t ~ Normal(theta * y_{t-1}, sigma_t)

y_t is observable.
I want to estimate sigma and theta. The model has epsilon as a noise, epsilon_t ~ Expo(1).

The code is shown below:

def SV(y):
    theta = numpyro.sample("theta", dist.Normal())
    sigma = numpyro.sample("sigma",dist.Exponential())
    def transition_func(carry, y):
        prev_y = carry
        diff_sigma = numpyro.sample("diff_sigma",dist.Exponential())
        current_y = numpyro.sample("current_y", dist.Normal(theta * prev_y, (sigma + diff_sigma)), obs = y)
        return (current_y), None
    carry_init = (y[0])
    scan(transition_func, carry_init, y[1:],history =len(y))  

It seems that HMC also tries to estimate the noise, epsilon_t.
How can I make a model that does not consider the noise as a to-be-estimated parameters?

Thanks for any helps.

1 Like

Hi, do you have any hints about how to do this?

I think you can use Inverse gamma prior for the noise and marginal it out via a custom NormalGamma distribution: Normal-gamma distribution - Wikipedia