WebCab Probability and Statistics for COM v3.3 Demo

RandomVariables.GetFunctionOfRandomVariable Method 

Retrieve the number of occurrences of the possible outcomes of the experiment described by the indexth (discrete) random variable within the table of random variables set.

public double[] GetFunctionOfRandomVariable(
   int index
);

Parameters

index
The index (or position) of the random variable within the table (or collection) of random variables set for which the number of occurrences of each of possible outcomes will be returned. That is, we evaluate the set of values of the indexth random variable `function'.

Remarks

For further details, concerning how the table of random variables is set please see the notes within the class overview or the notes given below.

Example and Further Explanations

Recall that a (discrete) random variable describes the number of times a given outcome (or event) occurs from a given experiment. In particular, it can be viewed as a function f, which maps the possible outcomes to the number of occurrences of that outcome during the experiment considered. Say for example we are considering an experiment of counting the ages of children within a nursery. All the children's ages (in years) take one of five values: namely 1, 2, 3, 4, 5; and for the entire nursery the number of children of each age was found to be: 28, 30, 26, 32, 30; respectively.

The random variable of this experiment which we denote by f, mapping the ages of the children to the number of children in the nursery of that age, is given by:

  1. f(1) = 28
  2. f(2) = 30
  3. f(3) = 26
  4. f(4) = 32
  5. f(5) = 30

Now if this random variable has been set with the table (or collection) of random variables and lies in the kth position then by calling this method passing the parameter k, we return the number of children of the different ages as an array. In particular, the method will return the array: {28, 30, 26, 32, 30}.

Setting the Random Variables Table

In order to apply this method to the study of random variables you will first need to set the random variables within the internal table (i.e. an ordered collection of random variables) by using one or more of the following:

  1. AddRandomVariable - Adjoins a random variables to the internal table (or collection) of random variables.
  2. (int, double[], double[]) - Inserts a random variable into the ith position within the random variable table.

Note: If one of the random variables is either incorrectly set or is no longer in use then it can be removed from the table using (int).

See Also

RandomVariables Class | WebCab.COM.Statistics.DiscretePrb Namespace | Evaluates the associated probability distribution of the random variable.