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?

spremani0r

spremani0r

Answered question

2022-09-11

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

Answer & Explanation

Isaiah Haynes

Isaiah Haynes

Beginner2022-09-12Added 16 answers

Step 1
Either I misunderstand the problem, or you are making it more difficult than necessary.
Let L and U cut probability α / 2 from the lower and upper tails of G a m m a ( s h a p e = n , r a t e = n ) ,, Then a 1 α confidence interval for λ is found as follows:
P ( L < λ X ¯ < U ) = P ( L / X ¯ < λ < U / X ¯ ) = 1 α ,,
so the desired CI is ( L / X ¯ , U / X ¯ ).
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 , , X 25 is a random sample from E x p ( r a t e = .2 ) ,, we might have the following sample (rounded to 3 places):
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
The sample mean is 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 λ in this example is λ ^ = 1 / 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.

Do you have a similar question?

Recalculate according to your conditions!

New Questions in College Statistics

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?