Hi All!
This is my first post on this website (have been reading it for months though) so please bear with me if I don't do things right
The question I need to answer is how many rolls of a dice (in this case with 10 sides) it takes before I have seen every side. From that I need to say with 95% confidence how many rolls it will take.
I have written a code in R, it does what I want it to do (yay!) but only for one trial. I just want to know the easiest way to repeat it n times (so I can figure out the confidence part, and do a plot etc)
Here is the code:
So when I run this I've gotten, for example, count=29, 17, 48, 23 etc but I have to keep on running it and it gets tedious!
is there an easy way to do this?
Thanks in advance for your help
This is my first post on this website (have been reading it for months though) so please bear with me if I don't do things right
The question I need to answer is how many rolls of a dice (in this case with 10 sides) it takes before I have seen every side. From that I need to say with 95% confidence how many rolls it will take.
I have written a code in R, it does what I want it to do (yay!) but only for one trial. I just want to know the easiest way to repeat it n times (so I can figure out the confidence part, and do a plot etc)
Here is the code:
Code:
n = 10
param = 1:n
count = 0
while(length(param) != 0){
param = setdiff(param, sample(1:n,1)) ## remove the element
count = count + 1
}
count
is there an easy way to do this?
Thanks in advance for your help