Hi All!
I can't find anything in the archive about this, Google has failed me,
and the statistician that got me started on BUGS moved across the
country! I'm not sure where to turn, but hopefully someone here can
help.
(A bunch of these details are changed for the sake of making it
simpler to discuss)
We collected 10-30 fish from 10 lakes and measured mercury in the
fish. We are interested in whether or not characteristics of these 10
lakes influence the amount of mercury in each fish. However, not only
is our sampling uneven among lakes, but the size of a fish strongly
influences its mercury content (independent of anything else). So
what we did is build a regression between fish size and fish mercury
within each lake, and use that regression to make a prediction of the
amount of mercury in standard sized fish. For example, we figured out
what the mercury content of a 20 cm fish in each lake.
So we ended up with 10 lakes each with a predicted value for a 20 cm
fish. These predicted values were then regressed against lake
characteristics (e.g., Mercury loading). (Using conventional
statistics) This all took place prior to me getting involved. The
reviewers feel the variation within lakes is being ignored here.
I assumed I could do this analysis in OpenBUGS pretty easily. We'd
build the regressions, make the estimates (as distributions) and then
just plug those distributions into a new regression. This was my
attempt to do that:
--model{
a~dnorm(0,1.0E-6)
b~dnorm(0,1.0E-6)
prec~dgamma(0.001,0.001)
c~dnorm(0,1.0E-6)
d~dnorm(0,1.0E-6)
prec2~dgamma(0.001,0.001)
e~dnorm(0,1.0E-6)
f~dnorm(0,1.0E-6)
prec3~dgamma(0.001,0.001)
## Just a list of initial values for model variables on the
within-lake regressions, I'm just showing 3 lakes for simplicity
for (i in 1:17) ## The models for the within-lake regressions
{
mean [i] <- a+b*x[i]
y[i] ~dnorm(mean[i],prec)
mean2 [i] <- c+d*x2[i]
y2[i] ~dnorm(mean2[i],prec2)
mean3 [i] <- e+f*x3[i]
y3[i] ~dnorm(mean3[i],prec3)
}
## In this case, x is the fish length and y is the mercury content
Prediction[1]<-a+b*0.2
Prediction[2]<-c+d*0.2
Prediction[3]<-e+f*0.2
## And these are the predictions made by the models for a particular fish length
## At this point I thought I could just repeat this to build the
among-lakes model
b4~dnorm(0,1.0E-6)
prec4~dgamma(0.001,0.001)
a4~dnorm(0,1.0E-6)
for(n) in 1:3)
{
mean4[n] <- a4+b4*LakeDepth[n]
Prediction[n] ~dnorm(mean4[n],prec4)
}
## This apparently doesn't work like I thought it would :/
}
The error is "multiple definitions of node Prediction[1], which is
actually obvious when I look at this. Is there a way to do this?
The other idea I had was to just use the "Prediction" distributions to
generate 500 or so data points for each lake, and then do a regression
using those predictions from each lake.
Thanks for whatever help you can provide!
James
-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
|