2
$\begingroup$

My course notes (3rd-year module in Bayesian Statistics, unpublished) contain the following section.

Assume we have data on the number of people queuing at an ATM at a specific hour for several randomly chosen days, and that we are interested in the mean time between two consecutive arrivals to the queue at some arbitrary point within this time.

First, let $\textbf{x} = \{x_1,\dots,x_n\}$ represent the observed data and assume these are a random sample from $\text{Po}(x_i\;|\;\lambda)$. We will use the conjugate prior $\text{Ga}(\lambda\;|\;a,b)$ to represent our prior knowledge, thus $$\pi(\lambda\;|\;\textbf{x})\propto\left[\lambda^se^{-n\lambda}\right]\times\left[\lambda^{a-1}e^{-b\lambda}\right]=\text{Ga}(\lambda\;|\;a^\ast,b^\ast),$$ where $a^\ast=a+s$ and $b^\ast=b+n$, with $s=\sum_{i=1}^nx_i$ a sufficient statistic for $x_i$.

Using standard queuing theory, the time within two consecutive arrivals, $y$, is distributed $\text{Ex}(y\;|\;\lambda)$. Thus, the predictive distribution is $$f(y\;|\;\textbf{x})=\int_0^\infty\lambda e^{-y\lambda}\frac{(b^\ast)^{a^\ast}}{\Gamma(a^\ast)}\lambda^{a^\ast-1}e^{-\lambda b^\ast}\;\text{d}\lambda=\frac{a^\ast}{b^\ast}\left(1+\frac{y}{b^\ast}\right)^{-(a^\ast+1)}.$$ Finally, the expected predictive time between consecutive arrivals is $$\mathbb{E}[y\;|\;\textbf{x}]=\int_0^\infty y\frac{a^\ast}{b^\ast}\left(1+\frac{y}{b^\ast}\right)^{-(a^\ast+1)}\;\text{d}y=\frac{b^\ast}{a^\ast-1}.$$

But, by my reasoning, \begin{align} & \begin{aligned} f(y\;|\;\textbf{x}) & = \frac{a^\ast}{b^\ast}\left(1+\frac{y}{b^\ast}\right)^{-(a^\ast+1)} \\ & = \frac{a^\ast b^{\ast a^\ast}}{(y+b^\ast)^{a^\ast+1}} \\ & = \text{Pa}(y+b^\ast\;|\;a^\ast,b^\ast) \end{aligned} \\[1em] \therefore \hspace{1em} & \begin{aligned}[t] \mathbb{E}[y\;|\;\textbf{x}] & = \mathbb{E}[y+b^\ast\;|\;y\sim\text{Pa}(a^\ast,b^\ast)] \\ & = \mathbb{E}[y\;|\;y\sim\text{Pa}(a^\ast,b^\ast)] + b^\ast \\ & = \frac{a^\ast b^\ast}{a^\ast-1} + b^\ast \\ & = \frac{(2a^\ast-1)b^\ast}{a^\ast-1} \\ & \neq \frac{b^\ast}{a^\ast-1} \text{ (unless $a^\ast=1$)}. \end{aligned} \end{align}

What's gone wrong?

$\endgroup$
6
  • 1
    $\begingroup$ You haven't integrated correctly. Use $$\int_0^\infty x(1+x)^{-(1+a)}\,\mathrm dx=\int_0^\infty \frac{1}{(1+x)^a}-\frac{1}{(1+x)^{a+1}}\,\mathrm dx=\frac{1}{a-1}-\frac{1}{a}=\frac{1}{a(a-1)}.$$ $\endgroup$
    – whuber
    Dec 12, 2022 at 19:58
  • $\begingroup$ @whuber Thanks, that's useful, but I didn't integrate; I used the linearity of the expectation operator with a formula for the expectation of a Pareto distribution that I got from a formula sheet. Could you point out the problem with that line of reasoning? $\endgroup$
    – mjc
    Dec 13, 2022 at 19:15
  • $\begingroup$ Compare your work with the correct result until you see a discrepancy: that will locate at least one error. $\endgroup$
    – whuber
    Dec 13, 2022 at 20:18
  • $\begingroup$ I'm afraid I can't even make sense of it, because your notation "Pa" is undefined. Although one would guess it is referring to a Pareto distribution, I am unable to see how that is directly related to an integral whose lower limit is $1.$ The details matter, especially the meanings of your parameters $a^*$ and $b^*.$ I therefore encourage you to write your steps in detail. $\endgroup$
    – whuber
    Dec 13, 2022 at 20:45
  • $\begingroup$ @whuber Yes, I intend Pa to mean a Pareto distribution. I took it from my formula sheet and assumed it was standard notation. From the wikipedia article on the Gamma distribution I assume $a$ and $b$ are shape and rate, and the course notes use $^\ast$ for posterior parameters, which here turn out to fit a Pa. My formula sheet gives $b^\ast$ (that is, the parameter in the second position, which it actually calls $\beta$) as the lower limit of the Pareto distribution's support. What integral with a lower limit of 1 do you mean? and are there other details needed? $\endgroup$
    – mjc
    Dec 13, 2022 at 23:21

