Share via


WorksheetFunction.Covariance_P Method

Returns population covariance, the average of the products of deviations for each data point pair.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Function Covariance_P ( _
    Arg1 As Object, _
    Arg2 As Object _
) As Double
'Usage
Dim instance As WorksheetFunction
Dim Arg1 As Object
Dim Arg2 As Object
Dim returnValue As Double

returnValue = instance.Covariance_P(Arg1, _
    Arg2)
double Covariance_P(
    Object Arg1,
    Object Arg2
)

Parameters

Return Value

Type: System.Double

Remarks

Use Covariance_P 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, Covariance_P generates an error.

If either Arg1 or Arg2 is empty, Covariance_P generates an error.

The covariance is:

Figure 1: Equation for covariance

Equation for covariance

where x and y are the sample means AVERAGE(array1) and AVERAGE(array2), and n is the sample size.

See Also

Reference

WorksheetFunction Interface

WorksheetFunction Members

Microsoft.Office.Interop.Excel Namespace