TallyInto - Maple Help
www.fgks.org   »   [go: up one dir, main page]

For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Online Help
All Products    Maple    MapleSim

Statistics

  

TallyInto

  

compute data frequencies

 

Calling Sequence

Parameters

Options

Description

Notes

Examples

Compatibility

Calling Sequence

TallyInto(X, R, options)

Parameters

X

-

data sample

R

-

range or list(range) or Vector; grouping pattern

options

-

(optional) equation(s) of the form option=value where option is one of weights, ignore, bins or output; specify options for the TallyInto function.

Options

  

The options argument can contain the following option:

• 

weights=Array, or list -- Vector of weights. If weights are specified, the TallyInto function will compute cumulative weights of data items in each interval. Note that the weights provided must have type/realcons and the returned frequencies are floating-point, even if the problem is specified with exact values. Both the data array and the weights array must have the same number of elements.

• 

ignore=truefalse -- This option is used to specify how to handle non-numeric data. If ignore is set to true all non-numeric items in X will be ignored.

• 

bins=posint -- If this option is set, every data range in R will be subdivided into the given number of equal subintervals. The default value of bins is 10 if only one range is given and 1 if multiple ranges are given. If R is specified as a Vector, then the bins option is ignored.

• 

output=list, or table -- By default (output=list) a list of equation of the form range=frequency is returned. If the value of this option is set to output=table this list is converted to an object of type table.

Description

• 

The TallyInto function groups together elements from X which belong to the same data range and computes their frequencies. (See also Statistics[Tally]).

• 

The first parameter X is the data set.

• 

The second argument R is used to specify how the data should be grouped. The value of R can be a range or a list of ranges, or it can be a Vector (or other one-dimensional rtable) of numbers.

  

If ranges are specified, then for each range, TallyInto will compute the number of data items in the corresponding interval. The intervals are not assumed to be disjoint, so any data item may belong to more than one interval (or none of them). Each interval can be divided into a number of equal-sized subintervals using the bins option (see below). Alternatively, you can pass default as the value for R, which tells TallyInto to use the interval between the smallest and the largest data items.

  

If R is a Vector of numbers x0 < x1 < ... < xn, then instead Maple uses the n intervals [x0, x1), [x1, x2), ..., [x(n-1), xn]. The bins option is ignored in this case.

  

If a given range is subdivided into n subranges, then each subrange except for the rightmost one corresponds to an interval that is closed on the left and open on the right; the rightmost interval is closed on both sides. That is, a value that is equal to a boundary value will be part of the subrange on its right (except if it is at the right of the whole range). Similarly, if R is a Vector, boundary points will be put into the subinterval on the right (except the rightmost point will be put into the last subinterval). Note, however, that both the boundary points and the data points will be converted to floating-point, and this could conceivably cause the floating-point versions of data points to lie on the other side of boundary points than the exact versions do.

Notes

• 

The underlying computation is done in floating-point; therefore, all data provided must have type/realcons and all returned frequencies are floating-point, even if the problem is specified with exact values.  For more information about numeric computation in the Statistics package, see the Statistics[Computation] help page.

• 

Note that TallyInto will return an error if it is required to split an infinite interval (i.e. if the value of bins is different from 1 and at least one boundary of an interval is infinite).

Examples

withStatistics&colon;

AArrayseq1i&comma;i=1..100

A112131415161718191101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981991100

(1)

TallyIntoA&comma;default&comma;bins=5

0.0100000000000000..0.208000000000000=96&comma;0.208000000000000..0.406000000000000=2&comma;0.406000000000000..0.604000000000000=1&comma;0.604000000000000..0.802000000000000=0&comma;0.802000000000000..1.00000000000000=1

(2)

TallyIntoA&comma;default&comma;bins=3

0.0100000000000000..0.340000000000000=98&comma;0.340000000000000..0.670000000000000=1&comma;0.670000000000000..1.00000000000000=1

(3)

WArrayseqi&comma;i=1..100

W123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100

(4)

TallyIntoA&comma;default&comma;bins=3&comma;weights=W

0.0100000000000000..0.340000000000000=5047.&comma;0.340000000000000..0.670000000000000=2.&comma;0.670000000000000..1.00000000000000=1.

(5)

FrequencyTableA&comma;bins=3&comma;weights=W

0.0100000000000000..0.3400000000000005047.99.94059405940595047.99.94059405940590.340000000000000..0.6700000000000002.0.03960396039603965049.99.98019801980200.670000000000000..1.1.0.01980198019801985050.100.

(6)

TallyIntoA&comma;1..0.5&comma;0.5..0.5&comma;1..1&comma;bins=3

−1...−0.500000000000000=0&comma;−0.500000000000000..0.=0&comma;0...0.500000000000000=99&comma;−0.500000000000000..−0.166666666666667=0&comma;−0.166666666666667..0.166666666666667=94&comma;0.166666666666667..0.500000000000000=5&comma;−1...−0.333333333333333=0&comma;−0.333333333333333..0.333333333333333=97&comma;0.333333333333333..1.=3

(7)

TallyIntoA&comma;1..0.5&comma;0.5..0.5&comma;1..1&comma;bins=3&comma;weights=W

−1...−0.500000000000000=0.&comma;−0.500000000000000..0.=0.&comma;0...0.500000000000000=5049.&comma;−0.500000000000000..−0.166666666666667=0.&comma;−0.166666666666667..0.166666666666667=5029.&comma;0.166666666666667..0.500000000000000=20.&comma;−1...−0.333333333333333=0.&comma;−0.333333333333333..0.333333333333333=5044.&comma;0.333333333333333..1.=6.

(8)

An example with explicitly specified bounds.

ASampleExponential1&comma;105&colon;

PowersOf2Vectorseq2i&comma;i=4..4

PowersOf2116181412124816

(9)

TallyIntoA&comma;PowersOf2

0.0625000000000000..0.125000000000000=5661&comma;0.125000000000000..0.250000000000000=10415&comma;0.250000000000000..0.500000000000000=17142&comma;0.500000000000000..1.=23932&comma;1...2.=23206&comma;2...4.=11604&comma;4...8.=1850&comma;8...16.=36

(10)

Compare this histogram:

HistogramA&comma;binbounds=PowersOf2

Compatibility

• 

The R parameter was updated in Maple 16.

See Also

Statistics

Statistics[Computation]

Statistics[FrequencyTable]

Statistics[Histogram]

Statistics[Tally]