online advertising

Sunday, February 14, 2016

Duck Pond Chance (4)

Last post we computed the CDFs for b condition on A, let's compute the PDFs now.

To efficiently compute the derivatives, it is much easier if we have good notations instead of messing with all the cases, so Heaviside step function.

$ P(b \le t|a) = \theta(t - 2a)\frac{t - a}{\pi} $. for $ a \le \frac{\pi}{3} $

By the product rule, we can differentiate and get this, where $ \delta $ is the Dirac delta function.

$ p(b|a) = \delta(t - 2a)\frac{t - a}{\pi} + \theta(t - 2a)\frac{1}{\pi} $.

$ p(a) = \frac{2}{\pi} $, so we integrate to get $ p(b) = \int\limits_{0}^{\frac{\pi}{2}}{p(a)p(b|a)da} $.

Since the function change at $ t - 2a $, let $ y = t - 2a $

$ \frac{dy}{-2} = da $
When $ a = 0 $, $ y = t $.
When $ a = \frac{\pi}{2} $, $ y = t -2\pi $.

$ \begin{eqnarray*} & & p(b) \\ &=& \int\limits_{0}^{\frac{\pi}{2}}{p(a)p(b|a)da} \\ &=& \int\limits_{0}^{\frac{\pi}{2}}{\frac{2}{\pi} (\delta(t - 2a)\frac{t - a}{\pi} + \theta(t - 2a)\frac{1}{\pi}) da} \\ &=& \int\limits_{t}^{t - \pi}{\frac{2}{\pi} (\delta(y)\frac{t + y}{2\pi} + \theta(y)\frac{1}{\pi}) \frac{dy}{-2}} \\ &=& \int\limits_{t - \pi}^{t}{\frac{1}{\pi} (\delta(y)\frac{t + y}{2\pi} + \theta(y)\frac{1}{\pi}) dy} \\ \end{eqnarray*} $

The first term is easy, using the sampling property of the delta function, the integral is simply $ \frac{t}{2\pi^2} $ if $ t \in [0, \pi] $, or 0 otherwise.
The second term is slightly more complicated, it is 0 if $ t < 0 $, $ \frac{t}{\pi^2} $ if $ t \in [0, \pi] $ and $ \frac{1}{\pi} $ if $ t > \pi $.
Although the integration seems to show $ p(b) = \frac{1}{\pi} $ for all $ t > \pi $, but in fact the maximum value of $ t $ is simply $ \frac{4\pi}{3} $, as we already know it caps there. As a sanity check, the area under curve is 1, and the area under curve for $ t \in [0, \pi] = \frac{3}{4} $, which is correct.

EDIT: There are at least two problems I spotted. First, the CDF should also include a term to cancel out the linear growth when it reaches $ a + \pi $. Second, the CDF only applies up to $ a \le \frac{\pi}{3} $.

No comments:

Post a Comment