mercredi 25 octobre 2017

How to generate random number from exponential distribution when the sizes are the numbers of Poisson random variable in R?

Suppose we draw a random sample y1, y2,..,y20 of size 20 from Poisson distribution with parameter 5 i.e., y~rpois(20,5). Suppose we got y1=4, y2=7, y3=5,...,y19=3, y20=5. Then, my problem is, how to draw the samples x1~rexp(y1,2), x2~rexp(y2,2),...,x20~rexp(y20,2) so that the sum(x)={sum(x1), sum(x2),...,sum(x20)} which will be again a random sample? I want to find this sum(x) and its mean, i.e., mean(sum(x)) and variance ,i.e., var(sum(x)).

I hope my question is clear to all of you.




Aucun commentaire:

Enregistrer un commentaire