[R] Re : Re : Generate a random bistochastic matrix

Martin Maechler maechler at stat.math.ethz.ch
Mon Oct 16 18:57:08 CEST 2006


>>>>> "Florent" == Florent Bresson <f_bresson at yahoo.fr>
>>>>>     on Mon, 16 Oct 2006 16:17:51 +0000 (GMT) writes:

    Florent> Yes, I would like every generated matrix to be drawn from a uniform distribution. Martin Maechler's solution was interesting but when I compute the product of the obtained matrix with any N-vector Y, the resulting vector is most of the time quite close to a vector like mean(Y)*rep(1,N).

    [................]

uuhm;  not quite, in general!
Be more careful before you state such things!
It seems your claim would be equivalent to saying that my
function returned matrix entries very close to 1/N which is not
true:
If you do a small simulation with  my function and your  N = 20,

  mm <- replicate(100, bistochMat(20))
  str(mm)
  hist(mm)

you get a pretty reasonable result: The entries are on average
1/N (0.05 here), and I am expecting a somewhat skewed (to the
right) distribution which we get indeed.

Martin



More information about the R-help mailing list