Hi,

I am simulating an event that has 15 possible outcomes and I have a
vector 'pout' that gives me the probability of each outcome -
different outcomes have different probabilities. Does anyone know a
simple way of simulating the outcome of my event?

If my event had only two possible outcomes (0/1) I would pick a
uniform random number between 0 and 1 and use it to choose between the
two possible outcomes given a certain probability of outcome 0 or
failure 1.

Now, since I have 15 possible outcomes, I guess that this should be
done with some form of a categorical distribution but I couldn't find
a function for the categorical distribution yet.

Thanks for any suggestions!

Gonçalo

______________________________________________
R-help@r-project.org 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