Thats exactly what I am looking for! Thanks for your help!

-----Ursprüngliche Nachricht-----
Von: Peter Dalgaard [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 1. Mai 2007 11:46
An: Dimitris Rizopoulos
Cc: Thür Brigitte; [email protected]
Betreff: Re: [R] simulation

Dimitris Rizopoulos wrote:
> maybe you're looking for something like this:
>
> x <- rpois(999, 2000)
> y <- numeric(length(x))
> for (i in seq_along(x))
>      y[i] <- sum(exp(rgamma(x[i], scale = 2, shape = 0.5)))
>
>   
Or use sapply,
sapply(x, function(x) sum(exp(rgamma(x[i], scale = 2, shape = 0.5)) )

or even

replicate(999, sum(exp(rgamma(rpois(1,2000), scale = 2, shape = 0.5)) )

*** [EMAIL PROTECTED] scanned this email for malicious content and found it to 
be 
clean ***

______________________________________________
[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.

Reply via email to