Thanks to Andrew Millard and Andrew Thomas for replies.
I've posted their emails to me below, along with my original, but I'll
summarize as best I can.
1) It looks like the answer to the discrepancy might be a bug and that
dunif(0, 10) is in fact somewhat informative for this model and data...
2) The ones trick seems to be giving the right answer and the bug lies in
the combination of dpois() with a uniform prior.
Cheers,
Mick
=====
From Andrew Millard...
Mick
All is not what it seems here. Your Unif(0,10) prior is informative when
comparing answers to several significant figures. Using the formulae for
finding posterior means and variances given means and variances for
likelihood and prior I get:
Prior posterior mean posterior sd
dunif(0,10) 1.21557 0.184784
dgamma(0.001,0.001) 1.19999 0.185160
dunif(0,1000) 1.20000 0.185164
However even with very long runs (10 million iterations) Winbugs 1.4 still
gives a mean of 1.200 for the dpois+dunif model, and 1.228 for the
ones+dunif model, and neither changes when I change to a dunif(0,1000)
prior, though with this run length I would expect to be able to detect the
small difference in posterior means. In the dpois version, lambda has the
same update method for both dunif and dgamma priors.
I've tried changing initial values and over-relaxing but neither affected
the results. Very odd. If no-one comes up with an explanation this looks
like a bug of some sort.
Andrew
=====
From Andrew Thomas:
Hei,
I think the problem is in the model with a posson for the data and a
uniform prior. The uniform prior should give the same results as this prior
lambda ~ dgamma(1, 1.0E-4)I(,10)
but does not. I think the ones trick is giving the right answer.
Looking in MODULE GraphUniform in PROCEDURE PriorForm I think the expression
for the p0 parameter is wrong for the as == gamma branch.
I will fix
Regards
Andrew
=====
Original email:
Dear All,
As an exercise to better understand the ones trick, I fitted some data to a
Poisson model using both the dpois() distribution and the "ones trick" (as
in the WinBUGS manual). The posterior distribution for the dpois() version
did not depend on the choice of two non-informative priors (dunif(0, 10) vs
gdamma(0.001, 0.001)). However, and to my surprise, the posterior did
depend on this choice when using the ones trick. The dpois() version and
the ones trick produced essentially the same result for dgamma(), but
different results for dunif().
Does anyone know why this might occur?
Two additional points:
1) A non-informative prior "should" give the result achieved using the
dpois() model (posterior for lambda should be ~dgamma(42, 35) -> mean=1.20,
sd=0.185).
2) The ones trick and the zeroes trick give the same result, with the
choice between the two "uninformative" priors influencing the posterior.
The WinBUGS code, data and output are given below...
dpois() version:
model
{
lambda ~ dunif(0, 10)
# lambda ~ dgamma(0.001, 0.001)
for (i in 1:35)
{
Offspring[i] ~ dpois(lambda)
}
}
data:
list(Offspring=c(0,0,0,0,0,1,1,1,1,1,1,1,1,1, 2,2,2,2,2,2,2,2, 3,3, 5,
0,0,0,0,0, 1,1,1,1, 2))
init:
list(lambda=1)
Both priors lead to:
node mean sd MC
error 2.5% median 97.5% start sample
lambda 1.199 0.1853 5.746E-4 0.865 1.19 1.588
1001 100000
ones trick version:
model
{
# lambda ~ dgamma(0.001, 0.001)
lambda ~ dunif(0, 10)
for (i in 1:35)
{
p[i] <- exp(-lambda + Offspring[i]*log(lambda) - logfact(Offspring[i]))
ones[i] <- 1
ones[i] ~ dbern(p[i])
}
}
same data:
list(Offspring=c(0,0,0,0,0,1,1,1,1,1,1,1,1,1, 2,2,2,2,2,2,2,2, 3,3, 5,
0,0,0,0,0, 1,1,1,1, 2))
init:
list(lambda=1)
The choice of prior influences the result:
prior: dgamma(0.001, 0.001)
node mean sd MC
error 2.5% median 97.5% start sample
lambda 1.199 0.1854 6.047E-4 0.8629 1.19 1.59
1001 100000
prior: dunif(0, 10)
node mean sd MC
error 2.5% median 97.5% start sample
lambda 1.228 0.1869 5.791E-4 0.8898 1.219 1.619
1001 100000
Thanks for any comments or ideas.
Cheers,
Mick
Michael McCarthy
Australian Research Centre for Urban Ecology
Royal Botanic Gardens Melbourne
c/o School of Botany
University of Melbourne
Parkville VIC 3010
Australia
ph: +61 3 8344 6856
fax: +61 3 9347 9123
web: www.nceas.ucsb.edu/~mccarthy
-------------------------------------------------------------------
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
|