LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

linear regression correlation coefficient

Does anyone have a vi that computes the linear regression correlation coefficient (R^2)?
0 Kudos
Message 1 of 10
(12,114 Views)
0 Kudos
Message 2 of 10
(12,114 Views)
0 Kudos
Message 3 of 10
(12,114 Views)
The solution with the minimal amount of LabVIEW coding takes advantage of the fact that the correlation coefficient can be obtained from:

r^2 = bb'

i.e. the product of the slope b and the slope b' obtained from swapping the x and y input arrays.

See attached image.
Message 4 of 10
(12,114 Views)

I only have the LabView Base development package, is there any way for me to make an easy work-around for finding the correlation coefficient or will I have to implement the equation?

0 Kudos
Message 5 of 10
(8,043 Views)

Implementing the equation seems like an easy workaround. 😄

0 Kudos
Message 6 of 10
(8,022 Views)

I know this thread is ten years old but I'm still going to post the subVI i made, it will work even for those with the base development package. Hope this proves useful for somebody out there.

0 Kudos
Message 7 of 10
(8,009 Views)

Hi gbaby,

 

yes, the thread is VERY old.
10 years later the function palettes have changed a lot and now contains functions like that (atleast in FDS)...

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 10
(8,003 Views)

I only have the basic development package, trust me I know that the Full and Professiona have all kinds of toys built in that I have to either build myself or find in decade-old threads. I just posted mine in case somebody is in my situation. Smiley Happy

0 Kudos
Message 9 of 10
(8,000 Views)

@gbaby wrote:

I know this thread is ten years old but I'm still going to post the subVI i made, it will work even for those with the base development package. Hope this proves useful for somebody out there.


Thanks! Actually, looks very similar to the one posted by greg over 10 years ago. 😮

 

You can eliminate the FOR loops (might perform better by taking better advantage of SSE). After the FOR loops are removed, there are a few common sub-expressions that you can merge for even better performance. No big deal, though. 😉

 

 

0 Kudos
Message 10 of 10
(7,993 Views)