correl

Returns the correlation coefficient of the given curve vectors.

Syntax

correl(vec_1, vec_2)

Argument

vec_1
The first vector.
vec_2
The second vector.

Example

Templex Expression Result
{correl({0,1},{1,0})} -1
{correl(p1w1c1.y,p1w1c2.y)} 0.4591

Comments

The correlation coefficient is calculated according to the following equation:

C o r r e l ( X , Y ) = ( x x ¯ ) ( y y ¯ ) ( x x ¯ ) 2 ( y y ¯ ) 2 MathType@MTEF@5@5@+= feaagKart1ev2aqatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9 vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=x fr=xb9adbiqaaeGaciGaaiaabeqaamaabaabaaGcbaGaae4qaiaab+ gacaqGYbGaaeOCaiaabwgacaqGSbGaaeikaiaabIfacaqGSaGaaeii aiaabMfacaqGPaGaaeypamaalaaabaWaaabqaeaacaGGOaGaamiEai abgkHiTiqadIhagaqeaiaacMcacaGGOaGaamyEaiabgkHiTiqadMha gaqeaiaacMcaaSqabeqaniabggHiLdaakeaadaGcaaqaamaaqaeaba GaaiikaiaadIhacqGHsislceWG4bGbaebacaGGPaWaaWbaaSqabeaa caaIYaaaaOWaaabqaeaacaGGOaGaamyEaiabgkHiTiqadMhagaqeai aacMcadaahaaWcbeqaaiaaikdaaaaabeqab0GaeyyeIuoaaSqabeqa niabggHiLdaaleqaaaaaaaa@5A38@

If the given vectors have a different number of data points, an error is returned.

If either vector is empty, or if the standard deviation of their values is equal to 0, an error is returned.