Previous Up Next

7.1.12  Cumulative frequencies: cumulated_frequencies frequences_cumulees

Given a list, the cumulated_frequencies command will plot the cumulated frequency of the numbers in the list; i.e., the area under the resulting graph at a value x will be the fraction of numbers less than x. For example, if you enter

cumulated_frequencies([1,2,1,1,2,1,2,4,3,3])

then you will get

The cumulated_frequencies command can also take a matrix with two columns as an argument. In this case, the first column will represent values while the second column will represent the number of times the values occur. For example, the above graph can be drawn with the command

cumulated_frequencies([[1,4],[2,3], [3,2], [4,1]])

If the first column of the input matrix contains intervals a..b instead of numbers, then the second column values will be normalized to add up to one, and will represent the frequencies of the intervals. If the matrix has the form

[[a0..a1,f1],...,[an−1..an,fn]] 

then the plot will consist of the polygonal path starting at (a0,0) and moving to (a1,f1) to (a2,f1+f2) and so on until (an,f1+⋯ + fn). For example, both

cumulated_frequencies([[1..2,30],[2..4,40],[4..5,30]])

and

cumulated_frequencies([[1..2,03],[2..4,0.4],[4..5,0.3]])

will give you

If the matrix given to cumulated_frequencies has more than two columns, then each additional column will represent a different distribution of the numbers in the first column, and each distribution will be graphed. For example, if you enter

cumulated_frequencies([[1,4,1],[2,3,4], [3,2,1], [4,1,2]])

then both the distributions given by [[1,4],[2,3], [3,2], [4,1]] and [[1,1],[2,4], [3,1], [4,2]] will be drawn on the same axes; the result will be


Previous Up Next