The following code is applied to a data matrix, X, consisting of 883 rows
and 3 columns. The first column is an environmental response variable that
is controlled by values in the last two columns, which are dummy variable
indices. More specifically, the second column represents a random effect
due to the "town" where an observation lies; there are T=33 towns, so
values in this column are from 1 to 33. Similarly, the third column
represents a random effect due to the "geology" where an observation lies;
there are G=8 different geologic types, so values in this column are from 1
to 8. Some geology values are missing (represented by NA in SPlus format).
The indexing of linear coefficients for these random effects is similar to
how it is done in the "Kidney" example for the variable "disease".
In WinBUGS1.3, this code checks as being syntactically correct and the data
loads fine. However, when I attempt to compile it, the following message
appears:
"made use of undefined node mu (if mu is logical, check it's 'parents'
are defined)"
The node mu is logical and it's parents are all defined (alpha,
beta.town[j] for j=1,...,T and beta.geol[k] for k=1,...,G are all given
non-informative, but proper, priors). Therefore, I fail to see any logical
explanation for this message and the corresponding failure to compile. I
tried many variations of coding, yet continue to get the same response. I
even generated code by creating a doodle which was syntactically correct.
Any help will be greatly appreciated. I can send data (or a subset) if
necessary.
model
{
for (i in 1:N) {
X[i,1]~dnorm(mu[i],tau)
mu[i] <- alpha + beta.town[X[i,2]] +
beta.geol[X[i,3]]
}
alpha ~ dnorm(0.0, 0.0001)
for(j in 1:T) {
beta.town[j] ~ dnorm(0.0, 0.0001)
}
for(k in 1:G) {
beta.geol[k] ~ dnorm(0.0, 0.0001)
}
tau ~ dgamma(1.0E-3, 1.0E-3);
sigma <- 1/sqrt(tau); # s.d. of random effects
}
Thank you,
Glen D. Johnson
New York State Department of Health
Bureau of Environmental and Occupational Epidemiology
Flanigan Square, 547 River Street, Room 200
Troy, NY 12180-2216
Phone: 518-402-7950 Fax: 518-402-7959
email: [log in to unmask]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|