Processing math: 100%

17 votos

¿Cuál es la distribución de (ad)2+4bc donde a,b,c,d son distribuciones uniformes?

Tengo cuatro independientes distribuidos de manera uniforme variables a,b,c,d, cada uno en [0,1]. Quiero calcular la distribución de (ad)2+4bc. He calculado la distribución de u2=4bc f2(u2)=14lnu24 (hence u2\en(0,4]), and of u1=(ad)2 to be f1(u1)=1u1u1. Now, the distribution of a sum u1+u2 is (u1,u2 are also independent) fu1+u2(x)=+f1(xy)f2(y)dy=14401xyxylny4dy, because y(0,4]. Here, it has to be x>y so the integral is equal to fu1+u2(x)=14x01xyxylny4dy. Now I insert it to Mathematica and get that fu1+u2(x)=14[x+xlnx42x(2+lnx)].

I made four independent sets a,b,c,d consisting of 106 numbers each and drew a histogram of (ad)2+4bc:

enter image description here

and drew a plot of fu1+u2(x):

enter image description here

Generally, the plot is similar to the histogram, but on the interval (0,5) most of it is negative (the root is at 2.27034). And the integral of the positive part is \aprox0.77.

Where's the mistake? Or where am I missing something?

EDIT: I scaled the histogram to show the PDF.

enter image description here

EDIT 2: I think I know where's the problem in my reasoning - in the integration limits. Because s\en(0,4] and xy(0,1], I cannot simply x0. The plot shows the region I have to integrate in:

enter image description here

This means I have x0 for y(0,1] (that's why part of my f was correct), xx1 in y(1,4], and 4x1 in y\en(4,5]. Por desgracia, Mathematica no computar las dos últimas integrales (bueno, calcular el segundo, hay una unidad imaginaria en la salida que estropea todo...).

EDIT 3: parece que Mathematica PUEDE calcular los últimos tres integrales con el siguiente código:

(1/4)*Integrate[((1-Sqrt[u1-u2])*Log[4/u2])/Sqrt[u1-u2],{u2,0,u1}, Assumptions ->0 <= u2 <= u1 && u1 > 0]

(1/4)*Integrate[((1-Sqrt[u1-u2])*Log[4/u2])/Sqrt[u1-u2],{u2,u1-1,u1}, Assumptions -> 1 <= u2 <= 3 && u1 > 0]

(1/4)*Integrate[((1-Sqrt[u1-u2])*Log[4/u2])/Sqrt[u1-u2],{u2,u1-1,4}, Assumptions -> 4 <= u2 <= 4 && u1 > 0]

el que da la respuesta correcta :)

20voto

jldugger Puntos 7490

A menudo es de ayuda para el uso de funciones de distribución acumulativa.

En primer lugar,

F(x)=Pr((ad)2x)=Pr(|ad|x)=1(1x)2=2xx.

Next,

G(y)=Pr(4bcy)=Pr(bcy4)=y/40dt+1y/4ydt4t=y4(1log(y4)).

Let δ range between the smallest (0) and largest (5) possible values of (ad)2+4bc. Writing x=(ad)2 with CDF F and y=4bc with PDF g=G, we need to compute

H(δ)=Pr((ad)2+4bcδ)=Pr(xδy)=40F(δy)g(y)dy.

We can expect this to be nasty--the uniform distribution PDF is discontinuous and thus ought to produce breaks in the definition of H--so it is somewhat amazing that Mathematica obtains a closed form (which I will not reproduce here). Differentiating it with respect to δ gives the desired density. It is defined piecewise within three intervals. In 0<δ<1,

H(δ)=h(δ)=18(8δ+δ((2+log(16)))+2(δ2δ)log(δ)).

In 1<δ<4,

h(δ)=14((δ+1)log(δ1)+δlog(δ)4δcoth1(δ)+3+log(4)).

And in 4<δ<5,

h(δ)=14(δ4δ4+(δ+1)log(4δ1)+4δtanh1((δ4)δδδδ4)1).

Figure

This figure overlays a plot of h on a histogram of 106 iid realizations of (ad)2+4ac. The two are almost indistinguishable, suggesting the correctness of the formula for h.


The following is a nearly mindless, brute-force Mathematica solution. It automates practically everything about the calculation. For instance, it will even compute the range of the resulting variable:

ClearAll[ a, b, c, d, ff, gg, hh, g, h, x, y, z, zMin, zMax, assumptions];
assumptions = 0 <= a <= 1 && 0 <= b <= 1 && 0 <= c <= 1 && 0 <= d <= 1; 
zMax = First@Maximize[{(a - d)^2 + 4 b c, assumptions}, {a, b, c, d}];
zMin = First@Minimize[{(a - d)^2 + 4 b c, assumptions}, {a, b, c, d}];

Here is all the integration and differentiation. (Be patient; computing H takes a couple of minutes.)

ff[x_] := Evaluate@FullSimplify@Integrate[Boole[(a - d)^2 <= x], {a, 0, 1}, {d, 0, 1}];
gg[y_] := Evaluate@FullSimplify@Integrate[Boole[4 b c <= y], {b, 0, 1}, {c, 0, 1}];
g[y_]  := Evaluate@FullSimplify@D[gg[y], y];
hh[z_] := Evaluate@FullSimplify@Integrate[ff[-y + z] g[y], {y, 0, 4}, 
          Assumptions -> zMin <= z <= zMax];
h[z_]  :=  Evaluate@FullSimplify@D[hh[z], z];

Finally, a simulation and comparison to the graph of h:

x = RandomReal[{0, 1}, {4, 10^6}];
x = (x[[1, All]] - x[[4, All]])^2 + 4 x[[2, All]] x[[3, All]];
Show[Histogram[x, {.1}, "PDF"], 
 Plot[h[z], {z, zMin, zMax}, Exclusions -> {1, 4}], 
 AxesLabel -> {"\[Delta]", "Density"}, BaseStyle -> Medium, 
 Ticks -> {{{0, "0"}, {1, "1"}, {4, "4"}, {5, "5"}}, Automatic}]

8voto

wolfies Puntos 2399

Como el OP y whuber, me gustaría utilizar independencia para romper esta en problemas más simples:

Deje X=(ad)2. A continuación, el pdf de X, decir f(x) es:

Deje Y=4bc. A continuación, el pdf de Y, decir g(y) es:

El problema se reduce ahora a encontrar el pdf de X+Y. Puede haber muchas maneras de hacer esto, pero la más sencilla para mí es el uso de una función llamada TransformSum desde el actual desarrollo de la versión de mathStatica. Por desgracia, este no está disponible en una versión pública, en el momento presente, pero aquí está la entrada:

TransformSum[{f,g}, z]

que devuelve el pdf de Z=X+Y como la función a trozos:

Aquí está una parcela de el pdf sólo deriva, decir h(z):

Rápido de Monte Carlo de verificación

El siguiente diagrama compara empírico de Monte Carlo aproximación de los pdf (onduladas de color azul) el teórico pdf derivados de arriba (roja discontinua). Se ve bien.

i-Ciencias.com

I-Ciencias es una comunidad de estudiantes y amantes de la ciencia en la que puedes resolver tus problemas y dudas.
Puedes consultar las preguntas de otros usuarios, hacer tus propias preguntas o resolver las de los demás.

Powered by:

X