Re: [R] Efficient multinom probs

2007-01-05 Thread Dimitris Rizopoulos
://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: "Ingmar Visser" <[EMAIL PROTECTED]> To: Sent: Friday, January 05, 2007 11:41 AM Subject: [R] Efficient multinom probs > Dear R-helpers, > > I need to compute pr

[R] Efficient multinom probs

2007-01-05 Thread Ingmar Visser
Dear R-helpers, I need to compute probabilties of multinomial observations, eg by doing the following: y=sample(1:3,15,1) prob=matrix(runif(45),15) prob=prob/rowSums(prob) diag(prob[,y]) However, my question is whether this is the most efficient way to do this. In the call prob[,y] a whole matri