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]> Cc : r-help@stat.math.ethz.ch Envoyé le : Lundi, 16 Octobre 2006, 16h35mn 02s Objet : Re: [R] Generate a random bistochastic matrix you can try something like the following: B <- 10 N <- 5 mats <- r2dtable(B, rep(1, N), rep(1, N)) out <- matrix(0, N, N) for(i in 1:length(mats)) out <- out + mats[[i]] out <- out / B out colSums(out) rowSums(out) I hope it helps. Best, Dimitris ---- Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm ----- Original Message ----- From: "Florent Bresson" <[EMAIL PROTECTED]> To: <r-help@stat.math.ethz.ch> Sent: Monday, October 16, 2006 10:22 AM Subject: [R] Generate a random bistochastic matrix Please, I would like to generate a random bistochastic matrix, that is a squared matrix of non-negative numbers with each row and each column sum to 1, for example : .2 .3 .5 .6 .3 .1 .2 .4 .4 I don't know of to code this. Do you have any idea ? Thanks Florent Bresson ___________________________________________________________________________ ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.