
 Usage

This function generates samples from a multinomial
distribution given the probability of each outcome. The
general syntax for its use is

     y = randmulti(N,pvec)

where N is the number of experiments to perform, and pvec is
the vector of probabilities describing the distribution of
outcomes.


 Internals

A multinomial distribution describes the number of times
each of m possible outcomes occurs out of N trials, where
each outcome has a probability p_i. More generally, suppose
that the probability of a Bernoulli random variable X_i is
p_i, and that
 \[ \sum_{i=1}^{m} p_i = 1. \]
Then the probability that X_i occurs x_i times is
 \[ P_N(x_1,x_2,\ldots,x_n) = \frac{N!}{x_1!\cdots x_n!}
p_1^{x_1}\cdots p_n^{x_n}. \]


 Example

Suppose an experiment has three possible outcomes, say
heads, tails and edge, with probabilities 0.4999, 0.4999 and
0.0002, respectively. Then if we perform ten thousand coin
flips we get

  --> randmulti(10000,[0.4999,0.4999,0.0002])

  ans =
   5051    0 4948


* FreeMat_Documentation
* Random_Number_Generation
* Generated on Thu Jul 25 2013 17:17:46 for FreeMat by
  doxygen_ 1.8.1.1

