Skip to contents

Beta parameters from quantiles

Usage

betaParamsFromQuantiles(
  q,
  p = c(0.025, 0.975),
  precision = 0.001,
  derivative.epsilon = 0.001,
  start.with.normal.approx = TRUE,
  start = c(1, 1),
  report.details = FALSE,
  plot = FALSE
)

Arguments

q

A vector of two quantiles (locations).

p

A vector of two probabilities.

precision

Desired precision in beta distribution parameters. Determines when iterative process stops.

derivative.epsilon

Small value used for ε in the approximation of the derivatives of a few functions in the algorithm.

start.with.normal.approx

Logical. Whether or not to start the iterative process with values obtained from a normal approximation to the Beta distribution.

start

Vector (of length 2) of initial values for Beta distribution parameters. Ignored when start.with.normal.approx = TRUE.

report.details

If FALSE then only beta parameters a and b are returned. See details for values returned if TRUE.

plot

Logical. Whether or not to plot the resulting Beta distribution, along with tail probabilities obtained.

Value

A list including at least a and b beta shape parameters. See details for more.

Details

Function works iteratively to estimate parameters with specified precision. Returned list includes:

$a : First shape parameter for beta distribution.

$b : Second shape parameter for beta distribution.

$last.change : Last change in $a and $b in the interative algorithm.

$niter : Number of iterations run before convergence.

$q : Quantiles

$p : Probabilities

$p.check : A quick validation: values for $a and $b returned lead to cumulative probabilities $p.check at the quantiles $q.

Version 1.3 (February 2017) Function developed by Lawrence Joseph and pbelisle Division of Clinical Epidemiology Montreal General Hospital Montreal, Qc, Can patrick.belisle@rimuhc.ca http://www.medicine.mcgill.ca/epidemiology/Joseph/PBelisle/BetaParmsFromQuantiles.html