stats(deprecated)/transform - Help

Overview of the stats[transform] Subpackage

 Calling Sequence stats[transform]command](arguments) command(arguments)

Description

 • Important: The stats package has been deprecated. Use the superseding package Statistics instead.
 • The stats[transform] subpackage provides various tools for transforming lists of statistical data.
 • Each command in the stats[transform] package can be accessed by using either the long form or the short form of the command name in the command calling sequence.

List of stats[transform] Subpackage Commands

 • The following is a list of available commands.

 extends map() to statistical data. replace data classes by their class mark (mid-point). count up the weights of the data items. delete missing data from the data list. divide the data by a number or a descriptive statistics function. give the weights of each data item. compute moving averages and other moving quantities. apply a formula across multiple data lists. multiply the weights of the data by a given value. split the data list into multiple lists of the same weight. replace each data item by its standard score (z-value). sort statistical data. give the value of each data item. That is, set their weight to 1. subtract from the data  a number or a descriptive statistics function. tally each data item. tally each item into specified classes.

 To display the help page for a particular stats[transform] command, see Getting Help with a Command in a Package.
 • Some commands either require or use parameters in addition to the data given as arguments. These parameters appear as an index to the command name. See transform[standardscore] for an example.
 • If a particular call cannot be evaluated, for example trying to find the mode of a statistical list that contains a non-numeric entry, then the call is returned unevaluated. Information is provided in the variable stats/lasterror as to the reason why a call was not evaluated. Also, this information is automatically given if infolevel[stats] has a value greater than or equal to one, prior to the unsuccessful call.

Examples

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

 > $\mathrm{with}\left(\mathrm{stats}\right):$
 > $\mathrm{data}≔\left[4,\mathrm{Weight}\left(3,10\right),\mathrm{missing},\mathrm{Weight}\left(1..2,25\right)\right]$
 ${\mathrm{data}}{≔}\left[{4}{,}{\mathrm{Weight}}{}\left({3}{,}{10}\right){,}{\mathrm{missing}}{,}{\mathrm{Weight}}{}\left({1}{..}{2}{,}{25}\right)\right]$ (1)
 > $\mathrm{transform}[\mathrm{deletemissing}]\left(\mathrm{data}\right)$
 $\left[{4}{,}{\mathrm{Weight}}{}\left({3}{,}{10}\right){,}{\mathrm{Weight}}{}\left({1}{..}{2}{,}{25}\right)\right]$ (2)
 > $\mathrm{transform}[\mathrm{statsort}]\left(\mathrm{data}\right)$
 $\left[{\mathrm{Weight}}{}\left({1}{..}{2}{,}{25}\right){,}{\mathrm{Weight}}{}\left({3}{,}{10}\right){,}{4}{,}{\mathrm{missing}}\right]$ (3)
 > $\mathrm{data2}≔\left[1,1,1,2,3,3,4,4,4,4,5,6,6,6,7,8,9,10\right]$
 ${\mathrm{data2}}{≔}\left[{1}{,}{1}{,}{1}{,}{2}{,}{3}{,}{3}{,}{4}{,}{4}{,}{4}{,}{4}{,}{5}{,}{6}{,}{6}{,}{6}{,}{7}{,}{8}{,}{9}{,}{10}\right]$ (4)
 > $\mathrm{transform}[\mathrm{tally}]\left(\mathrm{data2}\right)$
 $\left[{\mathrm{Weight}}{}\left({1}{,}{3}\right){,}{2}{,}{\mathrm{Weight}}{}\left({3}{,}{2}\right){,}{\mathrm{Weight}}{}\left({4}{,}{4}\right){,}{5}{,}{\mathrm{Weight}}{}\left({6}{,}{3}\right){,}{7}{,}{8}{,}{9}{,}{10}\right]$ (5)

Remembering that the left boundary of a class is inclusive, and the right boundary is exclusive (so the 10 above belongs to 10..15 and not 5..10, we have:

 > $\mathrm{transform}[\mathrm{tallyinto}]\left(\mathrm{data2},\left[0..5,5..10,10..15\right]\right)$
 $\left[{\mathrm{Weight}}{}\left({0}{..}{5}{,}{10}\right){,}{\mathrm{Weight}}{}\left({5}{..}{10}{,}{7}\right){,}{10}{..}{15}\right]$ (6)