Thanks for everyone offered help with my program that places a normal
distribution on log(tau), where tau is a precision parameter for mu[i]. My
problem was indeed that I initialized tau rather than logtau. I got it to
work, but then I changed the mean of the mu[i]'s from 0 to -3 and got the
message
**** gp.rts: real compare with NaN in module DFreeARS at line 43 ****
Abort!
The whole reason for working with logtau rather than tau was that when I
assumed tau has a gamma distribution, the posterior means for mu[i] were
sensitive to the parameters I specified for the gamma distribution. My
interpretation was that a gamma distribution with large variance wasn't
really a good approximation to the "noninformative" prior of say 1/tau^2.
If anyone has any further comments, I would be grateful. Thanks again.
Gene Pennello email:[log in to unmask]
FDA/CDRH/DBS W: (301)443-7491 ext 143
MSC HFZ-542 Fax:(301)443-8559
1350 Piccard Dr
Rockville MD 20850
I am a recent user of bugs and was trying to implement a noninformative
prior on a precision parameter tau by assigning to log(tau) a flat prior, a
normal distribution with large variance. My thinking was that tau is a
scale parameter, therefore log(tau) is a location parameter, and Jeffreys
says that the noninformative prior on a location parameter is proportional
to a constant, that is, is flat. However, I couldn't get this to work.
When I compile the code listed below, I get the error message
Error in file: d:\bugs\gene\rats\logit.bug
tau <- exp(logtau);
$
at line 18 column 8
-- error --
Node already infered to be data or stochastic.
The error is in reference to the three statements
mu[i] ~ dnorm(0,tau);
tau <- exp(logtau);
logtau ~ dnorm(0,1.0E-3);
Can anyone please tell me what is wrong with these statements? From what I
can tell from the manual, Section 4.8, they are permissable. It would be
even better if someone could also tell me how to implement this idea.
Thanks in advance. Gene.
Gene Pennello email:[log in to unmask]
FDA/CDRH/DBS W: (301)443-7491 ext 143
MSC HFZ-542 Fax:(301)443-8559
1350 Piccard Dr
Rockville MD 20850
model logit;
const
N=2; # number of samples
var
mu[N], rr[N], pp[N], nn[N], tau, sigma, logtau;
data rr,nn in "d:\bugs\gene\rats\logit.dat";
inits in "logit.in";
{
for (i in 1:N) {
rr[i] ~ dbin(pp[i], nn[i])
logit(pp[i]) <-mu[i]
mu[i] ~ dnorm(0,tau);
}
tau <- exp(logtau);
logtau ~ dnorm(0,1.0E-3);
sigma <- 1.0/sqrt(tau);
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|