[R] simulation with "rpois"
SUBIRANA CACHINERO, ISAAC
isubirana at imim.es
Thu Nov 2 15:09:40 CET 2006
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: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] En nombre de Pablo Andres
Enviado el: jueves, 02 de noviembre de 2006 12:59
Para: R-help at stat.math.ethz.ch
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!
______________________________________________
R-help at 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.
--
More information about the R-help
mailing list