Libraries.Compute.Statistics.Calculations.Covariance Documentation

This class calculates the covariance of two particular DataFrameColumns. The default covariance calculated in this case is the population covariance. Use UseSample(true) to get the sample covariance. For more information: https://en.wikipedia.org/wiki/Covariance

Example Code

use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Calculations.Covariance

//Load a comma separated file
DataFrame frame
frame:Load("Data.csv") 
Covariance covariance

//set the mean before using it. Alternatively, we can allow it to calculate for us.
//The result is received slightly faster if we set it.
covariance:SetMean1(17) 
covariance:SetMean2(12) 
DataFrameColumn column1 = frame:GetColumn(0)
DataFrameColumn column2 = frame:GetColumn(1)
covariance:Calculate(column1, column2)
number covar = covariance:GetCovariance()

Inherits from: Libraries.Language.Object

Actions Documentation

BiasCorrected()

Returns the biasCorrected

Return

boolean:

BiasCorrected(boolean biasCorrected)

Sets the bias corrected boolean. True if correction is applied.

Parameters

  • boolean biasCorrected

Calculate(Libraries.Compute.Statistics.DataFrameColumn column1, Libraries.Compute.Statistics.DataFrameColumn column2)

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Example

Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Empty()

This calculation can be used again if Empty is called after using it on a column.

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

Example

use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)

GetCovariance()

Returns the sample covariance.

Return

number:

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

GetMean1()

Returns the mean1

Return

number:

GetMean2()

Returns the mean2

Return

number:

SetMean1(number mean)

Sets the mean1. The covariance then uses this value in its calculation.

Parameters

  • number mean

SetMean2(number mean)

Sets the mean2. The covariance then uses this value in its calculation.

Parameters

  • number mean

UsePopulation()

Returns the population boolean

Return

boolean:

UsePopulation(boolean population)

Sets the population boolean. True if population covariance is applied.

Parameters

  • boolean population

UseSample()

Returns the sample boolean

Return

boolean:

UseSample(boolean sample)

Sets the sample boolean. True if sample covariance is applied.

Parameters

  • boolean sample