dfba_beta_descriptive {DFBA} | R Documentation |
Descriptive Statistics for a Beta Distribution
Description
Given the two shape parameters for a beta distribution, the function provides central tendency statistics, interval limits, and density and cumulative probabilities.
Usage
dfba_beta_descriptive(a, b, prob_interval = 0.95)
Arguments
a |
The first shape parameter for the beta distribution. Must be positive and finite. |
b |
The second shape parameter for the beta distribution. Must be positive and finite. |
prob_interval |
Desired probability within interval limits (default is .95) |
Details
The density function for a beta variate is
f(x) = \begin{cases} Kx^{a-1}(1-x)^{b-1} & \quad \textrm{if } 0 \le x \le 1, \\0 & \quad \textrm{otherwise} \end{cases}
where
K = \frac{\Gamma(a + b)}{\Gamma(a)\Gamma(b)}.
(Johnson, Kotz, & Balakrishnan, 1995). The two shape parameters a
and b
must
be positive values.
The dfba_beta_descriptive()
function provides features
to complement the beta distribution functions available in the stats
package. The function provides the mean, median, mode, and variance for a
beta variate in terms of its two shape parameters.
While the mean, variance, and median are straightforward, there are several
conditions that result in an undefined mode. When either (1) a = b = 1
,
(2) a < 1
, or (3) b < 1
, the mode is undefined. For example,
when a = b = 1
, the function is the uniform distribution, which does not
have a modal value. The other cases above result in the density function
diverging at either x = 0
or x = 1
. The function returns a value of
NA
for the mode for all the cases where a unique mode does not exist.
For interval estimation, the function finds an equal-tail interval limits in
all cases, and it also provides the highest-density limits when there is a
well-defined mode. When the mode does not exist, the function returns NA
for the limits for the highest-density interval (HDI). For interval
estimation, the probability between the lower and upper limit is the
probability specified in the prob_interval
input. The
dfba_beta_descriptive()
output object includes a dataframe that has
density and cumulative probability information that can be used for plotting.
Value
A list containing the following components:
a |
The first beta shape parameter |
b |
The second beta shape parameter |
prob_interval |
The probability for interval estimates |
x_mean |
The mean of the distribution |
x_median |
The median of the distribution |
x_mode |
The mode for the distribution |
x_variance |
The variance for the distribution |
eti_lower |
The equal-tail lower interval limit |
eti_upper |
The equal-tail upper interval limit |
hdi_lower |
The lower limit for the highest-density interval |
hdi_upper |
The upper limit for the highest-density interval |
outputdf |
A dataframe of |
References
Johnson, N. L., Kotz S., and Balakrishnan, N. (1995). Continuous Univariate Distributions, Vol. 1, New York: Wiley.
See Also
Distributions
for additional details on
functions for the beta distribution in the stats package.
Examples
dfba_beta_descriptive(a = 38,
b = 55)
dfba_beta_descriptive(38,
55,
prob_interval=.99)