Upper confidence bound for Poisson process rate parameter Admittedly, this is an elementary question for mathoverflow. However, I've had no real bites on math and stats.stackexchange so I'm cross-posting.
I am interested in computing an upper confidence bound for the rate parameter, $\lambda$, in a Poisson process. Specifically, I have a set of observations $$
X_\text{obs} = \{(n_1,t_1), \ldots, (n_N,t_N)\}
$$ where $n_k$ is the number of successes in the $k$'th trial which ran for a duration of length $t_k$.For a given a confidence level $1 - \alpha$, I assume that what I want to do is solve for $$
\lambda_{\text{upper}} = \max \{ \lambda : P(X_\text{obs} ; \lambda) \ge \alpha \}.
$$
However, this doc http://faculty.washington.edu/fscholz/Reports/poissonconfbd6.pdf suggests that I want to find something like $$
\lambda_{\text{upper}} = \max \{ \lambda : P(x \le X_\text{obs} ; \lambda) \ge \alpha \}
$$
for all datasets "$x$" whose sufficient statistic is less than or equal to the sufficient statistic of the observed data.
Specifically, equation (1) in the doc sums over possible outcomes, $i = 0 \ldots k$, less than or equal to the observed number of successes, $k$. And it doesn't just compute the largest $\lambda$ for which the likelihood of the observed data is at least $\alpha$. 
What is the correct way to define the upper confidence bound so that I can solve for it (either in closed form, or by numerical methods)?
Btw, I am aware that $\lambda$ is the mean number of counts per period, and so one could use deviation bounds based on the CLT to derive a UCB. However, I will be dealing with sparse counts (including zeros), so I am not sure that using deviation bounds will give me good performance. And regardless, I would like to see how to derive the UCB using the definition and/or first principles.
 A: $\newcommand{\la}{\lambda}
\newcommand{\al}{\alpha}$
Let $k:=N$. Let $N_1,\dots,N_k$ be the numbers of successes during non-overlapping time intervals of lengths $t_1,\dots,t_k$, so that $N_1,\dots,N_k$ are independent random variables (r.v.'s) such that $N_j\sim \text{Poisson}(\la t_j)$ for $j=1,\dots,k$. The joint probability mass function (pmf) of the r.v.'s $N_1,\dots,N_k$ is given by 
\begin{equation*}
 p_\la(n_1,\dots,n_k):=P_\al(N_1=n_1,\dots,N_k=n_k)
 =\prod_{j=1}^k\frac{(\la t_j)^{n_j}e^{-\la t_j}}{n_j!}
\end{equation*}
for nonnegative integers $n_1,\dots,n_k$. By the Neyman--Pearson lemma, a most powerful (MP) test of a given level for a null hypothesis $H_0\colon\la\le\la_0$ versus $H_1\colon\la>\la_0$ is of the form $\sum_j N_j>c$, where $c$ is a critical value. Also, $\sum_j N_j\sim \text{Poisson}(\la t)$, where $t:=\sum_j t_j$. 
Inverting this MP test, we get the upper confidence bound $\la_*=\la_*(n)$ on the unknown parameter $\la$, where $\la_*$ is the root $\la$ of the equation 
\begin{equation*}
 F_{\la t}(n)=\al,\tag{1}
\end{equation*} 
and where in turn $n:=\sum_j n_j$, $1-\al$ is the desired confidence level, and $F_\mu$ is the cumulative distribution function (cdf) of $\text{Poisson}(\mu)$. (Note that $F_\mu(n)$ is continuously decreasing in $\mu$.)
If the estimated value $n/t$ of $\la$ is large, then one can use the normal approximation $N(\la t,\la t)$ to $\text{Poisson}(\la t)$ to approximate $\la_*$ by the root $\la$ of the simpler equation 
$$\Phi\Big(\frac{n-\la t}{\sqrt{\la t}}\Big)=\al,$$ 
where $\Phi$ is the standard normal cdf.
All this is illustrated in the following image of a Mathematica notebook, which computes a 95\% upper confidence bound on $\la$ (and its normal approximation) for $k=3$, $(t_1,t_2,t_3)=(3,2,5)$, and $(n_1,n_2,n_3)=(70, 55, 91)$: 

Added: The rationale for equation (1) is as follows, in accordance with the general philosophy for confidence sets. Since $F_{\la t}(n)$ is continuously decreasing in $\la$, we have $\la\le\la_*(n)\iff F_{\la t}(n)\ge\al$. Substituting here $N:=\sum_j N_j$ for $n=\sum_j n_j$, we have 
\begin{equation*}
 P_\la(\la\le\la_*(N))=P_\la(F_{\la t}(N)\ge\al)\ge1-\al,\tag{2}
\end{equation*}
so that the random interval $(-\infty,\la_*(N)]$ covers the unknown value of the parameter $\la$ with $P_\la$-probability $\ge1-\al$; that is, $(-\infty,\la_*(N)]$ is a $(1-\al)$-confidence interval for $\la$; that is, $\la_*(N)$ is a (random) upper bound on $\la$ with confidence $1-\al$. 
The inequality in (2) is a particular case of 

Lemma. For any r.v. $X$, let $F$ be its cdf. Then for all $u\in(0,1)$
\begin{equation*}
 P(F(X)\ge u)\ge1-u. 
\end{equation*}

Proof of the lemma. For $u\in(0,1)$, let 
\begin{equation*}
 F^{-1}(u):=\inf\{x\in\mathbb R\colon F(x)\ge u\}=\min\{x\in\mathbb R\colon F(x)\ge u\};
\end{equation*}
the latter equality holds by the right continuity of $F$. So, $F(x)\ge u\iff x\ge F^{-1}(u)=:x_u$ for all real $x$, whence 
\begin{equation*}
 P(F(X)\ge u)=P(X\ge x_u)=1-F(x_u-)\ge1-u, 
\end{equation*}
as claimed; the latter inequality follows because $F(x)<u$ for all $x<x_u$. $\Box$
