Calculate the error in matching a specified confidence interval with a Gamma distribution prior.

sum_squares(
  shape,
  lower_CI,
  upper_CI,
  mean,
  confidence_level = 0.95,
  alpha = (1 - confidence_level)/2
)

Arguments

shape

The shape ("gamma") parameter of a Gamma distribution

lower_CI

The lower confidence limit that we are trying to match

upper_CI

The upper confidence limit that we are trying to match

mean

The mean of the Gamma distribution (= shape * scale)

confidence_level

The confidence level of the confidence interval (1 - alpha)

alpha

= 1 - `confidence_level`

Value

The sum of relative squared errors between the confidence limits and the quantiles of the fitted distribution.