17.1.5.2 Algorithm (Discrete Frequency)

The data consists of a sample of n observations of a discrete variable, denoted byx_i\,\!, fori=1,...,n. Then sort the data ascending, the ordered data is denoted byx_{(i)}\,\!, fori=1,...,n. The corresponding count of the value x_{(i)}\,\! is denoted byc_i\,\!, , which is the frequency of the ith value. The relative frequency and cumulative frequency of x_{(i)}\,\! are calculated as follows:

RelativeFrequency=c_k/n\,\! and CumulativeFrequency_k=\sum_{k=1}^N{c_i}/n\,\!, for k=1,...,n.