dbetabinom versions

February 17, 2013
By

(This article was first published on Xi'an's Og » R, and kindly contributed to R-bloggers)

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 his blog: Xi'an's Og » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.