Hello everyone, please I need help with this code.
Inside the following loop, I want to create three empty integer arrays to save the value of f, x and y inside it. I want the arrays are unknown size because my code uses to generate random samples from distributions, in the f=rpois(1,4) I generate one value from Poisson distribution if the value from this command is (1) so, in x = rexp(f,1/2) I will generate one value from exponential distribution and in y= rexp(f,1/4) I will generate one value from exponential distribution but if the result from this f=rpois(1,4) command is (2) so I will generate two values from x and two values from y and so on. So the size of x and y arrays depends on the value of f and f is random (if f is 3 then x are 3 values and y are 3 values if f is 4 then x are 4 values and y are 4 values ....).
count=0
for (j in 1:10000000)
{
f = rpois(1,4)
if(f == 0)
{
count = count + 1
next
}
xx = rexp(f,1/2)
yy = rexp(f,1/4)
}
Thank you for the help but I want the result of f storage on the list, x in the other list, and y also in the other list. I want all of them individually.