WebCab Probability and Statistics Web Services for .NET v3.3 Demo

RandomVariables.DistributionFunctionUsingFunction Method 

Calculates the cumulative probability distribution function of a random variable which is given by providing an array of integers corresponding to the possible outcomes and the number of occurrences of these outcomes during the experiment which the random variable describes.

public double DistributionFunctionUsingFunction(
   double[] values,
   int[] occurrences,
   double evaluationPoint
);

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.
evaluationPoint
The integer index of the ordered events at which the cumulative probability distribution function is evaluated. That is, in the example of the nursery given above if a value of 3, is taken from this parameter then the probability of a child with the nursery being 3 years old or younger is returned.

Return Value

The value of the cumulation probability distribution function at a given point.

Remarks

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.

Internal Workings and Interpretation of the results returned

The associated (discrete) probability distribution p, for these results which gives the probability of a child randomly selected from the nursery taking a given age is:

  1. p(1) = 28 / (28+30+26+32+30), i.e. probability of a child being 1 years old.
  2. p(2) = 30 / (28+30+26+32+30), i.e. probability of a child being 2 years old.
  3. p(3) = 26 / (28+30+26+32+30), i.e. probability of a child being 3 years old.
  4. p(4) = 32 / (28+30+26+32+30), i.e. probability of a child being 4 years old.
  5. p(5) = 30 / (28+30+26+32+30), i.e. probability of a child being 5 years old.

Then the associated cumulative probability distribution g, takes the values:

  1. g(1) = p(1), the probability of a child being a 1 year old.
  2. g(2) = p(1) + p(2), the probability of a child being 2 years old or younger.
  3. g(3) = p(1) + p(2) + p(3), the probability of a child being 3 years old or younger.
  4. g(4) = p(1) + p(2) + p(3) + p(4), the probability of a child being 4 years old or younger.
  5. g(5) = p(1) + p(2) + p(3) + p(4) + p(5) = 1, the probability of a child being 5 years old or younger. Note that since all children in the sample are 5 years old or younger the sum must be unity.

The value which is returned by this method is precisely the value of the corresponding function g. Moreover, we allow the evaluation point to be set equal to any double and therefore for example if we set the evaluation point to be equal to 2.5, then the values corresponding to g(2), rather than g(2.5) will be returned.

See Also

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