1
$\begingroup$

I have the density function and I want to determine its expected value

f[x_] :=0.8000064000512005` (0.25`/(1 - x)^3 + 0.5`/(1 - x)^2) UnitStep[-x] + 0.8000064000512005` (0.25`/(1 + x)^3 + 0.5`/(1 + x)^2) UnitStep[x]

I used

Limit[NIntegrate[f[x]*x, {x, -y, y}], y -> Infinity] 

which gives $0$

unlike

NIntegrate[f[x]*x, {x, -Infinity, Infinity}]

Then I used

z[x_] := ProbabilityDistribution[f[x], {x, -Infinity, Infinity}]
Mean[z[x]]

which was running and running..

What is the right way? what is the expected value w.r.t. the given density function?

$\endgroup$
2
$\begingroup$
f[x_] = 4/5 *
    ((1/(4 (1 - x)^3) + 1/(2 (1 - x)^2)) UnitStep[-x] + (1/(4 (1 + x)^3) + 
       1/(2 (1 + x)^2)) UnitStep[x])//FullSimplify;

f[1] = f[1.] = Limit[f[x], x -> 1]

1/8

f[-1] = f[-1.] = Limit[f[x], x -> -1]

1/8

dist = ProbabilityDistribution[f[x], {x, -Infinity, Infinity}];

Plot[f[x], {x, -10, 10},
 PlotRange -> {0, .625}]

enter image description here

Verifying that the distribution integrates to one:

Integrate[f[x], {x, -Infinity, Infinity}]

1

Expectation[1, Distributed[x, dist]]

1

Since the distribution is symmetric about zero the mean is zero.

f[-x] == f[x]

True

Mean[dist]

0

Expectation[x, Distributed[x, dist]]

0

$\endgroup$
  • $\begingroup$ Thx for the answer. $\endgroup$ – Seyhmus Güngören Jan 26 '15 at 16:57

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.