Archive for bet-binomial distribution

dbetabinom versions

Posted in R, Statistics, University life with tags , , , on February 18, 2013 by xi'an

I got this email from a student:

(1) I used the following R function in package “emdbook

dbetabinom(x,prob,size,theta, shape1,shape2,log=FALSE)

more precisely I did

curve(dbetabinom(x,size=15,shape1=3,shape2=7),ylim=c(0,.12),xlim=c(0,10))

(2) instead I use the following R function in package “VGAM

dbetabinom.ab(x,size,shape1,shape2,log=FALSE,.dontuse.prob=NULL)

more precisely I did

curve(dbetabinom.ab(x,size=15,shape1=3,shape2=7),ylim=c(0,.12),xlim=c(0,10))

and I get two different curves! Sad!

to which I replied only the following

> dbetabinom.ab(1:10,size=15,shape1=3,shape2=7)
[1] 0.08893281 0.12450593 0.14198045 0.14198045 0.12861758
[6] 0.10718132 0.08268273 0.05905909 0.03886795 0.02332077
> dbetabinom(1:10,size=15,shape1=3,shape2=7)
[1] 0.08893281 0.12450593 0.14198045 0.14198045 0.12861758
[6] 0.10718132 0.08268273 0.05905909 0.03886795 0.02332077

as the beta-binomial density is only defined for integers! (emdbook is the R package associated with Benjamin Bolker’s Ecological Models and Data in R.)

Follow

Get every new post delivered to your Inbox.

Join 680 other followers