LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

correlation coefficient

Hi I'm trying to find correlation of two 1-D arrays with same sample numbers in my CVI program.

I use normalizing function (two arrays are inputs of this function) and

CorrelateEx function (normalized functions are inputs of this function) of CVI.

After normalizing and correlation operations, I divide elements of correlation array (output of CorrelateExfunction) to sample no and

take the maximum element of correlation array with divided inputs as correlation coefficient. However I get improper results.

 

thanks for any help or alternative methods.

0 Kudos
Message 1 of 8
(4,727 Views)

Hi,

 

correlation and correlation coefficent are not the same, and there are different meanings of a correlation coefficient... That said it is not clear to me what you are trying to achieve, and what do you mean by 'improper results'?

0 Kudos
Message 2 of 8
(4,725 Views)

... if you are unsure of how to use the function CorrelateEx, there is an example called correlat.cws that demonstrates its use

0 Kudos
Message 3 of 8
(4,723 Views)

thanks Wolfgang,

i'm trying to find "correlation" or relationship of two signals represented by two 1-D arrays,

and i need a number (correlation coefficient) giving an idea about relationsip of these signals. 

Here, i don't know how to infer corr. coeff. from correlation array produced by CorrelateEx function.

0 Kudos
Message 4 of 8
(4,714 Views)

Hi,

 

I am aware of at least three different methods to calculate a correlation coefficient, so before using a possibly unsuited function it is necessary to define the mathematics behind...:

 

1) There is the correlation coefficient that is sometimes called Pearson's r, it's range is between -1 and +1, see here

 

2) More frequently (from my personal point of use) one is referring to the coefficient of determination, which typically is denoted by R^2, see here If you are interested in these values, you should use a different CVI function, GoodnessofFit (a misleading function name)

 

3) One might also refer to the goodness of fit, which is more a measure of deviation, and typically is abbreviated with chi^2, see here

 

In case 1 and 3 you probably have to do the calculations on your own, without a ready-to-use function. Actually I got into the habit of writing my own statistics functions, due to the lack of documentation and other limitations of NIs built-in functions...

 

0 Kudos
Message 5 of 8
(4,710 Views)

...and with respect to correlation functions, as opposed to the correlation coefficients, I am aware of cross-correlation and auto-correlation functions. NIs function obviously calculates the cross correlation (despite the misleading name and the lack of documentation). You may get started here or with any good text book on statistical methods.

 

And to finally answer your question again: correlation functions and correlation coefficients are two different animals

0 Kudos
Message 6 of 8
(4,703 Views)

thanks:)

0 Kudos
Message 7 of 8
(4,701 Views)

My pleasure!

0 Kudos
Message 8 of 8
(4,698 Views)