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*}
Answer
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*}
No comments:
Post a Comment