# Heteroscedastic model with variance as function of mean magnitude

This isn’t something I’m specifically trying to do with Stan but I’m trying to formulate it as a Bayesian model, which may then later need MCMC.

I have a model where I have observations d_{i,j} where d_i is a 3 dimensional vector. I have a forwards model which can produce modeled data m_{i,j}. Unfortunately, there are multiple sources of noise that produce the observations, one which is likely heteroscedastic and scales with |m_i| and another which is likely constant. I think a simple model I could use to describe this would be something like:

d_{i,j}\sim normal(m_{i,j},(\omega|m_i|)^2+\delta^2)

where \delta and \omega are unknown.

Alternatively, it might be simpler to model the variance as a single parameter \sigma_i^2 where p(\sigma_i)=f(|d_i|) and f is a distribution that has a mean with the properties defined above (tends to a constant at low magnitude, order 1 at high magnitude).

Because the variance is effectively a nuisance parameter, it would also be nice to have some simple/complementary form to the prior so that the variance can be integrated out in the posterior, reducing the number of parameters that have to be computed. I haven’t been able to find much literature on this particular kind of problem which does this- although it’s a frequently used trick with homoscedastic problems.