DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....

## ScaleVector

Declaration: ScaleVector (var Data: TDoubleArray; SclType: TSclType; var Par1, Par2: double): integer;
Performs a scaling operation on the one-dimensional array Data. The type of scaling operation is controlled by the parameter SclType (see also: scaling the data for a detailed explanation). The variable parameters Par1 and Par2 contain the required scaling parameters on input and characteristics of the data before the scaling operation on return:

 SclType Scaling Operation Par1 Par2 sctMeanCenter The values of the array are scaled in such a way that the mean becomes zero. in: ignoredout: mean in: ignoredout: 0 sctStandardize The values are scaled to a zero mean and a standard deviation of 1.0. in: ignoredout: mean in: ignoredout: std.dev sctConstSum The values are scaled to a constant sum defined by the parameter Par1. in: intended sumout: actual sum before the scaling in: ignoredout: 0 sctConstSquaredSum The values are scaled to a constant sum of squared values. The sum is defined by the parameter Par1. in: intended sumout: actual sum before the scaling in: ignoredout: 0 sctMaxAbs The values are scaled in such a way that the maximum absolute value becomes Par1 in: intended maximumout: actual maximum of the absolute values of the minimum and maximum before the scaling in: ignoredout: 0 sctRange The data values are scaled to cover a range between Par1 and Par2 in: intended lower valueout: actual lowest value before the scaling in: intended upper valueout: actual highest value before the scaling sctSquash The data values are compressed by a sigmoid function ("squashing function") to the interval [-1,+1]. The parameter Par1 specifies the origin of the squashing function, the parameter Par2 defines the slope of the function. in: origin of the squashing functionout: same as in in: slope of the squashing functionout: same as in sctQNormalize The data is scaled to zero median and a difference between the median and the q-percentile of 1.0, with q (in %) given by the parameter Par1. in: probability q (>50 and <100)out: median in: ignoredout: difference of the quantile and the median before the scaling

The function returns the following error codes:

0 ... everything is OK
-5 ... variance of the data is zero
-6 ... sum of the data is zero
-7 ... data has a zero range
-8 ... maximum value is zero
-9 ... probability of quantile must be greater than 50 and less than 100