The Gnumeric Manual
Prev | Chapter 14. Data Analysis Tools | Next

# 14.10. Random Number Generation Tool

Figure 14-36. Random Number Generation Tool Dialog

Use the random number generation tool to generate random numbers. This tool can generate random numbers from various probability distributions.

Specify the number of variables in the "Number of Variables:" entry. This determines the number of columns of random values to be produced.

Specify the number of random numbers for each variable in the "Size of Sample:" entry. This determines the number of rows of random values to be produced.

Specify the random distribution by selecting one of the items from the random distribution list. The following random distributions are supported: Discrete, Normal, Poisson, Exponential, Binomial, Negative Binomial, Bernoulli, and Uniform.

Specify the parameters of the selected distribution:

Discrete Random Distribution

  Specify the value and probability input range in the "Value and Probability Input Range:" entry box. The value and probability input range is a table consisting of two columns and any number of rows. The first column specifies the discrete random values and the second column the probabilities for them. The discrete random values do not have to be numbers, for example, strings will do as well. The sum of the probabilities in the second column should be one. For example, if you have the values A, B, C, and D in A1:A4 and values 0.1, 0.4, 0.2, and 0.3 in B1:B4, you would specify the value and probability input range to be A1:B4.

  | If the probabilities do not add to 1, they will be automatically scaled.

Normal Random Distribution

  Specify the mean and the standard deviation. The default values are 0 for the mean and 1 for the standard deviation.

Poisson Random Distribution

  Specify the lambda in the "Lambda" entry. Lambda is the average number of events in a unit time interval.

Exponential Random Distribution

  Specify b in the "b Value" entry.

Binomial Random Distribution

  Specify the probability of success (p) in the "p Value" entry and the number of trials (n) in the "Number of Trials" entry. The Binomial distribution is a discrete distribution in which the experiment consists of n identical trials. Each trial is independent of other the trials and has two possible outcomes, a success or a failure. The probability of success p is constant from one trial to another. The mean of a random variable that has a Binomial distribution is E(X) = np, and the variance is var(X) = np(1-p).

Negative Binomial Distribution

  Specify the probability of success p in the "p Value" entry and the number of failures r in the "Number of Failures" entry. Negative Binomial distribution is a discrete distribution in which the experiment consists of a sequence of independent trials. Each trial has two possible outcomes, a success or a failure. The probability of success p is constant from one trial to another. The experiment continues until r failures are observed, where r is fixed in advance. The mean of a random variable that has a Negative Binomial distribution is E(X) = r(1-p)/p, and the variance is var(X) = r(1-p)/p^2.

Bernoulli Random Distribution

  Specify the probability of success (p) in the "p Value" entry. p is a probability value between 0 and 1. The Bernoulli distribution has two random values 0 and 1, and p is the probability to observe value 1. The mean of a random variable that has a Bernoulli distribution is E(X) = 1(p) + 0(1-p) = p, and the variance is var(X) = p(1-p).

Uniform Random Distribution

  Specify the range of the continuous random variable with the "Between:" and "And:" entries. The default values for these entries are 0 and 1.

Figure 14-37. Some Example Data for the Random Number Generation Tool

Example 14-10. Using the Random Number Generation Tool

Figure 14-37 shows some example data and Figure 14-38 the corresponding output.

Figure 14-38. Random Number Generation Tool Output

Prev | Home | Next
Histogram Tool | Up | Rank and Percentile Tool