# Bayesian errors-in-variables model definition in JAGS and symbolically

I'm fairly new to probability theory and am attempting to understand and implement an errors-in-variables simple linear regression model. I am assuming a model of the form

$$Y=\theta X_a+\epsilon_Y \\ X_a=X_o+\epsilon_X$$ where $X_a$ is the true (unknown) covariate and $X_o$ is the covariate observed with error.

This r-bloggers post describes the JAGS model that seems to fit the bill:

model {
## Priors
alpha ~ dnorm(0, .001)
beta ~ dnorm(0, .001)
sdy ~ dunif(0, 100)
tauy <- 1 / (sdy * sdy)
taux ~ dunif(.03, .05)

## Likelihood
for (i in 1:n){
truex[i] ~ dnorm(0, .04)
x[i] ~ dnorm(truex[i], taux)
y[i] ~ dnorm(mu[i], tauy)
mu[i] <- alpha + beta * truex[i]
}
}


What is unclear to me is how exactly this JAGS model would be expressed in probability notation.

According to Bayes' Rule, my intuition of the high-level form of the model I want is

$$P(\theta,X_a|Y,X_o)\propto P(Y,X_o|\theta, X_a) P(\theta,X_a),$$

since $\theta$ and $X_a$ are both dependent on the data $Y$ and $X_o$. How can this be expressed in simpler terms? How would the above JAGS model be expressed symbolically as Bayes' Rule?

EDIT: Clarity

• What do you mean by expressing it as "formula"? – Tim May 27 '16 at 21:20
• Sorry, I should've been clearer. I mean symbolically in the form of Bayes' Rule. – Aorus May 27 '16 at 21:41

$$\alpha \sim \mathrm{Normal}(0, .001) \\ \beta \sim \mathrm{Normal}(0, .001) \\ \sigma_y \sim \mathrm{Uniform}(0, 100) \\ \tau_y = 1 / \sigma_y^2 \\ \tau_x \sim \mathrm{Uniform}(.03, .05) \\ x_{0i} \sim \mathrm{Normal}(0, .04) \\ x_i \sim \mathrm{Normal}(x_{0i}, \tau_x) \\ y_i \sim \mathrm{Normal}(\mu_i, \tau_y) \\ \mu_i = \alpha + \beta x_{0i} \\$$
$$p(\alpha,\beta,x_{0i},\tau_y,\tau_x|y_i,x_i) \propto \\ \underbrace{p(y_i|\alpha,\beta,x_{0i},\tau_y) ~ p(x_i|x_{0i},\tau_x)}_{\text{likelihood}} ~ \underbrace{p(x_{0i}) ~ p(\alpha) ~ p(\beta) ~ p(\tau_x) ~ p(\tau_y)}_{\text{priors}}$$