I am looking for the functional form to describe the following:

A random shock $x\sim Uniform(a,b)$ is multiplied with a second shock $y\sim Uniform(c,d)$.

What is the mean value of all combined shocks $z=xy$ below a certain threshold $v$?

Or to put it differently: $\mathbb{E}(z\vert z<v$).

For concreteness let's assume the following values:

$x\sim Uniform(0.5,1.5)$, $y\sim Uniform(0.4,1.6)$, and $v=0.7$.

To give you some background why I am asking this, I am trying to model the following:

In a two period game, each period a shock arrives and each period there is a cut off point determining who continues the game and who leaves (truncation). Those continuing receive the future shock (multiplication of distributions) and at the end we decide again how many are above and below the threshold. Now we want to know the average value of those who remain in the end (below threshold $v$).

This question is closely related to:

CDF of Z=XY with X~Uniform(0.5,1.5) and Y~Uniform(0.8,1.5)

but for the truncation and the mean part.

Any hints are welcome.

  • 1
    $\begingroup$ A truncated uniform distribution is uniform. It's unclear what the "value weighting" means, because the formula you gave does not necessarily produce a CDF (and usually does not), thereby making nonsense of your title. Thus, the intelligible part of your question is already answered in the closely related thread and the other part really needs clarification to be answerable. Do you think you could edit this post to address these issues? $\endgroup$ – whuber Apr 11 '18 at 19:00
  • $\begingroup$ I agree wrt to misnaming it a cdf. There are 2 steps here. First, we have a certain percentage $\leq100\%$ who make it to the second period and receive the second shock. Therefore, the distribution of $z$ does not sum to 1 (because some drop out in the first period). Technically at this point we are not talking about a cdf anymore. If I understood it correctly, in this case we can take the cdf of z assuming that z describes the whole population and scale it with the percentage making it to the second round. The "value weighted" issue is more complicated and described in the second comment. $\endgroup$ – TKres Apr 11 '18 at 21:42
  • $\begingroup$ By "value weighted" I mean the share times the average value of $z$ below the threshold $v$. $\endgroup$ – TKres Apr 11 '18 at 21:44
  • $\begingroup$ @TKres what do you mean by "a share"? $\endgroup$ – Alexis Apr 11 '18 at 21:58
  • $\begingroup$ A percentage of the population. The equivalent of the cdf evaluated at a certain value $\endgroup$ – TKres Apr 11 '18 at 22:00

The details are tedious (some are shown), but at least we can look at the concrete example. Let $a=0.5$, $b=1.5$, $c=0.4$, $d=1.6$, and $k=(b-a)(d-c).$

Following the development shown in CDF of Z=XY with X~Uniform(0.5,1.5) and Y~Uniform(0.8,1.5) that the OP mentioned, we can find the CDF:

$$ F_Z(z)= \begin{cases} \left( \frac{1}{k} \right) \left[ac-z+z \left( \mathrm{ln} \ z - \mathrm{ln} \ a - \mathrm{ln} \ c \right) \right] \ , & 0.2 \le z \le 0.6 \\ \left( \frac{1}{k} \right) \left[ac-bc-z \ \mathrm{ln} \ a + z \ \mathrm{ln} \ b \right] \ , & 0.6 \le z \le 0.8 \\ \left( \frac{1}{k} \right) \left[ac-bc-ad+z -z \ \mathrm{ln} \ z + z \ \mathrm{ln} \ b + z \ \mathrm{ln} \ d \right] \ , & 0.8 \le z \le 2.4 \end{cases}$$

If we evaluate this at $z=0.7$ we find

$$q=P[Z \le 0.7]=\frac{c(a-b)+0.7(\mathrm{ln} \ b-\mathrm{ln} \ a)}{k} \approx 0.3075$$

By differentiating the cdf, we get the pdf of $z$ as

$$ f_Z(z)=\begin{cases} \left( \frac{1}{k} \right) \left[ \mathrm{ln} \ z - \mathrm{ln} \ a - \mathrm{ln} \ c \right] \ , & 0.2 \le z \le 0.6 \\ \left( \frac{1}{k} \right) \left[ \mathrm{ln} \ b - \mathrm{ln} \ a \right] \ , & 0.6 \le z \le 0.8 \\ \left( \frac{1}{k} \right) \left[ - \mathrm{ln} \ z + \mathrm{ln} \ b + \mathrm{ln} \ d \right] \ , & 0.8 \le z \le 2.4 \end{cases}$$

Now since we are interested in $Z \le 0.7,$ the conditional pdf will be

$$ f_{Z|Z \ \le \ 0.7}(z)=\begin{cases} \left( \frac{1}{kq} \right) \left[ \mathrm{ln} \ z - \mathrm{ln} \ a - \mathrm{ln} \ c \right] \ , & 0.2 \le z \le 0.6 \\ \left( \frac{1}{kq} \right) \left[ \mathrm{ln} \ b - \mathrm{ln} \ a \right] \ , & 0.6 \le z \le 0.7 \end{cases}$$

Now applying the definition of expected value, we have $$E[Z|Z \le 0.7] = \int z \ f_{Z|Z \ \le \ 0.7}(z) \ dz$$

