WebCab Probability and Statistics for .NET v3.3 Demo

RandomVariables.Variance Method (Double[], Int32[])

Calculates the variance of a random variable which measures the degree to which the values of the random variable deviate from its mean.

public double Variance(
   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.

Remarks

Note that here the random variable is passed to the method via parameters, rather than read from the internal table.

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 and {28, 30, 26, 32, 30}; corresponding to the number of the children within the nursery within the five age groups respectively.

Results returned

Once the parameters are provided this method will return the variance of the random variable which roughly speaking is the weighed sum of the squares of the differences from the mean for each of the values of the events within the experiment. That is, the variance is a measure of the amount by which the values which the random variable takes deviate from its mean. In the above example the variance would measure the degree to which we would expect a randomly selected child's age to differ from the mean of the ages of the children within the nursery.

See Also

RandomVariables Class | WebCab.Libraries.Statistics.DiscretePrb Namespace | RandomVariables.Variance Overload List