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

From STX Wiki
Jump to navigationJump to search
(initial import)
 
No edit summary
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
=====hist=====
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:
:<code>hist(<var>x</var>, <var>us</var>, <var>os</var>, <var>n</var>)</code>
:<code>hist(<var>x</var>, <var>uv</var>, <var>ov</var>)</code>
:<code>hist(<var>x</var>, <var>rv</var>)</code>
:<code>hist(<var>x</var>, <var>rm</var>)</code>
:;<var>x</var>: a vector or a matrix
:;<var>us, os, n</var>: Every pair <code>{''us''+d*i, ''us''+d*(i+1)} (with: d=(''os''-''us'')/n, i=0..n-1)</code> defines a class. All three arguments are scalars.
:;<var>uv, ov</var>: Every pair <code>{''uv''[i], ''ov''[i]} (with: i=0..nrow(''uv'')-1)</code> defines a class. Both arguments must be vectors with same length.
:;<var>rv</var>: Every pair <code>{''rv''[i], ''rv''[i+1]} (with: i=0..nrow(''rv'')-2)</code> defines a class. The argument must be vector.
:;<var>rm</var>: Every pair <code>{''rm''[i,0], ''rm''[i,1]} (with: i=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>j,k</sub> belongs to a class i if <code>xmin<sub>i</sub> &le; ''x''<sub>j,k</sub> < xmax<sub>i</sub></code>.
;See also: [[../sum|sum]], [[../wsum|wsum]]


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).
[[../#Functions|<function list>]]
 
Using <var>n</var> classes with the same width, the first class begins at <var>u</var>s and the last class ends at <var>o</var>s.
 
<code>hist(<var>x</var>, <var>u</var>s, <var>o</var>s, <var>n</var>)</code>
 
nrow(<var>u</var>v) classes where every pair (<var>u</var>v[i], <var>o</var>v[i]) defines the value range of a class.
 
<code>hist(<var>x</var>, <var>u</var>v, <var>o</var>v)</code>
 
nrow(<var>r</var>v)-1 classes where every pair (<var>r</var>v[i], <var>r</var>v[i+1]) defines the value range for summation.
 
<code>hist(<var>x</var>, <var>r</var>v)</code>
 
nrow(rm) classes where every pair (rm[i,0], rm[i,1]) defines a value range for summation.
 
<code>hist(<var>x</var>, <var>r</var>m)</code>

Latest revision as of 20:20, 21 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)
hist(x, rm)
x
a vector or a matrix
us, os, n
Every pair {us+d*i, us+d*(i+1)} (with: d=(os-us)/n, i=0..n-1) defines a class. All three arguments are scalars.
uv, ov
Every pair {uv[i], ov[i]} (with: i=0..nrow(uv)-1) defines a class. Both arguments must be vectors with same length.
rv
Every pair {rv[i], rv[i+1]} (with: i=0..nrow(rv)-2) defines a class. The argument must be vector.
rm
Every pair {rm[i,0], rm[i,1]} (with: i=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,k belongs to a class i if xminixj,k < xmaxi.
See also
sum, wsum

<function list>

Navigation menu

Personal tools