## Libraries.Compute.Statistics.Tests.CorrelateRanks Documentation

This class implements a Spearm Correlation Coefficient. For more information, see the wikipedia page: https://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient There are two ways to use this class. First, if we want to correlate two groups, the class will automatically detect this case and we can call actions like GetCorrelation, which will return that case. If we want to compare more than two groups, these actions will throw errors and we will be requested to either iterate through the results or two call the corresponding GetCorrelation(leftIndex, rightIndex) actions.

Example Code

``````use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CorrelateGroups

DataFrame frame

CorrelateRanks correlate
frame:Calculate(correlate)

output correlate:GetCorrelation``````

## Summary

### Actions Summary Table

ActionsDescription
AddColumn(integer column)This action adds a value to the end of the input.
Calculate(Libraries.Compute.Statistics.DataFrame frame)This calculates a hash value for the results tabl
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
EmptyColumns()This action empty's the list, clearing out all of the items contained within i
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetColumn(integer index)This action gets the item at a given location in an array.
GetColumnIterator()This action gets an iterator for the object and returns that iterator.
GetColumnSize()This action gets the size of the array.
GetCorrelateGroupsResult(integer leftIndex, integer rightIndex)This returns a correlation between two particular columns.
GetCorrelation()Obtains the raw correlation, typically named "r" in statistics.
GetCorrelation(integer leftIndex, integer rightIndex)Obtains the raw correlation, typically named "r" in statistics.
GetCriticalValue(integer leftIndex, integer rightIndex)Obtains the critical value calculated by the test (traditionally letter t in statistics).
GetCriticalValue()Obtains the critical value calculated by the test (traditionally letter t in statistics).
GetDegreesOfFreedom()Obtains the degrees of freedom calculated by the test.
GetDegreesOfFreedom(integer leftIndex, integer rightIndex)Obtains the raw degrees of freedom.
GetFormalSummary()Obtains the raw probability value (p in statistics).
GetHashCode()This action gets the hash code for an object.
GetProbabilityValue(integer leftIndex, integer rightIndex)Obtains the raw probability value (p in statistics).
GetProbabilityValue()Obtains the probability value (p in statistics) calculated by the test.
GetResultIterator()This returns an Iterator object of all results calculated.
GetStatisticalFormatting()
IsEmptyColumns()This action returns a boolean value, true if the container is empty and false if it contains any items.
RemoveColumn(integer column)This action removes the first occurrence of an item that is found in the Addable object.
RemoveColumnAt(integer index)This action removes an item from an indexed object and returns that item.
SetStatisticalFormatting(Libraries.Compute.Statistics.Reporting.StatisticsFormatting formatting)

## Actions Documentation

This action adds a value to the end of the input.

### Calculate(Libraries.Compute.Statistics.DataFrame frame)

This calculates a hash value for the results tabl

### 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.

Example Code

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

#### Return

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

### EmptyColumns()

This action empty's the list, clearing out all of the items contained within i

### Equals(Libraries.Language.Object object)

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

Example Code

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

#### Return

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

### GetColumn(integer index)

This action gets the item at a given location in an array.

#### Return

integer: The item at the given locatio

### GetColumnIterator()

This action gets an iterator for the object and returns that iterator.

#### Return

Libraries.Containers.Iterator: Returns the iterator for an objec

### GetColumnSize()

This action gets the size of the array.

integer:

### GetCorrelateGroupsResult(integer leftIndex, integer rightIndex)

This returns a correlation between two particular columns. If no such correlation exists, this action returns undefined.

Example Code

``````use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CorrelateGroups
use Libraries.Containers.Iterator

DataFrame frame

CorrelateRanks correlate
frame:Calculate(correlate)

