WorksheetFunction.Covar(Object, Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns covariance, the average of the products of deviations for each data point pair.
public:
double Covar(System::Object ^ Arg1, System::Object ^ Arg2);
public double Covar (object Arg1, object Arg2);
Public Function Covar (Arg1 As Object, Arg2 As Object) As Double
Parameters
- Arg1
- Object
The first cell range of integers.
- Arg2
- Object
The second cell range of integers.
Returns
Remarks
Important: This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. This function is still available for compatibility with earlier versions of Excel. However, if backward compatibility is not required, you should consider using the new functions from now on, because they more accurately describe their functionality. For more information about the new functions, see the Covariance_P(Object, Object) and Covariance_S(Object, Object) method.
Use covariance to determine the relationship between two data sets. For example, you can examine whether greater income accompanies greater levels of education.
The arguments must either be numbers or be names, arrays, or references that contain numbers.
If an array or reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included.
If Arg1
and Arg2
have different numbers of data points, Covar generates an error.
If either Arg1
or Arg2
is empty, Covar generates an error.
The covariance is:
Figure 1: Equation for covariance
where x and y are the sample means AVERAGE(array1) and AVERAGE(array2), and n is the sample size.