# Bayesian regression with independent variable drawn from distribution

I'm trying to set up a bayesian regression of the form

$y_i \sim f(\beta_0 + \beta_1 x_i)$

but rather than $x_i$ fixed, they themselves are drawn from a distribution of (known) mean $x_i \sim g(\mu_i)$. $f$ and $g$ could be any distribution suitable for regression, but will probably be poisson or negative binomial.

Is this type of regression possible, or is the problem under-defined? I've tried a few MCMC runs but they typically fail to converge. I've so far only tried metropolis-hastings as the conditional distribution of $x_i$ given the data and $\beta$ doesn't seem to have an analytic solution for gibbs sampling.

Any tips / pointers to discussions appreciated.

Edit for clarity:

Both $y_i$ and a set $x_i^{(1)},...,x_i^{(n)}$ are observed. $\{x_i\}$ are then used to fit $\mu_i$ (which could be performed in the same MCMC run) and then random samples $z_i$ are drawn from $g(\mu_i)$ to construct the mean $\beta_0 + \beta_1 z_i$ for the inference of $\beta$.

This (slightly strange) modelling choice is chosen to get a full posterior on $\beta$ that takes into account the "true" $z$ generating the mean is hugely variable and that the $x$ observations are unreliable.

• This is a regression with errors in variables or random/mixed effects. The MCMC issue should be clarified and may asked as a separate question. Do you observe the $x_i$'s? – Xi'an Feb 16 '15 at 18:00
• Thanks for your reply. For each $y_i$ I have a (very noisy) set $\{x_i\}$ measured, so my idea was to fit a model to $\{x\}$ (ie find $\mu$) then construct the problem above (perhaps bad to use $x$ again, maybe $z$ since not actually observed). Of course eventually I'd like to do inference of $\mu$ in the same MCMC run as $\beta$, but trying to take small steps just now. – kezz_smc Feb 17 '15 at 10:43
• could you provide more details on the model you tried? – Xi'an Feb 18 '15 at 7:32

As stated, if the $x_i$ are observed, the fact that they are random does not modify the conditional model $$y_i \sim f(y;\beta_0 + \beta_1 x_i)$$ and hence the posterior on $\mathbf\beta$ does not incorporate this item of information.
If you had an error in variable model, \begin{align*}y_i &\sim f(y;\beta_0 + \beta_1\mu_i)\\x_i&\sim g(x;\mu_i)\end{align*} then both $\mathbf\beta$ and $\mu$ would be treated simultaneously. Provided you can construct a prior on the $\mu_i$'s that creates interaction.
• "Treated simultaneously" is just simultaneously inferred from the same MCMC run? The latter error in variable model you propose is most similar to what I have, except the mean of $y_i$ is $\beta_0 + \beta_1 z_i$ where $z_i$ is drawn from $g(x;\mu_i)$ but only the observed $x_i$ are used to fit $\mu_i$ (apologies for change of notation, I should have made it clearer in the original question). – kezz_smc Feb 18 '15 at 10:50