Solving and evaluating the integrals leads to

$$E[Z|Z \le 0.7] = \frac{1}{100kq} \left[ 9 \ \mathrm{ln} (0.36)-\mathrm{ln} \ (0.04)-8-\frac{45 \ \mathrm{ln} \ a}{2} - 16 \ \mathrm{ln} \ c +\frac{13 \ \mathrm{ln} \ b}{2} \right] $$


$$ E[Z|Z \le 0.7] \approx 0.5126$$

This is easily verified by simulation.

  • $\begingroup$ What I struggle to understand is the last step. Can you help me understand what is behind the numbers (9, ln(.36),...,13)? For concreteness sake let us assume that z is smaller than $ad, ab$ and $bd$ and larger than $ab$. So $z$ is something like 0.5. I am working in parallel on the problem right now but I am far behind you. I try to approach it from the geometric perspective: intmath.com/applications-integration/5-centroid-area.php Here is some code in R to simulate: all = (runif(1e4,.4,1.6)*runif(1e4,.5,1.5)) mean(all[all<.7]) $\endgroup$ – TKres Apr 23 '18 at 18:09
  • $\begingroup$ I've added in the pdf and cdf of $Z$ and the conditional pdf. $\endgroup$ – soakley Apr 24 '18 at 16:26
  • $\begingroup$ I've corrected the upper limit of the conditional pdf and put in another step so you can see more details. The numbers in the final answer are just the output when evaluating the integrals. Variations are possible (for example, $\mathrm{ln} (0.36)=2 \mathrm{ln}(0.6)$). $\endgroup$ – soakley Apr 24 '18 at 22:04

I will expand on soakley's answer to develop the formulas describing the conditional mean of the product of two uniform distributions.

The conditional mean is the integral of $z$ times the PDF from the lower boundary up to $z$ depending on the case and divided by the CDF at that point: $$ \mathbb{E}[Z|Z \le z]=\frac{\int^z z f_{Z}(z)dz}{F_Z(z)} $$.

This will yield the formulas I was looking for in this question: $$ \mathbb{E}[Z|Z \le z]= \begin{cases} \frac{- \frac{a^{2} c^{2}}{4} + \frac{z^{2}}{2} \log{\left (a \right )} - \frac{z^{2}}{2} \log{\left (\frac{z}{c} \right )} + \frac{z^{2}}{4}}{- a c + z \log{\left (a \right )} - z \log{\left (\frac{z}{c} \right )} + z} &, ac \le z \le bc \\ \frac{- \frac{a^{2} c^{2}}{4} + \frac{b^{2} c^{2}}{4} + \frac{z^{2}}{2} \log{\left (a \right )} - \frac{z^{2}}{2} \log{\left (b \right )}}{- a c + b c + z \log{\left (a \right )} - z \log{\left (b \right )}} &, bc \le z \le ad\\ \frac{\frac{a^{2} c^{2}}{4} - \frac{a^{2} d^{2}}{4} - \frac{b^{2} c^{2}}{4} + \frac{z^{2}}{2} \log{\left (b \right )} - \frac{z^{2}}{2} \log{\left (\frac{z}{d} \right )} + \frac{z^{2}}{4}}{a c - a d - b c + z \log{\left (b \right )} - z \log{\left (\frac{z}{d} \right )} + z} &, ad \le z \le bd \end{cases} $$

What helped me solve this was the sympy symbolic library. Find attached some code in python highlighting the steps:

from sympy import * 
from sympy.stats import *
x,y,z,u,v,a,b,c,d = symbols('x y z u v a b c d')
k = (b-a)*(d-c)
F_uv = integrate(z/x-v,(x,u,z/v))

Derivation of first case:

F_Z = (F_uv.subs([(u,a),(v,c)]))/k

f_Z = diff(F_Z,z)

cond_F_Z = integrate(z*f_Z,(z,a*c,z))/F_Z

N(cond_F_Z.subs([(a, .5), (b, 1.5), (c, .4), (d, 1.6), (z,.55 )]))

Derivation of second case:

F_Z2 = (F_uv.subs([(u,a),(v,c)])-F_uv.subs([(u,b),(v,c)]))/k

f_Z2 = diff(F_Z2,z)

cond_F_Z2 = (integrate(z*f_Z,(z,a*c,b*c))+integrate(z*f_Z2,(z,b*c,z)))/F_Z2

N(cond_F_Z2.subs([(a, .5), (b, 1.5), (c, .4), (d, 1.6), (z,.7 )]))

Derivation of third case:

F_Z3 = (F_uv.subs([(u,a),(v,c)])-F_uv.subs([(u,a),(v,d)])-F_uv.subs([(u,b),(v,c)]))/k

f_Z3 = diff(F_Z3,z)

cond_F_Z3 = (integrate(z*f_Z,(z,a*c,b*c))+integrate(z*f_Z2,(z,b*c,a*d))+integrate(z*f_Z3,(z,a*d,z)))/F_Z3

N(cond_F_Z3.subs([(a, .5), (b, 1.5), (c, .4), (d, 1.6), (z,1)]))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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