Maptitude GISDK Help |
Computes a given statistic for the vector.
Added to Version 6.0/2012. Added Cumulative Index statistic and Cumulative Value option to Version 2014.
stat = VectorStatistic(vector v, string statistic, array options)
Argument |
Contents |
v |
A vector |
statistic |
The statistic, from the list below |
Statistic |
Description |
Count |
Count the number of elements in the vector |
Sum |
Sum the values of the elements in the vector |
Mean |
Compute the mean of the vector elements |
Median |
Return the median value of the vector elements |
Percentile |
Return the nth percentile, using the Percentile option to set n |
Min |
Return the minimum value of the vector |
Max |
Return the maximum value of the vector |
Sdev |
Return the standard deviation of the vector |
Min Index |
Return the index of the minimum element in the vector |
Max Index |
Return the index of the maximum element in the vector |
Cumulative Index |
Calculate the cumulative sum of the vector elements, until the sum is greater than or equal to the input cumulative value, and return the index of that vector element |
Option |
Type |
Contents |
Ignore Missing |
String |
"True" (the default) to skip missing values when computing the statistic, "False" to include missing values when computing the statistic |
Percentile |
Number |
A value between 0 and 100; defaults to 50 |
Weight |
Vector |
Weights/frequencies to apply before computing the statistic |
Cumulative Value |
Number |
A value that must be provided for computing the Cumulative Index statistic |
The value of the statistic.
To have missing values contribute to the statistic, set the Ignore Missing option to "False".
The median is the 50th percentile, so the Percentile statistic without the Percentile option will return the median.
Percentiles are estimated as a linear interpolation of the modes for the order statistics for the uniform distribution on [0,1]. This method is identical to that used in Microsoft Excel and the algorithm type 7 in R.
If the Weight option is not used, a weight of 1 is assumed for each element in the vector.
If a weight value in the vector for the Weight option is missing, it is treated as 0.
The Weight option will not affect the Min and Max statistics.
The smallest index that can be returned by the Cumulative Index statistic is 1, and the largest index is one greater than the vector length.
For more information on vectors, see Vectors.
folder = RunMacro("G30 Tutorial Folder")
view_name = OpenTable("Customer", "DBASE", {folder + "customer.dbf",})
v = GetDataVector(view_name+"|", "SALES", )
vsum = VectorStatistic(v, "Sum", )
vmean = VectorStatistic(v, "Mean", )
ShowArray({vsum, vmean ,v})
GISDK Function |
Summary |
Copies an array to a vector |
|
Copies a vector to a new vector |
|
Constructs a cumulative vector in a new vector |
|
Concatenates vectors into one, combined long vector |
|
Creates a vector from a field in a view|set |
|
Creates vectors from fields in a view|set |
|
Fills values into a field in a view|set from a vector |
|
Fills values into fields in a view|set from vectors |
|
Sorts the elements of a vector in ascending order |
|
Sorts an array of vectors in ascending order, based on the first vector |
|
Transposes an array of arrays, where element b[i][j] = a[j][i] |
|
Creates a vector |
|
Copies a vector to an array |
©2025 Caliper Corporation | www.caliper.com |