Learn R Programming

HSROC (version 2.1.3)

beta.parameter: A function that returns the shape parameters of the beta distribution

Description

When provided the minimum and maximum values corresponding to the prior information on a parameter (within [0, 1]), the function returns the shape parameters of the beta distribution, namely $\alpha$ and $\beta$, that covers this range.

Usage

beta.parameter(low, up)

Arguments

low
numeric argument. Lower bound of the range
up
numeric argument. Upper bound of the range

Value

  • It returns a list object consisting of the shape parameters alpha and beta of the Beta distribution such that $$\frac{\alpha}{\alpha + \beta} = \frac{low + up}{2}$$ and $$\frac{\alpha \beta}{(\alpha + \beta)^2(\alpha + \beta + 1)} = \frac{up - low}{4}$$ The function has been built such that the particular case where $low = up = 1$ will return $\alpha = \beta = 1$.

Details

The low argument must always be less than the up argument. Also, both low and up arguments must remain within [0, 1].

Examples

Run this code
beta.parameter(-1, 0.5) #Returns error!
beta.parameter(0, 0) #Not allowed.  Returns error!
beta.parameter(0.75, 0.25) #Returns error!

beta.parameter(0, 1)
beta.parameter(0.5, 1) 
beta.parameter(0.1, 0.7)

Run the code above in your browser using DataLab