RangeCorrel - script and chart function
RangeCorrel() returns the correlation coefficient for two sets of data. The correlation coefficient is a measure of the relationship between the data sets.
Syntax:
RangeCorrel(x_value , y_value[, Expression])
Return data type: numeric
Data series should be entered as (
Arguments:
Argument | Description |
---|---|
Each value represents a single value or a range of values as returned by an inter-record functions with a third optional parameter. Each value or range of values must correspond to an x-value or a range of y-values. | |
Optional expressions or fields containing the range of data to be measured. |
Limitations:
The function needs at least two pairs of coordinates to be calculated.
Text values, NULL values and missing values return NULL.
Examples and results:
Examples | Results |
---|---|
|
Returns 0.2492. This function can be loaded in the script or added into a visualization in the expression editor. |
Example:
Add the example script to your app and run it. Then add, at least, the fields listed in the results column to a sheet in your app to see the result.
RangeList:
Load * Inline [
ID1|x1|y1|x2|y2|x3|y3|x4|y4|x5|y5|x6|y6
01|46|60|70|13|78|20|45|65|78|12|78|22
02|65|56|22|79|12|56|45|24|32|78|55|15
03|77|68|34|91|24|68|57|36|44|90|67|27
04|57|36|44|90|67|27|57|68|47|90|80|94
] (delimiter is '|');
XY:
LOAD recno() as RangeID, * Inline [
X|Y
2|3
6|8
9|4
8|5
](delimiter is '|');
In a table with
ID1 | MyRangeCorrel |
---|---|
01 | -0.9517 |
02 | -0.5209 |
03 | -0.5209 |
04 | -0.1599 |
Example:
XY:
LOAD recno() as RangeID, * Inline [
X|Y
2|3
6|8
9|4
8|5
](delimiter is '|');
In a table with
RangeID | MyRangeCorrel2 |
---|---|
01 | 0.2492 |
02 | -0.9959 |
03 | -1.0000 |
04 | - |
The value for