Slow exponential plus an exponential sample mean (source code)

= Slow exponential plus an exponential sample mean
{title2=$I(x)=\inf_{0<z\leq x}\{\lambda(x-z)+K_r(z)\}$}

Let $S$ be a fixed sum of <independent> <exponential random variables> with smallest rate $\lambda>0$, and let $Z_N$ be the sum of $N-k$ independent rate-$r$ <exponential random variables>, independent of $S$, with fixed $k$ and $r>\lambda$. At <large-deviation speed> $N$, $S/N$ has <rate function> $\lambda y$ for $y\geq0$; the sample mean has <rate function> $K_r(z)=rz-1-\log(rz)$ for $z>0$. The <product large-deviation principle> and <contraction principle for large deviations> give
$$
I(x)=\inf_{0<z\leq x}\{\lambda(x-z)+rz-1-\log(rz)\}
=\begin{cases}
rx-1-\log(rx),&0<x\leq(r-\lambda)^{-1},\\
\lambda x+\log((r-\lambda)/r),&x\geq(r-\lambda)^{-1},\\
\infty,&x\leq0.
\end{cases}
$$
Indeed the derivative of the quantity minimized with respect to $z$ is $r-\lambda-1/z$. Its minimizer is $\min(x,(r-\lambda)^{-1})$. Beyond that transition, a single slow <exponential random variable> carries the extra excursion; the <rate function> becomes affine.