0
$\begingroup$

Imagine we have a semaphore that alternates every 40 seconds between green and red.

Waiting time is 0 when the semaphore is green, and when it is red it is the remaining time until it turns green.

I want to model the distribution of waiting times on this semaphore.

Starting with the CDF I have:

$$ F(x) = \begin{cases} 0 && \text{if } x < 0\\ 0.5 && \text{if } x = 0 && \textit{half the time we don't need to wait}\\ 0.5 + \frac{0.5}{40} x && \text{if } x > 0 \text{ and } x<=40 && \textit{all waiting times ]0-40] are equally likely}\\ 1 && \text{if } x > 40 \end{cases} $$

Is the PDF of this distribution given by the following function?

$$ PDF(x) = \begin{cases} 0 && \text{if } x < 0\\ 0.5 && \text{if } x = 0\\ \frac{0.5}{40} && \text{if } x > 0 \text{ and } x<=40\\ 0 && \text{if } x > 40 \end{cases} $$

And is the expected time waiting on this semaphore given by:

\begin{align*} \int_0^{40} x f(x) dx = \int_0^{40} x . \frac{0.5}{40} dx = 10 \end{align*}

$\endgroup$
3
  • 1
    $\begingroup$ This distribution does not have a density at $x=0$, but instead a point probability $\mathbb{P}(X=0)=0.5$. Though this does not affect the expectation when you add $0\times 0.5$, it would have had an impact if the point probability was somewhere else. $\endgroup$
    – Henry
    Commented Feb 23, 2016 at 18:44
  • $\begingroup$ What if it was at some other point, let's say $x=100$? How would I calculate the expected value in that case? Would I do 10 +0.5*100 = 60? $\endgroup$
    – JC1
    Commented Feb 23, 2016 at 21:19
  • $\begingroup$ Yes: for point probabilities you just do the usual $\sum_i x_i \mathbb{P}(X=x_i)$ as you would for a discrete distribution. The integral is the absolutely continuous version of this sum, so when you have a mixture of the two you do both. You could check the total probability is $1$ with $\sum_i \mathbb{P}(X=x_i) + \int f(x)\, dx$ so that you do not miss something. $\endgroup$
    – Henry
    Commented Feb 23, 2016 at 22:06

1 Answer 1

0
$\begingroup$

Posting Henry's answer here for future reference.

This distribution's density is not defined at $x=0$, but instead we have a point probability $P(X=0) = 0.5$.

The expected value is calculated with a mix of discrete and continuous calculation:

\begin{align*} E[\text{waiting time}] &= \int_0^{40} x f(x) dx + 0 * P(X=0)\\ &= \frac{0.5}{40} . \frac{x^2}{2} \bigg|_0^{40} + 0 \\ &= \frac{0.5}{40}.\frac{40^2}{2}\\ &= 10 \end{align*}

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .