| **Navigation:**  [[templates.htm|Templates]] > Guide to all Templates > [[additional libraries and templates.htm|Additional Libraries and Templates]] > Statistics Library >====== SSXY (sum of squares for x and y) ====== | [[ss sum of squares .htm|{{btn_prev_n.gif|Previous page}}]][[additional libraries and templates.htm|{{btn_home_n.gif|Return to chapter overview}}]][[st1 student s t for a single mean .htm|{{btn_next_n.gif|Next page}}]] | | || **SSXY**(//dataset //[,//meanX//] [,//meanY//]) {{blk2blue.jpg|blk2blue.jpg}} | **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. {{notebox.jpg|NoteBox.jpg}} 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 **Example:** **StatSetXY QUEUE,PRE()** **X          REAL** **Y          REAL** **          END** **SumOfSquares   REAL** **CODE** ** 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** **     BREAK** **   ELSE** **     StatSetXY:X = STADAT:X         !load the QUEUE buffer** **     StatSetXY:Y = STADAT:Y         !load the QUEUE buffer** **     ADD(StatSetXY)                 !add to the QUEUE** **   END** ** END** ** SumOfSquares = SSXY(StatSetXY)     !call SSXY**