 # Model inputs as parameters of a distribution

I have a problem, where the inputs to the Bayesian model are the parameters of the distributions, so they need to be sampled first. I know that it is confusing, so I am explaining this by making a synthesized example of regression.

For the typical regression, where X and y are the predictors and the predicted, respectively, we compute the coefficient w and the bias b by the following model (only the essence of the model is presented):

``````numpyro.sample('y', dist.Normal(X*w+b,sigma), obs=y)
``````

Now let’s assume that the response variable y is not directly observed, but we know that it follows a distribution with specified parameters. As a simple case, assume that we know that each y_i follows a uniform distribution with two parameters a and b.
So, what is required here (as far as I could grasp) is to first sample from a uniform distribution (in each step of MCMC) and then apply the above sampling, which means we can have a model like:

``````y_hat = numpyro.sample('y_hat', dist.Uniform(a,b))
numpyro.sample('y', dist.Normal(X*w+b,sigma), obs=y_hat)
``````

Does anyone know how it is possible with Numpyro (i.e., passing a stochastic parameter as an observation)? I implemented as such but did not get the result expected!

Any hint is highly appreciated!