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.
{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.3
, is taken from this parameter then the probability of a child with the nursery being 3
years old or younger is returned.The value of the cumulation probability distribution function at a given point.
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.
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:
p(1) = 28 / (28+30+26+32+30)
, i.e. probability of a child being 1
years old.
p(2) = 30 / (28+30+26+32+30)
, i.e. probability of a child being 2
years old.
p(3) = 26 / (28+30+26+32+30)
, i.e. probability of a child being 3
years old.
p(4) = 32 / (28+30+26+32+30)
, i.e. probability of a child being 4
years old.
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:
g(1) = p(1)
, the probability of a child being a 1
year old.
g(2) = p(1) + p(2)
, the probability of a child being 2
years old
or younger.
g(3) = p(1) + p(2) + p(3)
, the probability of a child being 3
years old or younger.
g(4) = p(1) + p(2) + p(3) + p(4)
, the probability of a child being
4
years old or younger.
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.
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.