4
$\begingroup$

Suppose we have a hierarchical model summarised by the following:

$y_{i} \sim N(\mu_{i}, \sigma^{2})$, for $i = 1, \ldots, n$; (For these purposes, assume $\sigma^{2}$ is known)

where $\mu_{i} = \alpha + \beta x_{i}$ and each $x_{i}$ is a given predictor variable for $i = 1, \ldots, n$

Next,

$\alpha \sim N(\mu_{\alpha}, \sigma_{\alpha}^{2})$ and $\beta \sim N(\mu_{\beta}, \sigma_{\beta}^{2})$

Finally,

$p(\mu_{\alpha}, \mu_{\beta}, \sigma_{\alpha}^{2}, \sigma_{\beta}^{2}) \propto \frac{1}{\sigma^{2}_{\alpha}\sigma^{2}_{\beta}}$

How can this model be fitted in WinBUGS?

I know that the last two levels are given by:

for (i in 1:N){
 y[i] ~ dnorm(mu[i], sigma.squared)
 mu[i] <- alpha + beta*x[i]
}
alpha ~ dnorm(mu.alpha, sigma.squared.alpha)
beta ~ dnorm(mu.beta, sigma.squared.beta)

However, I'm not sure, how the joint prior for $\mu_{\alpha}, \mu_{\beta}, \sigma_{\alpha}^{2}, \sigma_{\beta}^{2}$ should be incorporated into the model.

In particular, how is the hyper-prior distribution represented in the WinBUGS code, how can I achieve values for $\mu_{\alpha}$ and $\mu_{\beta}$ from this distribution and how should $\sigma_{\alpha}^{2}$ and $\sigma_{\beta}^{2}$ be chosen?

$\endgroup$
1
$\begingroup$

In "vintage" WinBugs this may work:

mu.alpha ~ dnorm(0, 0.001)
mu.beta  ~ dnorm(0, 0.001)

sigma.squared.alpha ~ dgamma(0.001, 0.001)
sigma.squared.beta  ~ dgamma(0.001, 0.001)
$\endgroup$
0
$\begingroup$

The prior for the means shoulds be specifyed as

mu~dflat()

I haven't pratice bayesian for a long time, but I think a uniform prior on log(sigma) is equivalent to what you want. You could verify it with the following formula :

enter image description here

so for variances, this code should work :

log(sigma)~dflat()
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.