transform(deprecated)/cumulativefrequency - Help

stats[transform, cumulativefrequency]

partial sums of frequencies

 Calling Sequence stats[transform, cumulativefrequency](data) transform[cumulativefrequency](data)

Parameters

 data - statistical list

Description

 • Important: The stats package has been deprecated. Use the superseding package Statistics instead.
 • The function cumulativefrequency of the subpackage stats[transform, ...] computes the partial sums of the frequencies in the given data.
 • The data is used in its given order, and missing data is taken into consideration.
 • Cumulative frequencies are useful in constructing cumulative distributions and cumulative frequency polygons (or ogives). Ogives are plots of the cumulative frequencies against the upper class boundaries.
 • If the total weight of the data is scaled to one (see transform[scaleweight] and describe[count]), prior to the call to cumulativefrequency then the relative cumulative frequency distribution is obtained. If the weight is scaled to 100, the percentage cumulative frequency distribution attains. The corresponding ogive is referred to as  the percentage ogive. A closely related graph is the quantile plot, see statplots[quantile] for more information.

Examples

Important: The stats package has been deprecated. Use the superseding package Statistics instead.

 > $\mathrm{with}\left(\mathrm{stats}\right):$
 > $\mathrm{data1}≔\left[\mathrm{Weight}\left(3,10\right),\mathrm{missing},4,\mathrm{Weight}\left(11..12,3\right),15..17\right]$
 ${\mathrm{data1}}{:=}\left[{\mathrm{Weight}}{}\left({3}{,}{10}\right){,}{\mathrm{missing}}{,}{4}{,}{\mathrm{Weight}}{}\left({11}{..}{12}{,}{3}\right){,}{15}{..}{17}\right]$ (1)

This is obtained as follows:

 > $\left[10,10+1,10+1+1,10+1+1+3,10+1+1+3+1\right]$
 $\left[{10}{,}{11}{,}{12}{,}{15}{,}{16}\right]$ (2)
 > $\mathrm{transform}[\mathrm{cumulativefrequency}]\left(\mathrm{data1}\right)$
 $\left[{10}{,}{11}{,}{12}{,}{15}{,}{16}\right]$ (3)

The next few steps show the construction of an ogive.

 > $\mathrm{data2}≔\left[\mathrm{Weight}\left(1..5,2\right),\mathrm{Weight}\left(6..10,3\right),\mathrm{Weight}\left(11..15,1\right)\right]$
 ${\mathrm{data2}}{:=}\left[{\mathrm{Weight}}{}\left({1}{..}{5}{,}{2}\right){,}{\mathrm{Weight}}{}\left({6}{..}{10}{,}{3}\right){,}{\mathrm{Weight}}{}\left({11}{..}{15}{,}{1}\right)\right]$ (4)

Upper range of classes:

 > $\mathrm{classes}≔\mathrm{transform}[\mathrm{statvalue}]\left(\mathrm{data2}\right)$
 ${\mathrm{classes}}{:=}\left[{1}{..}{5}{,}{6}{..}{10}{,}{11}{..}{15}\right]$ (5)
 > $\mathrm{upper_classes}≔\mathrm{map}\left(x→\mathrm{op}\left(2,x\right),\mathrm{classes}\right)$
 ${\mathrm{upper_classes}}{:=}\left[{5}{,}{10}{,}{15}\right]$ (6)

Cumulative frequencies

 > $\mathrm{data2cumulative}≔\mathrm{transform}[\mathrm{cumulativefrequency}]\left(\mathrm{data2}\right)$
 ${\mathrm{data2cumulative}}{:=}\left[{2}{,}{5}{,}{6}\right]$ (7)

Points of the ogive

 > $\mathrm{ogive}≔\mathrm{zip}\left(\left(x,y\right)→\left[x,y\right],\mathrm{upper_classes},\mathrm{data2cumulative}\right)$
 ${\mathrm{ogive}}{:=}\left[\left[{5}{,}{2}\right]{,}\left[{10}{,}{5}\right]{,}\left[{15}{,}{6}\right]\right]$ (8)

Display the result. (Make the ogive start at the origin).

 > $\mathrm{plot}\left(\left[\left[0,0\right],\mathrm{op}\left(\mathrm{ogive}\right)\right],\mathrm{title}=\mathrm{Cumulative frequency distribution}\right):$