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

2006-10-17 Thread Ravi Varadhan
Sent: Tuesday, October 17, 2006 3:31 PM To: Ravi Varadhan Cc: R-help@stat.math.ethz.ch; 'Florent Bresson' Subject: Re: [R] Re : Generate a random bistochastic matrix Thank you, Ravi, >>>>> "Ravi" == Ravi Varadhan <[EMAIL PROTECTED]> >>>>

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

2006-10-17 Thread Martin Maechler
Thank you, Ravi, > "Ravi" == Ravi Varadhan <[EMAIL PROTECTED]> > on Mon, 16 Oct 2006 18:54:16 -0400 writes: Ravi> Martin, I don't think that a doubly stochastic matrix Ravi> can be obtained from an arbitrary positive rectangular Ravi> matrix. There is a theorem by Sinkhor

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

2006-10-16 Thread Ravi Varadhan
--- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Martin Maechler Sent: Monday, October 16, 2006 10:30 AM To: Florent Bresson Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Re : Generate a

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

2006-10-16 Thread Duncan Murdoch
On 10/16/2006 11:50 AM, Rolf Turner wrote: > I don't think this idea has been suggested yet: > > (1) Form all n! n x n permutation matrices, > say M_1, ..., M_K, K = n!. > > (2) Generate K independent uniform variates > x_1, ..., x_k. > > (3) Renormalize these to su

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

2006-10-16 Thread Rolf Turner
I don't think this idea has been suggested yet: (1) Form all n! n x n permutation matrices, say M_1, ..., M_K, K = n!. (2) Generate K independent uniform variates x_1, ..., x_k. (3) Renormalize these to sum to 1, x <- x/sum(x) (4)

[R] Re : Generate a random bistochastic matrix

2006-10-16 Thread Florent Bresson
Thanks, I think it's a shrewd solution, but the problem is that it cannot generate every N*N bistochastic matrix and every cell tends to 1/N as B tends to infinity Florent Bresson - Message d'origine De : Dimitris Rizopoulos <[EMAIL PROTECTED]> À : Florent Bresson <[EMAIL PROTECTED]> C

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

2006-10-16 Thread Martin Maechler
A simpler approach --- as in similar problems --- is to use an iterative solution which works quite fast for any 'n'. Interestingly, the number of necessary iterations seems to *decrease* for increasing 'n' : bistochMat <- function(n, tol = 1e-7, maxit = 1000) { ## Purpose: Random bistochasti

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

2006-10-16 Thread Richard M. Heiberger
I am sorry, I can't figure out what your function is doing. Why do you have N^4 in the argument? A matrix should have N rows and N columns, that is, it should have length N^2. The function returns a vector, not a matrix. There is no example of its use. I am guessing that your function somewhere

[R] Re : Generate a random bistochastic matrix

2006-10-16 Thread Florent Bresson
Thanks, I tried someting like this, but computation takes times for large matrices btransf<-function(y,X=length(y)^4){ N<-length(y) bm<-matrix(rep(1/N,N^2),N,N) for(j in 1:X){ coord<-sample(1:N,4,replace=T)