Programmer Guide/Command Reference/EVAL/hist: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 7: Line 7:
:'''<code>hist(<var>x</var>, <var>rv</var>)</code>'''
:'''<code>hist(<var>x</var>, <var>rv</var>)</code>'''
:'''<code>wsum(hist(<var>x</var>, <var>rm</var>)</code>'''
:'''<code>wsum(hist(<var>x</var>, <var>rm</var>)</code>'''
:;<var>x, y</var>: the x- and y-data vector: <code>''y''[i] = f(''x''[i])</code>
:;<var>x</var>: a vector or a matrix
:;<var>us, os, n</var>: Every pair <code>{'us'+d*k, ''us''+d*(k+1)} (with: d=(''os''-''us'')/n, k=0..n-1)</code> defines a class. All three arguments are scalars.
:;<var>us, os, n</var>: Every pair <code>{'us'+d*k, ''us''+d*(k+1)} (with: d=(''os''-''us'')/n, k=0..n-1)</code> defines a class. All three arguments are scalars.
:;<var>uv, ov</var>: Every pair <code>{''uv''[k], ''ov''[k]} (with k=0..nrow(''uv'')-1)</code> defines a class. Both arguments must be vectors with same length.
:;<var>uv, ov</var>: Every pair <code>{''uv''[k], ''ov''[k]} (with k=0..nrow(''uv'')-1)</code> defines a class. Both arguments must be vectors with same length.
:;<var>rv</var>: Every pair <code>{''rv''[k], ''rv''[k+1]} (with k=0..nrow(''rv'')-2)</code> defines a class. The argument must be vector.
:;<var>rv</var>: Every pair <code>{''rv''[k], ''rv''[k+1]} (with k=0..nrow(''rv'')-2)</code> defines a class. The argument must be vector.
:;<var>rm</var>: Every pair <code>{''rm''[k,0], ''rm''[k,1]} (with k=0..nrow(''rm'')-1)</code> defines a class. The argument must be matrix with 2 columns.
:;<var>rm</var>: Every pair <code>{''rm''[k,0], ''rm''[k,1]} (with k=0..nrow(''rm'')-1)</code> defines a class. The argument must be matrix with 2 columns.
;Result: The result ''r'' is a scalar or a vector. Each element ''r''<sub>i</sub> is the number of elements of ''x'' belonging to class i. An element ''x''<sub>k</sub>belongs to a class i if <code>xmin<sub>i</sub> <= ''x''<sub>k</sub> < xmax<sub>i</sub></code>.
;Result: The result ''r'' is a scalar or a vector. Each element ''r''<sub>i</sub> is the number of elements of ''x'' belonging to class i. An element ''x''<sub>j,k</sub>belongs to a class i if <code>xmin<sub>i</sub> <= ''x''<sub>j,k</sub> < xmax<sub>i</sub></code>.


;See also: [[Programmer_Guide/Command_Reference/EVAL/sum|sum]], [[Programmer_Guide/Command_Reference/EVAL/hist|hist]]
;See also: [[Programmer_Guide/Command_Reference/EVAL/sum|sum]], [[Programmer_Guide/Command_Reference/EVAL/hist|hist]]

Revision as of 12:34, 8 April 2011

Calculate the absolute frequency of the values of vector x in arbitrary classes. Depending on the number of extents, the result of the function is a vector or a scalar.

Usage
hist(x, us, os, n)
hist(x, uv, ov)
hist(x, rv)
wsum(hist(x, rm)
x
a vector or a matrix
us, os, n
Every pair {'us'+d*k, us+d*(k+1)} (with: d=(os-us)/n, k=0..n-1) defines a class. All three arguments are scalars.
uv, ov
Every pair {uv[k], ov[k]} (with k=0..nrow(uv)-1) defines a class. Both arguments must be vectors with same length.
rv
Every pair {rv[k], rv[k+1]} (with k=0..nrow(rv)-2) defines a class. The argument must be vector.
rm
Every pair {rm[k,0], rm[k,1]} (with k=0..nrow(rm)-1) defines a class. The argument must be matrix with 2 columns.
Result
The result r is a scalar or a vector. Each element ri is the number of elements of x belonging to class i. An element xj,kbelongs to a class i if xmini <= xj,k < xmaxi.
See also
sum, hist

<function list>



hist

The absolute frequency of a vector in arbitrary classes. The result of the following functions is a vector or a scalar (dependent on the number of classes).

Using n classes with the same width, the first class begins at us and the last class ends at os.

hist(x, us, os, n)

nrow(uv) classes where every pair (uv[i], ov[i]) defines the value range of a class.

hist(x, uv, ov)

nrow(rv)-1 classes where every pair (rv[i], rv[i+1]) defines the value range for summation.

hist(x, rv)

nrow(rm) classes where every pair (rm[i,0], rm[i,1]) defines a value range for summation.

hist(x, rm)

Navigation menu

Personal tools