WebCab Probability and Statistics for COM v3.3 Demo

RandomVariables.ExpValue Method 

Evaluate the expected value of a random variable which is provided to the method directly rather than set within the internal table.

public double ExpValue(
   double[] values,
   int[] occurrences
);

Parameters

values
An array which provides the values corresponding to the possible outcomes which the experiment can take. For example, for the experiment used above we would provide {1, 2, 3, 4, 5}, corresponding to the possible ages of the children within the nursery.
occurrences
The i-th term of this array is the number of occurrences in which the experiment takes the value of the i-th term of the values array during the experiment considered.

Return Value

The mean of the random variable provided via the parameters.

Remarks

That is, the random variable is provided as an array of doubles and integers where the k-th term of the integer array corresponds to the values used to identify the k-th possible outcome of the experiment and the k-th term of the integer array is the corresponding number of occurrences of that outcome during the experiment.

Example and Further Explanation

Providing the Parameters

Considering the experiment of counting the number of children of the ages 1, 2, 3, 4, or 5, within a nursery. Say the random variable f, for this experiment is:

  1. f(1) = 28, i.e. the number of 1 year old children is 28.
  2. f(2) = 30, i.e. the number of 2 year old children is 30.
  3. f(3) = 26, i.e. the number of 3 year old children is 26.
  4. f(4) = 32, i.e. the number of 4 year old children is 32.
  5. f(5) = 30, i.e. the number of 5 year old children is 30.

In order to provide the random variable to this method which describes the experiment considered we need to pass the parameters for the values used to identify the outcomes of the experiment namely: {1, 2, 3, 4, 5}; corresponding to the ages of the children within the nursery. We also need to provide the number of occurrences of each of these outcomes namely: {28, 30, 26, 32, 30}; corresponding to the number of the children within the nursery with the five age groups respectively.

Results returned

Once the parameters are provided this method will return the mean of the random variable which is the weighted arithmetic average of the possible outcomes. In the case considered above this will correspond to the average age of a child within the nursery.

See Also

RandomVariables Class | WebCab.COM.Statistics.DiscretePrb Namespace | Allowing the probabilities of the events to be evaluated when the total number of occurrences within the considered experiment is known.