FREQTABLE Function (PV-WAVE Advantage)
Tallies observations into a one-way frequency table.
Usage
result = FREQTABLE(x, nbins)
Input Parameters
x—One-dimensional array containing the observations.
nbins—Number of intervals (bins).
Returned Value
result—One-dimensional array containing the counts.
Input Keywords
Double—If present and nonzero, double precision is used.
Lower_Bound—Used with Upper_Bound to specify two semi-infinite intervals that are used as the initial and last interval. The initial interval is closed on the right and includes Lower_Bound as its right endpoint. The last interval is open on the left and includes all values greater than Upper_Bound. The remaining nbins − 2 intervals are of length:
(Upper_Bound – Lower_Bound)/(nbins – 2)
and are open on the left and closed on the right. The keyword Upper_Bound also must be specified with this keyword. Parameter nbins must be greater than or equal to 3 for this option.
Upper_Bound—Used along with Lower_Bound to specify two semi-infinite intervals that are used as the initial and last interval. The initial interval is closed on the right and includes Lower_Bound as its right endpoint. The last interval is open on the left and includes all values greater than Upper_Bound. The remaining nbins − 2 intervals are of length (Upper_Bound – Lower_Bound)/(nbins – 2) and are open on the left and closed on the right. The keyword Lower_Bound must also be specified with this keyword. Parameter nbins must be greater than or equal to 3 for this option.
Cutpoints—Specifies a one-dimensional array of length nbins containing the cutpoints to use. This option allows unequal intervals. The initial interval is closed on the right and contains the initial cutpoint as its right endpoint. The last interval is open on the left and includes all values greater than the last cutpoint. The remaining nbins − 2 intervals are open on the left and closed on the right. Parameter nbins must be greater than 3 for this option. If Cutpoints is used, then no other keywords should be specified.
Class_Marks—Specifies a one-dimensional array containing equally spaced class marks in ascending order. The class marks are the midpoints of each of the nbins, and each interval is taken to have length (Class_Marks(1) – Class_Marks(0)). Parameter nbins must be greater than or equal to 2 for this option. If Class_Marks is used, then no other keywords should be specified.
Discussion
The default action of FREQTABLE is to group data into nbins categories of size (max (x) – min (x))/nbins. The initial interval is closed on the left and open on the right. The remaining intervals are open on the left and closed on the right. Using keywords, the types of intervals used may be changed.
If Upper_Bound and Lower_Bound are specified, two semi-infinite intervals are used as the initial and last interval. The initial interval is closed on the right and includes Lower_Bound as its right endpoint. The last interval is open on the left and includes all values greater than Upper_Bound. The remaining nbins − 2 intervals are of length (Upper_Bound – Lower_Bound)/(nbins – 2) and are open on the left and closed on the right. Parameter nbins must be greater than or equal to 3 for this option.
If keyword Class_Marks is used, equally spaced class marks in ascending order must be provided in an array of length nbins. The class marks are the midpoints of each of the nbins, and each interval is taken to have the following length:
(Class_Marks(1) – Class_Marks(0))
Parameter nbins must be greater than or equal to 2 for this option.
If keyword Cutpoints is used, cutpoints (bounders) must be provided in an array of length nbins. This option allows unequal intervals. The initial interval is closed on the right and contains the initial cutpoint as its right endpoint. The last interval is open on the left and includes all values greater than the last cutpoint. The remaining nbins − 2 intervals are open on the left and closed on the right. Parameter nbins must be greater than 3 for this option.
Example
The data for this example is from Hinkley (1977) and Velleman and Hoaglin (1981). Data includes measurements (in inches) of precipitation in Minneapolis/St. Paul during the month of March for 30 consecutive years.
; Define the data set.
x = [0.77, 1.74, 0.81, 1.20, 1.95, 1.20, 0.47,$
1.43, 3.37, 2.20, 3.00, 3.09, 1.51, 2.10,$
0.52, 1.62, 1.31, 0.32, 0.59, 0.81, 2.81,$
1.87, 1.18, 1.35, 4.75, 2.48, 0.96, 1.89,$
0.90, 2.05]
; Call FREQTABLE with nbins = 10.
table = FREQTABLE(x, 10)
PRINT, ' Bin Number Count' &$
PRINT, ' ---------- -----' &$
FOR i=0L, 9 DO PRINT, i + 1, table(i)
; This results in the following output:
; Bin Number Count
; ---------- -----
; 1 4.00000
; 2 8.00000
; 3 5.00000
; 4 5.00000
; 5 3.00000
; 6 1.00000
; 7 3.00000
; 8 0.00000
; 9 0.00000
; 10 1.00000
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.