# I am trying to write a C++ program for parameter estimation(with Confidence Interval information) of an Exponentially distributed data set. I understand that lambda barX ∼ Γ(n,n). To come up with numeric values of lower/higher confidence intervals for a specified alpha, I need to be able to compute Inverse Gamma. Could you please point me to some algorithms?

I am trying to write a C++ program for parameter estimation(with Confidence Interval information) of an Exponentially distributed data set. I understand that $\lambda \overline{X}\sim \mathrm{\Gamma }\left(n,n\right)$. To come up with numeric values of lower/higher confidence intervals for a specified $\alpha$, I need to be able to compute Inverse Gamma. Could you please point me to some algorithms?
You can still ask an expert for help

• Questions are typically answered in as fast as 30 minutes

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it

Isaiah Haynes
Step 1
Either I misunderstand the problem, or you are making it more difficult than necessary.
Let L and U cut probability $\alpha /2$ from the lower and upper tails of $Gamma\left(shape=n,rate=n\right),$, Then a $1-\alpha$ confidence interval for $\lambda$ is found as follows:
$P\left(L<\lambda \overline{X},
so the desired CI is $\left(L/\overline{X},\phantom{\rule{thickmathspace}{0ex}}U/\overline{X}\right)$.
It is not difficult to program numerical integration to find U and L because the PDF of Gamma(n,n) can be evaluated. Alternatively, I'm sure there must be a compiled FORTRAN program in the IMSL library of statistical algorithms that can be called from C++.
In particular, if ${X}_{1},{X}_{2},\dots ,{X}_{25}$ is a random sample from $Exp\left(rate=.2\right),$, we might have the following sample (rounded to 3 places):
$\begin{array}{cccccccccc}1.515& 0.187& 6.270& 3.291& 3.597& 10.680& 1.572& 22.555& 4.924& 0.063\\ 0.214& 0.465& 19.042& 2.467& 4.663& 2.101& 7.597& 10.053& 0.017& 5.627\\ 12.124& 7.579& 0.735& 11.290& 4.153\end{array}$
The sample mean is $\overline{X}=5.711.$. The cut-off points for a 95% CI from R are
qgamma(c(.025,.975), 25, 25)
## 0.6471473 1.4284039
so that the 95% CI is
qgamma(c(.025,.975), 25, 25)/mean(x)
## 0.1133112 0.2501040
Step 2
The (slightly biased) maximum likelihood estimator of of $\lambda$ in this example is $\stackrel{^}{\lambda }=1/\overline{X}=0.175,$, which is contained in the CI, but not exactly at the center of it, owing to the skewness of the distributions involved.