WINDEV, WEBDEV AND WINDEV MOBILEONLINE HELPVersion: 15161718192021222324
 Home | Sign in | English  Help WLanguage WLanguage functions Standard functions Functions for managing numeric values Statistical functions StatCorrelation Presentation Example Calculating the coefficient of correlation Number of elements found in the matrix Managing the errors Related examples See also  StatAverage StatAverageDeviation StatCorrelation StatCovariance StatError StatMax StatMin StatStandardDeviation StatStandardDeviationP StatSum StatVariance StatVarianceP Statistical constants Statistical functions The statistics
• Calculating the coefficient of correlation
• Number of elements found in the matrix
• Managing the errors
WINDEV      WEBDEV    WINDEV Mobile      Others StatCorrelation (Function)
In french: StatCorrelation
Calculates the coefficient of correlation between two series of values. Versions 18 and later This function is now available in Windows Store apps mode. New in version 18 This function is now available in Windows Store apps mode. This function is now available in Windows Store apps mode. Versions 19 and later This function is now available for iPhone/iPad applications. New in version 19 This function is now available for iPhone/iPad applications. This function is now available for iPhone/iPad applications. Versions 21 and later This function is now available in Universal Windows 10 App mode. New in version 21 This function is now available in Universal Windows 10 App mode. This function is now available in Universal Windows 10 App mode. Versions 23 and later This function is now available in Android Widget mode. This function is now available for Android applications. This function is now available for Java applications. New in version 23 This function is now available in Android Widget mode. This function is now available for Android applications. This function is now available for Java applications. This function is now available in Android Widget mode. This function is now available for Android applications. This function is now available for Java applications.
// Calculate the coefficient of correlation between row 1 and row 2 of a matrix
ResCorrelationCoef = StatCorrelation("MyMatrix", 1, 2, False)
Syntax
<Result> = StatCorrelation(<Matrix Name> [, <1st Row/1st Column> [, <2nd Row/2nd Column> [, <Row/Column>]]])
<Result>: Real
• Coefficient of correlation that exist between the two series of values,
• 0 if the coefficient of correlation is null.
<Matrix Name>: Character string (with quotes)
Name of the matrix containing the data, defined by MatCreate.
<1st Row/1st Column>: Optional integer
1st row or 1st column containing the data (1 by default).
<2nd Row/2nd Column>: Optional integer
2nd row or 2nd column containing the data (2 by default).
<Row/Column>: Optional boolean
• True (by default) if the series of values correspond to matrix columns,
• False if the series of values correspond to matrix rows.
Remarks

Calculating the coefficient of correlation StatCorrelation("MyMatrix", 1, 3, False) returns 0,997054. StatCorrelation("MyMatrix", 1, 3, False) returns 1. StatCorrelation("MyMatrix", 1, 3, False) returns 0.

Number of elements found in the matrix

The number of elements found in the matrix is taken as reference. This number of elements corresponds to:
• the number of matrix rows, returned by MatNbLine.
• the number of matrix columns, returned by MatNbColumn.
If the series contain less elements than the matrix, the missing values are automatically filled with 0. These values are taken into account during the calculations.

Managing the errors

Caution: StatCorrelation returns no error code. To find out whether errors have been generated when calculating the coefficient of correlation, use StatError. To find out the error details, use ErrorInfo associated with the errMessage constant.
Related Examples: Unit examples (WINDEV): The Stat functions [ + ] Using the main functions for statistical calculations (using matrices):- Calculate a sum of values- Calculate a mean of values- Find the minimum value in a set of values- Find the maximum value in a set of values Unit examples (WINDEV Mobile): The Stat functions [ + ] Using the main functions for statistical calculations (using matrices):- Calculate a sum of values- Calculate a mean of values- Find the minimum value in a set of values- Find the maximum value in a set of values
Component : wd240mat.dll
Minimum version required
• Version 9