Learn R Programming

MBASED (version 1.6.0)

getMuRho: Functions to convert between shape parameters a and b for beta distribution and parameters mu (mean) and rho (dispersion).

Description

Functions to convert between shape parameters a and b for beta distribution and parameters mu (mean) and rho (dispersion).

Usage

getMuRho(a, b, checkArgs = FALSE)
getAB(mu, rho, checkArgs = FALSE)

Arguments

a,b
shape parameters for beta distribution. Must be >0.
checkArgs
single boolean specifying whether arguments should be checked for adherence to specifications. DEFAULT: FALSE
mu,rho
mean and dispersion parameters for beta distribution, respectively. Must be in (0,1) interval, although rho is allowed to take on value of 0 (binomial distribution).

Value

getMuRho returns a list with 2 elements: mu and rho (vectors, if the arguments a and b are vectors).getAB returns a list with 2 elements: a and b (vectors, if arguments mu and rho are vectors). For values of rho=0, the resulting entries are NA.

Details

getMuRho takes in shape parameters a and b and returns list with parameters mu (a/(a+b)) and rho (1/(a+b+1)). The function is vectorized (both a and b can be vectors (of the same length) or matrices (of the same dimension)).

getAB takes in shape mean and dispersion parameters mu and rho and returns shape parameters a (mu*(1/rho-1)) and b ((1-mu)*(1/rho-1)). The function is vectorized (both mu and rho can be vectors (of the same length) or matrices (of the same dimension)).

See Also

Other bbFunctions: vectorizedRbetabinomAB, vectorizedRbetabinomMR, vectorizedRbetabinomMR

Other bbFunctions: vectorizedRbetabinomAB, vectorizedRbetabinomMR, vectorizedRbetabinomMR

Examples

Run this code
MBASED:::getMuRho(a=1, b=1)
MBASED:::getAB(mu=1/2, rho=1/3)
MBASED:::getMuRho(MBASED:::getAB(mu=0.7, rho=0.0045)$a, MBASED:::getAB(mu=0.7, rho=0.0045)$b)
MBASED:::getAB(MBASED:::getMuRho(a=0.2, b=4)$mu, MBASED:::getMuRho(a=0.2, b=4)$rho)

Run the code above in your browser using DataLab