Re: Help: why is it that E(y1*y2) ~= E(y1)*E(y2) in matlab?



In article <1127507986.058005.26700@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"RodoMart@xxxxxxxxx" <RodoMart@xxxxxxxxx> wrote:

> Probability theorems state that E(y1*y2) = E(y1)*E(y2) if y1 and y2 are
> independnt.
>
> and yet:
>
> >> R=rand(200,10);
> >> mean(R,1)
> ans =
> Columns 1 through 6
> 0.48482 0.48403 0.45811 0.51291 0.47174
> 0.51492
> Columns 7 through 10
> 0.50848 0.49454 0.49336 0.47236
> >> prod(R,1).^(1/200)
> ans =
> Columns 1 through 6
> 0.36293 0.34597 0.3383 0.39711 0.34241
> 0.38867
> Columns 7 through 10
> 0.37065 0.36609 0.36387 0.34424
>
> ????????????
> where is the numerical error? Is the random generator bad? Is the
> product function numerically problematic? is the mean function
> numerically problematic? is the root function numerically problematic?
> Or am I wrong to compare these two?
> thanks
-----------------------------
Hi RodoMart,

The product of two hundred independent random variables, each of which
is uniformly distributed over [0,1], would indeed have an expected value
of (1/2)^200, as you have implied. However, such a product, considered as
a random variable, has an extremely skewed distribution, with the great
majority of values falling well below this expected value. Nevertheless,
those rare cases that exceed the expected value will do so by large enough
amounts that, on the average, the expected value will be attained. In
your example you tried only ten cases. I would expect that you would have
to try your experiment an astronomically large number of times to find
even one case where the expected value is actually exceeded.

You can see this if you compute the probability distribution for the
product of, say, just two or three such independent random variables. I
computer a density function of -log(c) for two of them and 1/2*log(c)^2
for three of them. These already show a strong trend for a majority of
product values to fall below the respective expected values of 1/4 and
1/8, but with larger though rarer values making up the difference. For
your product of two hundred of them this trend must become extreme indeed.

For this reason your example does not in my opinion constitute a valid
demonstration of a fault with TMW's 'rand' function. Their random number
generator can only create pseudo-random numbers, as TMW has conceded, but
I suspect it would require a far more sophisticated test to demonstrate
that fact.

(Remove "xyzzy" and ".invalid" to send me email.)
Roger Stafford
.



Relevant Pages

  • Re: Independent Random Variables
    ... trouble "visualizing" what do two independent random variables look ... The definition in terms of the cumulative distribution function ... or in terms of probability densities is clear enough, ...
    (sci.math)
  • Re: Random numbers
    ... independent random variables uniformly distributed over the integers ... or is it valid for reals too? ... k-1 independent random variables. ... X with a purely non-atomic distribution on a Polish space, ...
    (sci.math)
  • Re: Taking expectation of a function of a normal random variable
    ... numerical integration to take the expectation. ... with mean 1 and variance ... random variables. ...
    (comp.soft-sys.matlab)
  • Re: Taking expectation of a function of a normal random variable
    ... I want to take expectation in Matlab. ... with mean 1 and variance ... random variables. ...
    (comp.soft-sys.matlab)
  • Re: random orthogonal matrix
    ... independent random variables. ... are those of the Statistics Department or of Purdue University. ... Herman Rubin, Department of Statistics, Purdue University ...
    (sci.math)