MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE:MORE: Statistics`ContinousDistributions` (integrating over a UniformDistribution)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg9294] RE:[mg9252] MORE: Statistics`ContinousDistributions` (integrating over a UniformDistribution)
  • From: tgarza at mail.internet.com.mx
  • Date: Mon, 27 Oct 1997 02:47:05 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Mark wrote

><<Statistics`ContinuousDistributions`
>
>p[x_] :=3D PDF[UniformDistribution[0,Pi],x]
>
>MeanDist[f_] :=3D Integrate[ f p[x], {x, 0, Pi}]

>MeanDist[ Sin[x] ]     Doesn't give 2/Pi   like I'd expect.  (and I
>don't even like forcing the limits to {0,Pi}... much better to have
>{-infinity,infinity}
...............
>Why can't Mathematica deal with it?


Mark,

There is nothing wrong here with MM3.It's just a matter of proper =
definitions.

To start with, there is a problem with the definition of your PDF. The =
complete definition must include the domain where the function is zero,
= which is x < 0 and x > 2 Pi. The function has three different =
definitions (i.e., one to the left of zero, one between zero and Pi,
and = one to the right of Pi) and the integral has to take this into
account. = Thus, there are three domains of integration, one of them
being the one = that goes between 0 and Pi, and you can't help it. That
is why the = integral does not exist the way you try to evaluate it,
proceeding as = though the function were defined in the same way all
over the real line.

Secondly, you must realize that if X is a random variable with a uniform
= PDF between 0 and Pi, and EX is its expected value (or Mean, if you =
wish), then Sin(X) is a random variable with a distribution function of
= its own, and ESin(X) is certainly not equal to Sin(E(X)). The =
expectation operator E is linear and does not "distribute" over =
nonlinear functions such as Sin.

If you want to find the Mean of Sin(X), then you must first find the CDF
= of Sin(X), which can be done by considering that P(Sin(X) <=3D y) =3D
= P(X <=3D arcsin(y)), with 0 <=3D arcsin(y) <=3D Pi, and this is equal
to = 2 arcsin(y)/Pi for 0 <=3D y <=3D 1. The value of this function at
y =3D = 1 is 1, as it should.

Then, the PDF is obtained by differentiation of the CDF:

D[2 ArcSin[x], x]=20

 2/(Pi Sqrt(1 - x^2)),

in the range 0 <=3D x <=3D 1, and zero elsewhere. Then, the Mean of =
Sin(X) is=20

NIntegrate[2x/(Pi Sqrt(1 - x^2)), {x, 0, 1}] =20
 0.63662

which is 2/Pi, as desired.=20

Unfortunately, I don't see any way to keep MeanDist all that general. =
Mathematica has no way of guessing what the domain of your function is
= in order to perform the integration in the correct range. =20
Cheers,

Tomas Garza
Cerrada de Cortes 31
Mexico 01040, D.F.



  • Prev by Date: Losing Old Mathematica 2.2 Notebooks in Mac OS 8 Install?
  • Next by Date: RE: Re: Help - Mathematica bombs out on loading <<Calculus`LaplaceTransform`
  • Previous by thread: MORE: Statistics`ContinousDistributions` (integrating over a UniformDistribution)
  • Next by thread: Re: MORE: Statistics`ContinousDistributions` (integrating over a UniformDistribution)