Dundas Chart for Windows Forms
Correlation Method
See Also  Example Send comments on this topic.
DundasWinChart Assembly > Dundas.Charting.WinControl Namespace > Statistics Class : Correlation Method


firstInputSeriesName
The name of the series that stores the first group of data. Data must be stored in the first Y-values of the series' data points.
First Input Series Name
secondInputSeriesName
The name of the series that stores the second group of data. Data must be stored in the first Y-values of the series' data points. An exception will be raised if both input series do not have the same number of data points.
Second Input Series Name

Enterprise Edition Only Feature. This method gets the correlation value for two series of data.


This analysis tool and its formulas measure the relationship between two data sets that are scaled to be independent of the unit of measurement. The population correlation calculation returns the covariance of two data sets divided by the product of their standard deviations. You can use the Correlation tool to determine whether two ranges of data move together — that is, whether large values of one set are associated with large values of the other (positive correlation), whether small values of one set are associated with large values of the other (negative correlation), or whether values in both sets are unrelated (correlation near zero).

Syntax

Visual Basic (Declaration)  
Public Function Correlation( _
   ByVal firstInputSeriesName As String, _
   ByVal secondInputSeriesName As String _
) As Double
Visual Basic (Usage) Copy Code
Dim instance As Statistics
Dim firstInputSeriesName As String
Dim secondInputSeriesName As String
Dim value As Double
 
value = instance.Correlation(firstInputSeriesName, secondInputSeriesName)
C#  
public double Correlation( 
   string firstInputSeriesName,
   string secondInputSeriesName
)

Parameters

firstInputSeriesName
The name of the series that stores the first group of data. Data must be stored in the first Y-values of the series' data points.
First Input Series Name
secondInputSeriesName
The name of the series that stores the second group of data. Data must be stored in the first Y-values of the series' data points. An exception will be raised if both input series do not have the same number of data points.
Second Input Series Name

Return Value

Returns Correlation

Example

The following sample gets the correlation coefficient between two groups of data (Series1 and Series2) and returns the result as a double.
Visual Basic Copy Code
Imports Dundas.Charting.WinControl
...

' Get the correlation
Dim result As Double = Chart1.DataManipulator.Statistics.Correlation("Series1", "Series2")
C# Copy Code
using Dundas.Charting.WinControl;
...

// Get correlation
double result = Chart1.DataManipulator.Statistics.Correlation("Series1", "Series2");

Remarks

Correlation measures the relationship between two data sets that are scaled to be independent of the unit of measurement. This correlation method returns the covariance of two data sets divided by the product of their standard deviations, and always ranges from -1 to 1.

Use correlation to determine whether two ranges of data move together that is, whether large values of one set are associated with large values of the other (positive correlation), whether small values of one set are associated with large values of the other (negative correlation), or whether values in both sets are unrelated (correlation near zero).

If a specified input series does not exist in the series collection at the time of the method call than an exception will be thrown. An exception will also be raised if the series do not have the same number of data points.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2009 All Rights Reserved.