I think there's only one mistake in your instructions. Try this: >lambda=1:100 >f=function(x)rchisq(4,0,x) >lapply(lambda,f) It generates a list of 4-length vectors. Notice that the function 'chisq' doesn't exists. I suppose it has to be replaced by 'rchisq'.
Isaac. -----Mensaje original----- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] En nombre de Pablo Andres Enviado el: jueves, 02 de noviembre de 2006 12:59 Para: [email protected] Asunto: [R] simulation with "rpois" Hi there, I need some helpo with one simulation. I have a matrix of 4x21 I want ro generate 100 random Chi2 distribution but inly from the first row of my matrix. This is what I try: Option (a): >lambda=1:100 >f=function(x)chisq(4,0,x) >lapply(lambda,f) It doesn't work! option(b): >m=mean(matrix[1,]) >x<-rpois(100,lambda=m) Works, but only generates a row of 25 values. The point is: I need a matrix of 100(rows) x 4(columns) thanks a lot! ______________________________________________ [email protected] 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. -- ______________________________________________ [email protected] 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.
