Evaluate the expected value of a random variable which is provided to the method directly rather than set within the internal table.
{1, 2, 3, 4, 5}
, corresponding to the possible ages of the children within the nursery.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.The mean of the random variable provided via the parameters.
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.
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:
f(1) = 28
, i.e. the number of 1
year old children is 28
.
f(2) = 30
, i.e. the number of 2
year old children is 30
.
f(3) = 26
, i.e. the number of 3
year old children is 26
.
f(4) = 32
, i.e. the number of 4
year old children is 32
.
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.
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.
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.