CorrelateGroupsResult result = correlate:GetCorrelateGroupsResult(0,``````

#### Return

Libraries.Compute.Statistics.Reporting.CorrelateGroupsResult: the correlation results between two groups.

### GetCorrelation()

Obtains the raw correlation, typically named "r" in statistics. This calculation only returns a result in the case where the number of correlations to calculate is 2 (two columns). If the number of groups is 3 or more, GetCorrelation(integer leftIndex, integer rightIndex) should be used instead. This is a convenience action for the two-group case.

Example Code

``````use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CorrelateGroups

DataFrame frame

CorrelateRanks correlate
frame:Calculate(correlate)

output correlate:GetCorrelation``````

#### Return

number: the correlation between two groups.

### GetCorrelation(integer leftIndex, integer rightIndex)

Obtains the raw correlation, typically named "r" in statistics. This calculation only returns a result in the case where the left and right indexes are valid.

Example Code

``````use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CorrelateGroups

DataFrame frame

CorrelateRanks correlate
frame:Calculate(correlate)

output correlate:GetCorrelation(0,``````

#### Parameters

• integer leftIndex: the first group
• integer rightIndex: the second group

#### Return

number: the correlation between two groups.

### GetCriticalValue(integer leftIndex, integer rightIndex)

Obtains the critical value calculated by the test (traditionally letter t in statistics). This calculation only returns a result in the case where the left and right indexes are valid.

Example Code

``````use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CorrelateGroups

DataFrame frame

CorrelateRanks correlate
frame:Calculate(correlate)

output correlate:GetCriticalValue(0,``````

#### Parameters

• integer leftIndex: the first group
• integer rightIndex: the second group

#### Return

number: the degrees of freedom.

### GetCriticalValue()

Obtains the critical value calculated by the test (traditionally letter t in statistics). This calculation only returns a result in the case where the number of correlations to calculate is 2 (two columns). If the number of groups is 3 or more, GetDegreesOfFreedom(integer leftIndex, integer rightIndex) should be used instead. This is a convenience action for the two-group case.

Example Code

``````use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CorrelateGroups

DataFrame frame

CorrelateRanks correlate
frame:Calculate(correlate)

output correlate:GetCriticalValue``````

#### Return

number: the degrees of freedom.

### GetDegreesOfFreedom()

Obtains the degrees of freedom calculated by the test. This calculation only returns a result in the case where the number of correlations to calculate is 2 (two columns). If the number of groups is 3 or more, GetDegreesOfFreedom(integer leftIndex, integer rightIndex) should be used instead. This is a convenience action for the two-group case.

Example Code

``````use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CorrelateGroups

DataFrame frame

CorrelateRanks correlate
frame:Calculate(correlate)

output correlate:GetDegreesOfFreedom``````

#### Return

number: the degrees of freedom.

### GetDegreesOfFreedom(integer leftIndex, integer rightIndex)

Obtains the raw degrees of freedom. This calculation only returns a result in the case where the left and right indexes are valid.

Example Code

``````use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CorrelateGroups

DataFrame frame

CorrelateRanks correlate
frame:Calculate(correlate)

output correlate:GetDegreesOfFreedom(0,``````

#### Parameters

• integer leftIndex: the first group
• integer rightIndex: the second group

#### Return

number: the degrees of freedom.

### GetFormalSummary()

Obtains the raw probability value (p in statistics). This calculation only returns a result in the case where the left and right indexes are valid.

Example Code

``````use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CorrelateGroups

DataFrame frame

CorrelateRanks correlate
frame:Calculate(correlate)

output correlate:GetProbabilityValue(0,``````

#### Return

text: the degrees of freedom.

### GetHashCode()

This action gets the hash code for an object.

Example Code

``````Object o
integer hash = o:GetHashCode``````

#### Return

integer: The integer hash code of the object.

### GetProbabilityValue(integer leftIndex, integer rightIndex)

Obtains the raw probability value (p in statistics). This calculation only returns a result in the case where the left and right indexes are valid.

Example Code

``````use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CorrelateGroups

DataFrame frame

CorrelateRanks correlate
frame:Calculate(correlate)

output correlate:GetProbabilityValue(0,``````

#### Parameters

• integer leftIndex: the first group
• integer rightIndex: the second group

#### Return

number: the degrees of freedom.

### GetProbabilityValue()

Obtains the probability value (p in statistics) calculated by the test. This calculation only returns a result in the case where the number of correlations to calculate is 2 (two columns). If the number of groups is 3 or more, GetDegreesOfFreedom(integer leftIndex, integer rightIndex) should be used instead. This is a convenience action for the two-group case.

Example Code

``````use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CorrelateGroups

DataFrame frame

CorrelateRanks correlate
frame:Calculate(correlate)

output correlate:GetProbabilityValue``````

#### Return

number: the degrees of freedom.

### GetResultIterator()

This returns an Iterator object of all results calculated. If there happened to only be two correlations calculated, this iterator will still contain the one correlation.

Example Code

``````use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CorrelateGroups
use Libraries.Containers.Iterator

DataFrame frame

CorrelateRanks correlate
frame:Calculate(correlate)

Iterator<CorrelateGroupsResult> iterator = correlate:GetResultIterator``````

#### Return

Libraries.Containers.Iterator: the results for the correlation.

### GetStatisticalFormatting()

#### Return

Libraries.Compute.Statistics.Reporting.StatisticsFormatting

### IsEmptyColumns()

This action returns a boolean value, true if the container is empty and false if it contains any items.

#### Return

boolean: Returns true when the container is empty and false when it is no

### RemoveColumn(integer column)

This action removes the first occurrence of an item that is found in the Addable object.

#### Return

boolean: Returns true if the item was removed and false if it was not remove

### RemoveColumnAt(integer index)

This action removes an item from an indexed object and returns that item.