gelfand:smith:lee:92 analyse fictitious data arranged in a two way table, intended to represent response data as might occur in consumer preference studies. We wish to impose the constraints that the row effects are decreasing while the column effects increase to the middle column and then decrease.
Then we assume
Following gelfand:smith:lee:92 we set
,
and a =0,b=1. We wish to impose the constraints that
,
and
The appropriate graph is shown
in Figure 28, where undirected dashed lines are used to represent the logical order constraints.
Figure 28:
Graphical model for marsbars example
The BUGS code for this model is given below. We note the use of the I(.,.) notation to denote constraints, and the convenience with which other unknowns may be included into constraints.
Marsbars: model specification in BUGS
model MarsBars;
const
cols = 5, rows = 4,
tau.alpha = 0.20, mu.alpha = 0.0,
tau.beta = 0.20, mu.beta = 0.0;
var
Y[rows,cols], mu[rows,cols], tau, beta[cols],
alpha[rows], bound, sigma;
data Y in "marsbars.dat";
inits in "marsbars.in";
{
for(j in 1:cols) {
for (i in 1:rows) {
mu[i,j] <- alpha[i] + beta[j];
Y[i,j] ~ dnorm(mu[i,j],tau)
}
}
tau ~ dgamma(1.0E-3,1.0E-3);
sigma <- 1/sqrt(tau);
alpha[1] ~ dnorm(mu.alpha,tau.alpha)I(alpha[2],);
alpha[2] ~ dnorm(mu.alpha,tau.alpha)I(alpha[3],alpha[1]);
alpha[3] ~ dnorm(mu.alpha,tau.alpha)I(alpha[4],alpha[2]);
alpha[4] ~ dnorm(mu.alpha,tau.alpha)I(,alpha[3]);
bound <- max(beta[2],beta[4]);
beta[1] ~ dnorm(mu.beta,tau.beta)I(,beta[2]);
beta[2] ~ dnorm(mu.beta,tau.beta)I(beta[1],beta[3]);
beta[3] ~ dnorm(mu.beta,tau.beta)I(bound,);
beta[4] ~ dnorm(mu.beta,tau.beta)I(beta[5],beta[3]);
beta[5] ~ dnorm(mu.beta,tau.beta)I(,beta[4]);
}
Analysis
A run of 1000 iterations only took 1 second after a 500 iteration burn-in, and gave the following estimates, which may be compared to the posterior plots provided in gelfand:smith:lee:92.