|Navigation: Templates > Guide to all Templates > Additional Libraries and Templates > Statistics Library >====== SSXY (sum of squares for x and y) ======|
SSXY(dataset [,meanX] [,meanY])
|SSXY||Returns the sum of the products of the differences between each data point and its associated (either X or Y) mean value.|
|dataset||The label of a QUEUE with its first two component fields defined as REAL. The first component contains the set of X values and the second component contains the set of Y values.|
|meanX||A numeric constant or variable containing the average of the X values (optional).|
|meanY||A numeric constant or variable containing the average of the Y values (optional).|
SSXY computes the sum of the products of the differences between each data point and its associated (either X or Y) mean value. The function operates on the numeric sets defined by all the entries in the first two components of the designated QUEUE (dataset). The computation is a significant factor in linear regression formulas.
The optional parameters help to optimize the function. If not provided, the value(s) will be computed internally by the function.
The passed data set does not have to be sorted. The function copies the passed set. The passed data set is unchanged.
Return DataType: REAL
STADAT:Id = STA:Id !prime the record buffer
STADAT:ItemNumber = 1
SET(STADAT:KeyIdItemNumber,STADAT:KeyIdItemNumber !position file pointer
LOOP !load the QUEUE
NEXT(StatisticsData) !read next record
IF ERRORCODE() OR STADAT:Id NOT = STA:Id
StatSetXY:X = STADAT:X !load the QUEUE buffer
StatSetXY:Y = STADAT:Y !load the QUEUE buffer
ADD(StatSetXY) !add to the QUEUE
SumOfSquares = SSXY(StatSetXY) !call SSXY