Skip to contents

Returns an BETA distribution object that produce random numbers from a beta distribution using the rbeta function

Usage

new_BETA(p_shape1, p_shape2, p_dimnames = "rvar")

new_BETA_lci(p_mean, p_lci, p_uci, p_dimnames = "rvar")

new_BETA_lci2(p_mean, p_lci, p_uci, p_dimnames = "rvar")

Arguments

p_shape1

non-negative parameters of the Beta distribution

p_shape2

non-negative parameters of the Beta distribution

p_dimnames

A character that represents the name of the dimension

p_mean

A numeric that represents the expected value of the proportion

p_lci

A numeric for the lower 95% confidence interval

p_uci

A numeric for the upper 95% confidence interval

Value

An object of class DISTRIBUTION, BETA

Functions

  • new_BETA_lci(): Constructor based on confidence intervals. Preserve expected value.

  • new_BETA_lci2(): Constructor based on ML confidence intervals

Note

When using confidence intervals, the shape parameters are obtained using the following formula:

\(varp = (p_uci-p_lci)/4^2\)

\(shape1 = p_mean * (p_mean * (1 - p_mean) / varp - 1)\)

\(shape2 =(1 - p_mean) * (p_mean * (1 - p_mean) / varp - 1) \)

new_BETA_lci2 estimate parameters using maximum likelihood myDistr <- new_BETA_lci2(0.30,0.25,0.35) myDistr$rfunc(10)

Author

John J. Aponte

Examples

myDistr <- new_BETA(1,1)
myDistr$rfunc(10)
#>          rvar
#> 1  0.16566696
#> 2  0.84279156
#> 3  0.53360650
#> 4  0.71023276
#> 5  0.22747849
#> 6  0.82505937
#> 7  0.67961427
#> 8  0.80433017
#> 9  0.93633854
#> 10 0.02445216
myDistr <- new_BETA_lci(0.30,0.25,0.35)
myDistr$rfunc(10)
#>         rvar
#> 1  0.3184059
#> 2  0.2510281
#> 3  0.3148597
#> 4  0.2428678
#> 5  0.2852765
#> 6  0.2985150
#> 7  0.3157819
#> 8  0.2738824
#> 9  0.3135334
#> 10 0.3104217