1 Answer 1

2
$\begingroup$

Your basic insight of recognising the Pareto distribution is a good way to look at this, but you are just making a small error in your reasoning about the density, which is messing things up. Since $f(y|\mathbf{x}) = \text{Pa}(y+b^* | a^*,b^*)$ you therefore have:$^\dagger$

$$y|\mathbf{x} \sim \text{Pa}(a^*,b^*) - b^*.$$

(Note that we subtract $b^*$ from the Pareto variable; we don't add it.) Consequently, you should be using a minus sign for the expectation computation, which gives:

$$\begin{align} \mathbb{E}[y|\textbf{x}] &= \mathbb{E}[r - b^* | r \sim \text{Pa}(a^*,b^*)] \\[12pt] &= \mathbb{E}[r | r \sim \text{Pa}(a^*,b^*)] - b^* \\[6pt] &= \frac{a^* b^*}{a^*-1} - b^* \\[6pt] &= \frac{a^* b^*}{a^*-1} - \frac{a^* b^* - b^*}{a^*-1} \\[6pt] &= \frac{b^*}{a^*-1}. \\[6pt] \end{align}$$


$^\dagger$ This is a general rule of probability that applies when we shift the location of a random variable by a constant. In general, if we start with a random varable $A$ with density $f_A$ then the random variable $R \equiv A+k$ has distribution function:

$$F_R(r) = \mathbb{P}(R \leqslant r) = \mathbb{P}(A+k \leqslant r) = \mathbb{P}(A \leqslant r-k) = F_A(r-k),$$

which then gives it the density function:

$$f_R(r) = \frac{d}{dr} F_R(r) = \frac{d}{dr} F_A(r-k) = f_A(r-k).$$

As you can see, using the location shift $+k$ on the random variable translates to imposing the shift $-k$ inside the density argument. This is because the point $R=r$ corresponds to $A=r-k$.

$\endgroup$
12
  • $\begingroup$ I think this is the answer I was looking for, but I don't quite follow the subtraction reasoning. I would have thought that $$y|\textbf{x}\sim\text{Pa}(a^\ast,b^\ast)-b^\ast\implies f(y|\textbf{x})=\frac{a^\ast b^{\ast a^\ast}}{y^{a^\ast+1}}-b^\ast\neq\frac{a^\ast b^{\ast a^\ast}}{(y+b^\ast)^{a^\ast+1}}=\text{Pa}(y+b^\ast|a^\ast,b^\ast).$$ $\endgroup$
    – mjc
    Dec 14, 2022 at 1:43
  • 1
    $\begingroup$ I have added some further detail on the location shift to show you why it works the way I say. $\endgroup$
    – Ben
    Dec 14, 2022 at 2:50
  • $\begingroup$ I feel like I'm missing something here. Isn't the $-b^\ast$ in $y|\textbf{x}\sim\text{Pa}(a^\ast,b^\ast)-b^\ast$ a vertical shift, but the $-k$ in $f_R(r)=f_A(r-k)$ a horizontal shift? And a couple of other things I've wondered while I've stared at this, if you have the patience: should $y|\textbf{x}\sim$ be $Y|\textbf{x}\sim$? and does $f(y|\textbf{x})=\text{Pa}(y+b^\ast|a^\ast,b^\ast)$ imply that this $f$ is $f_{Y+b^\ast}$? $\endgroup$
    – mjc
    Dec 14, 2022 at 20:49
  • $\begingroup$ For purposes of this answer, I'm following the notation in your question (taken from your course notes), which does not use the upper-case convention for random variables (so $y$ is either random or fixed depending on context). But yes, if you were going to use the upper-case notation convention then some of my notation in this answer would change. I'm also using your own notation in the question where you use $f$ to denote the conditional density for $y$ given $\mathbf{x}$ (so $f$ is $f_Y$, not $f_{Y+b^*}$). $\endgroup$
    – Ben
    Dec 14, 2022 at 22:29
  • $\begingroup$ And how about the vertical/horizontal issue? $\endgroup$
    – mjc
    Dec 14, 2022 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.