Site icon R-bloggers

dbetabinom versions

[This article was first published on Xi'an's Og » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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.)


Filed under: R, Statistics, University life Tagged: bet-binomial distribution, emdbook, R, VGAM

To leave a comment for the author, please follow the link and comment on their blog: Xi'an's Og » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.