On Mon, 25 Sep 2000, Troels Ring wrote:
> Dear friends. In Carlin and Louis "Bayes and emperical Bayes
methods.."
> 1996 the classical example of 12 independent tosses of a fair coin
> producing 9 heads and 3 tails is given. If the situation is seen as a fixed
> sample of 12, a binomial lieklihood is used, and Carlin et al reports a
> probability of 0.075.
> Using sum(dbinom(9:12,12,.5)) I obtain 0.073
For this one you can easily calculate it directly
choose(12,9:12)*0.5^12
gives the same as dbinom(9:12,12,0.5) to machine precision, and you can
check by hand that choose(12,9:12) is giving the right answer. Also
1-pbinom(8,12,0.5)
gives the same answer using a different method.
The negative binomial is harder to check by hand, but the binomial
suggests that R is doing it right. I'm not sure what the book does --
their answer does not come from rounding the summands to a fixed number of
significant digits or decimal places.
-thomas
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._