Skip to main content

Correl - script function

Correl() returns the aggregated correlation coefficient for a series of coordinates represented by paired numbers in x-expression and y-expression iterated over a number of records as defined by a group by clause.

Syntax:  

Correl(value1, value2)

Return data type: numeric

Arguments:  

Argument Description
value1, value2 The expressions or fields containing the two sample sets for which the correlation coefficient is to be measured.

Limitations:  

Text values, NULL values and missing values in any or both pieces of a data-pair result in the entire data-pair being disregarded.

Examples and results:  

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.

Example Result

Salary:

Load *, 1 as Grp;

LOAD * inline [

"Employee name"|Gender|Age|Salary

Aiden Charles|Male|20|25000

Brenda Davies|Male|25|32000

Charlotte Edberg|Female|45|56000

Daroush Ferrara|Male|31|29000

Eunice Goldblum|Female|31|32000

Freddy Halvorsen|Male|25|26000

Gauri Indu|Female|36|46000

Harry Jones|Male|38|40000

Ian Underwood|Male|40|45000

Jackie Kingsley|Female|23|28000

] (delimiter is '|');

 

Correl1:

LOAD Grp,

Correl(Age,Salary) as Correl_Salary Resident Salary Group By Grp;

 

In a table with the dimension Correl_Salary, the result of the Correl() calculation in the data load script will be shown: 0.9270611

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!