The $\chi^{2}$ goodness of fit test to determine if the time between arrivals follows an exponential distribution The time between arrivals at a ticket counter was recorded for 200 customers in an interval of seven minutes:
\begin{array}{cccccccc}
\hline Time (min ) & 0-1 & 1-2 & 2-3 & 3-4 & 4-5 & 5-6 & 6-7 \\
\hline Frequency & 60 & 30 & 40 & 30 & 20 & 10 & 10 \\
\hline
\end{array}
Use $\chi^{2}$ goodness of fit test to determine if the time between arrivals follows an exponential distribution. Use $0.05$ significance level.
Can I proceed by performing the $\chi^{2}$ test with intervals of equal probability so that we have  $k = 7$ intervals and thus the probability of an observation falling into any one of them will be $p \approx 0.143$ ?
 A: There are a few ways to do this.  One way is to compute the chi-square test statistic as a function of some exponential rate parameter $\lambda$; then compute the maximum $p$-value that is attained for all $\lambda > 0$.  Another way is to compute the maximum likelihood estimator $\hat \lambda$ that fits the observed data, then perform the chi-square test for this choice.
The first approach has the advantage of demonstrating whether the null hypothesis can be justifiably rejected for any possible exponential model.  However, the second approach is computationally easier.
To illustrate, we observe for an exponential distribution with rate $\lambda$, $$\Pr[k < X \le k + 1] = (1 - e^{-(k + 1)\lambda}) - (1 - e^{-k \lambda}) = e^{-k \lambda}(1 - e^{-\lambda}).$$  Thus the expected frequencies for the sample are
$$\begin{array}{c|c|c}
k & \text{Observed} = O_k & \text{Expected} = E_k \\
\hline
0 & 60 & 200 (1 - e^{-\lambda}) \\
1 & 30 & 200 e^{-\lambda} (1 - e^{-\lambda}) \\
2 & 40 & 200 e^{-2\lambda} (1 - e^{-\lambda}) \\
3 & 30 & 200 e^{-3\lambda} (1 - e^{-\lambda}) \\
4 & 20 & 200 e^{-4\lambda} (1 - e^{-\lambda}) \\
5 & 10 & 200 e^{-5\lambda} (1 - e^{-\lambda}) \\
6 & 10 & 200 e^{-6\lambda} (1 - e^{-\lambda})
\end{array}$$
Then the chi-square statistic is computed as $$T(\lambda) = \sum_{k=0}^7 \frac{(O_k - E_k)^2}{E_k}.$$  Under the null hypothesis that the data follow an exponential distribution, $T(\lambda) \mid H_0 \sim \chi^2_6$.  So we calculate $$p(\lambda) = \Pr[\chi^2_6 > T(\lambda)],$$ which we plot for $0 < \lambda < 0.5$ below:

The maximum is $p \approx 0.04152$ attained at $\lambda \approx 0.31292$, which means that we reject $H_0$ at the $\alpha = 0.05$ level.  However, numerical methods are needed to solve for this maximum.
The second approach, using maximum likelihood estimation, first determines the exponential parameter $\hat\lambda$ that "best" fits the data; then we do the chi-square test for this choice.  I leave it as an exercise to show that $\hat \lambda = \log \frac{59}{39},$ hence $T(\hat \lambda) \approx 22.3997$.  But since we already rejected $H_0$ using the first method, obviously this choice will also result in rejecting $H_0$.
