20.1.13 Cumulative frequencies
Given a list of numbers L, the cumulated frequency at x is the
fraction of numbers in the list less than x.
The cumulated_frequencies
command plots the cumulated frequency of the numbers in a list or given by a matrix.
For numbers in a list:
-
cumulated_frequencies takes
L, a list of numbers.
- cumulated_frequencies(L) draws the cumulated
frequency of the numbers in L, where if L is a matrix, each
number in the first column is repeated the number of times given in
the second column.
For numbers in a matrix:
-
cumulated_frequencies takes
M, a matrix.
- cumulated_frequencies(M) (for a matrix with two
columns, whose first column consists of numbers and whose second
column consists of positive integers) draws the cumulated frequency
of the numbers in the first column, where number in the first column
is repeated the number of times given in the second column.
- cumulated_frequencies(M) (for a matrix with more
than two columns, whose first column consists of numbers and whose
remaining columns consist of positive integers) draws the cumulated
frequencies for the first column paired with each remaining column.
- cumulated_frequencies(M) (for a matrix with two
columns, whose first column consists of ranges a..b and whose
second column consists of positive numbers), will normalize the second
column so the elements add up to 1 and draw the cumulated
frequencies where the second column gives the frequency for the
intervals in the first column.
Examples
cumulated_frequencies([1,2,1,1,2,1,2,4,3,3]) |
or:
cumulated_frequencies([[1,4],[2,3],[3,2],[4,1]]) |
cumulated_frequencies([[1..2,30],[2..4,40],[4..5,30]]) |
or:
cumulated_frequencies([[1..2,0.3],[2..4,0.4],[4..5,0.3]]) |
cumulated_frequencies([[1,4,1],[2,3,4],[3,2,1],[4,1,2]]) |
Here, both the distributions given by
[[1,4],[2,3],[3,2],[4,1]]
and
[[1,1],[2,4],[3,1],[4,2]]
are drawn on the same axes.