Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation Update for Beta Binomial #10

Closed
sjenkins20 opened this issue Jun 6, 2020 · 3 comments
Closed

Documentation Update for Beta Binomial #10

sjenkins20 opened this issue Jun 6, 2020 · 3 comments

Comments

@sjenkins20
Copy link

The documentation for the beta binomial distribution in the library rmutil appears to be incorrect. The equation makes reference to \mu and \sigma, but there is no reference to them in the inputs.

From a useability point of view, it would also be useful if there was a reference to how the variables relate to the standard notation for the distribution i.e.: the parameters alpha and beta.

@swihart
Copy link
Owner

swihart commented Jun 6, 2020

I'm looking into doing some edits. I need a couple of days to do so. Would you care to give me a link you use for "standard notation"?

@swihart
Copy link
Owner

swihart commented Jun 8, 2020

Looks like the parameterizations go like this --

# The beta binomial distribution with total = n and prob = m has density
# 
# p(y) = B(y+s m,n-y+s (1-m)) Choose(n,y) / B(s m,s (1-m))
# 
# for y = 0, …, n where B() is the beta function.

## in `rmutil` from the .Rd file (excerpt above), the "alpha" is s*m
## in `rmutil` from the .Rd file (excerpt above), the "beta"  is s*(1-m)

## in `VGAM`, rho is 1/(1+alpha+beta)

qq = 2.2
zz = 100

alpha = 1.1
beta  = 2
VGAM::pbetabinom.ab(q=qq, size=zz, shape1=alpha, shape2=beta)

## for VGAM `rho`
rr = 1/(1+alpha+beta)
VGAM::pbetabinom   (q=qq, size=zz, prob=mm, rho = rr)

## for rmutil `m` and `s`:
mm = alpha / (alpha+beta)
ss = (alpha+beta)
rmutil::pbetabinom(q=qq, size=zz, m=mm, s=ss )

executed:

> qq = 2.2
> zz = 100
> alpha = 1.1
> beta  = 2
> VGAM::pbetabinom.ab(q=qq, size=zz, shape1=alpha, shape2=beta)
[1] 0.04367989
> ## for VGAM `rho`
> rr = 1/(1+alpha+beta)
> VGAM::pbetabinom   (q=qq, size=zz, prob=mm, rho = rr)
[1] 0.04367989
> ## for rmutil `m` and `s`:
> mm = alpha / (alpha+beta)
> ss = (alpha+beta)
> rmutil::pbetabinom(q=qq, size=zz, m=mm, s=ss )
[1] 0.04367989

This seem right to you? Anchor it in VGAM's (and wikipedia's) parameterization using alpha and beta and then express everything else in term of alpha and beta?

@swihart
Copy link
Owner

swihart commented Jun 8, 2020

Also added it to the arguments section. Thanks!

@swihart swihart closed this as completed Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants