| **Navigation:**  [[templates.htm|Templates]] > Guide to all Templates > [[additional libraries and templates.htm|Additional Libraries and Templates]] > Statistics Library >====== RVALUE (linear regression correlation coefficient) ====== | [[rangeofset range of a set .htm|{{btn_prev_n.gif|Previous page}}]][[additional libraries and templates.htm|{{btn_home_n.gif|Return to chapter overview}}]][[ss sum of squares .htm|{{btn_next_n.gif|Next page}}]] | | || **RVALUE**(//dataset //[,//meanX//] [,//meanY//]) {{blk2blue.jpg|blk2blue.jpg}} | **RVALUE** | Returns the correlation coefficient of the linear relationship between the paired data points in the data set. | | //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). | **RVALUE **computes the correlation coefficient of the linear relationship between the paired data points in the data set. The function operates on the numeric sets defined by all the entries in the first two components of the designated QUEUE (//dataset//). The optional parameters help to optimize the function. If not provided, the value(s) are 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** **CorrelationCoefficient  REAL** **CODE ** ** FREE(StatSetXY)                    !free the QUEUE** ** CLEAR(STADAT:RECORD)               !clear the record buffer** ** 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** ** CorrelationCoefficient = RVALUE(StatSetXY)    !call RVALUE**