正如 John D. Cook 暗示的那样,iid 指数随机变量的总和具有伽马分布。
这是具有速率参数 a 的 n 个指数随机变量之和的 cdf(用 Mathematica 表示):
F[x_] := 1 - GammaRegularized[n, a*x];
http://mathworld.wolfram.com/RegularizedGammaFunction.html
逆 cdf 为:
Fi[p_] := InverseGammaRegularized[n, 1 - p]/a;
则 c 置信区间为
ci[c_, a_, n_] := {Fi[a, n, (1-c)/2], Fi[a, n, c+(1-c)/2]}
以下是一些代码,用于凭经验验证上述内容是否正确:
(* Random draw from an exponential distribution given rate param. *)
getGap[a_] := -1/a*Log[RandomReal[]]
betw[x_, {a_, b_}] := Boole[a <= x <= b]
c = .95;
a = 1/.75;
n = 40;
ci0 = ci[c, a, n];
N@Mean@Table[betw[Sum[getGap[a], {n}], ci0], {100000}]
----> 0.94995