User Tools

Site Tools


rvalue_linear_regression_correlation_coefficient_.htm
Navigation:  Templates > Guide to all Templates > Additional Libraries and Templates > Statistics Library >====== RVALUE (linear regression correlation coefficient) ====== Previous pageReturn to chapter overviewNext page

RVALUE(dataset [,meanX] [,meanY])

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

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

rvalue_linear_regression_correlation_coefficient_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)