Libraries.Compute.Statistics.Tests.CompareVariances Documentation

This class implements several tests: CompareSeveralVariances is a Levene's Homogeneity Test Check that several groups vary in the same way using the mean For more information: https://en.wikipedia.org/wiki/Levene%27s_test CompareSeveralVariances is a Brown–Forsythe Extension of Levene's Homogeneity Test Check that several groups vary in the same way using the median or trimmed mean For more information: https://en.wikipedia.org/wiki/Brown%E2%80%93Forsythe_test CompareSeveralRelatedVariances is a Mauchly's Sphericity Test Check that several groups vary in the same way when there are repeated measures. For more information: https://en.wikipedia.org/wiki/Mauchly%27s_sphericity_test _________________ is a Bartlett’s Test for Homogeneity of Variances (sensitive to non-normality) Check that several groups vary in the same way if all are normally distributed For more information: https://en.wikipedia.org/wiki/Bartlett%27s_test For more information: https://www.statology.org/bartletts-test/ CompareSeveralVariances is a Box's M Test for Homogeneity of Covariances Extension of Bartlett’s Homogeneity Test (sensitive to non-normality) >> CompareCovarianceMatrices (private) Check that several multivariate groups vary in the same way if all are normally distributed For more information: https://en.wikipedia.org/wiki/Box%27s_M_test _________________ is a Conover Equal Variance Test aka Squared Ranks Test Check that several groups vary in the same way without assumptions about the distribution For more information: https://en.wikipedia.org/wiki/Squared_ranks_test

Example Code

use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CompareVariances

DataFrame frame
frame:Load("Data/Data.csv")
frame:AddSelectedColumnRange(0,3)

CompareVariances compare = frame:CompareVariances()
output compare:GetFormalSummary()

Inherits from: Libraries.Compute.Statistics.DataFrameCalculation, Libraries.Compute.Statistics.Tests.StatisticalTest, Libraries.Language.Object, Libraries.Compute.Statistics.Inputs.ColumnInput, Libraries.Compute.Statistics.Inputs.FactorInput

Actions Documentation

AddColumn(integer column)

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

Parameters

  • integer column

AddFactor(integer column)

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

Parameters

  • integer column

AssumeNormalDistribution(boolean assume)

Used in independent-sample tests

Parameters

  • boolean assume

Calculate(Libraries.Compute.Statistics.DataFrame frame)

Used if trimmed mean calculation is necessary

Parameters

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)

CompareSeveralRelatedVariances(Libraries.Compute.Statistics.DataFrame frame)

Mauchly's Sphericity Test for variance of differences equality (sphericity). Assumptions: 1. Samples are dependent If not dependent: Use Levene's Test > CompareVariances:CompareIndependentVariances Null hypothesis: The variances of the differences are equal across all samples Alternative hypothesis: At least one variance of a difference is not equal to the others.

Parameters

Example


    use Libraries.Compute.Statistics.DataFrame
    use Libraries.Compute.Statistics.Tests.CompareVariances

    DataFrame frame
    frame:Load("data.csv")
    frame:AddSelectedColumn(0)
    frame:AddSelectedFactor(1)

    CompareVariances compare = frame:CompareRelatedVariances()
    output compare:GetFormalSummary()

CompareSeveralVariances(Libraries.Compute.Statistics.DataFrame frame)

This action tests for variance equality (homogeneity) for 2 or more independent samples. It is commonly used with an ANOVA in CompareMeans. It conducts the following tests: Brown-Forsythe Test > CompareVariances:UseMedianAsCenter() or UseTrimmedMeanAsCenter(0.05) Levene's Test > CompareVariances:UseMeanAsCenter() Assumptions: 1. Samples are independent If not independent: Use Mauchly's Sphericity Test > CompareVariances:CompareSeveralRelatedVariances Null hypothesis: The variances are equal across all samples Alternative hypothesis: At least one variance is not equal to the others.

Parameters

Example


    use Libraries.Compute.Statistics.DataFrame
    use Libraries.Compute.Statistics.Tests.CompareVariances

    DataFrame frame
    frame:Load("data.csv")
    frame:AddSelectedColumnRange(0,2)

    CompareVariances compare = frame:CompareVariances()
    output compare:GetFormalSummary()

EmptyColumns()

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

EmptyFactors()

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

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)

GetChart()

Return

Libraries.Interface.Controls.Charts.BoxPlot: an array of CompareVariancesResult objects

Example

use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CompareVariances
    
DataFrame frame
frame:Load("Data/Data.csv")
    
CompareVariances compare
compare:AddColumn(0)
compare:AddColumn(1)
compare:AddColumn(2)
frame:Calculate(compare)

Array<CompareVariancesResult> results = compare:GetResults()

GetColumn(integer index)

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

Parameters

  • integer index

Return

integer: The item at the given location.

GetColumnIterator()

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

Return

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

GetColumnSize()

This action gets the size of the array.

Return

integer:

GetDegreesOfFreedom()

This returns the degrees of freedom if only one result exists.

Return

number: the Degrees of Freedom.

GetEffectSize()

This returns the effect size if only one result exists.

Return

number: the effect size.

GetExperimentalDesign()

GetFactor(integer index)

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

Parameters

  • integer index

Return

integer: The item at the given location.

GetFactorIterator()

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

Return

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

GetFactorSize()

This action gets the size of the array.

Return

integer:

GetFormalSummary()

This action summarizes the results and places them into formal academic language, in APA format. For more information: https://apastyle.apa.org/instructional-aids/numbers-statistics-guide.pdf

Return

text: a condensed formal result of the test

Example

use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CompareVariances
    
DataFrame frame
frame:Load("Data/Data.csv")
    
CompareVariances compare
compare:Add(0)
compare:Add(1)
frame:Calculate(compare)

output compare:GetFormalSummary()

GetGroups(Libraries.Compute.Statistics.DataFrame frame)

Gets the the fully factored samples/groups in an array of dataframes. Using an array of dataframes instead of a single dataframe helps with multivariate cases.

Parameters

Return

Libraries.Containers.HashTable:

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()

GetProbabilityValue()

This returns the probability if only one result exists.

Return

number: the P-Value.

GetReport(Libraries.System.File file)

Example

use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CompareVariances
    
DataFrame frame
frame:Load("Data/Data.csv")
    
CompareVariances compare
compare:Add(0)
compare:Add(1)
frame:Calculate(compare)

DataFrame result = compare:GetSummaryDataFrame()
result:Save("myresult.csv")

GetResult()

This returns a result if only one exists.

Return

Libraries.Compute.Statistics.Reporting.CompareVariancesResult: the CompareVariancesResult object

Example

use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CompareVariances
    
DataFrame frame
frame:Load("Data/Data.csv")

CompareVariances compare
compare:AddColumn(0)
compare:AddColumn(1)
compare:Calculate(frame)

CompareVariancesResult result = compare:GetResult()

GetResults()

Return

Libraries.Containers.Array: an array of CompareVariancesResult objects

Example

use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CompareVariances
    
DataFrame frame
frame:Load("Data/Data.csv")
    
CompareVariances compare
compare:AddColumn(0)
compare:AddColumn(1)
compare:AddColumn(2)
frame:Calculate(compare)

Array<CompareVariancesResult> results = compare:GetResults()

GetSignificanceLevel()

A list of unique items of the factor

Return

number:

GetStatisticalFormatting()

GetSummary()

Return

text: a list of the important statistics of the test

Example

use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CompareVariances
    
DataFrame frame
frame:Load("Data/Data.csv")
    
CompareVariances compare
compare:Add(0)
compare:Add(1)
frame:Calculate(compare)

output compare:GetSummary()

GetSummaryDataFrame()

Return

Libraries.Compute.Statistics.DataFrame: a DataFrame of the important statistics of the test

Example

use Libraries.Compute.Statistics.DataFrame
use Libraries.Compute.Statistics.Tests.CompareVariances
    
DataFrame frame
frame:Load("Data/Data.csv")
    
CompareVariances compare
compare:Add(0)
compare:Add(1)
frame:Calculate(compare)

DataFrame result = compare:GetSummaryDataFrame()
result:Save("myresult.csv")

GetTestStatistic()

This returns the test statistic if only one result exists.

Return

number: the test statistic.

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

IsEmptyFactors()

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

RemoveColumn(integer column)

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

Parameters

  • integer column

Return

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

RemoveColumnAt(integer index)

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

Parameters

  • integer index

RemoveFactor(integer column)

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

Parameters

  • integer column

Return

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

RemoveFactorAt(integer index)

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

Parameters

  • integer index

RepeatedMeasures(boolean repeatedMeasures)

Used in dependent-sample tests

Parameters

  • boolean repeatedMeasures

SetExperimentalDesign(Libraries.Compute.Statistics.Tests.ExperimentalDesign design)

https://www.originlab.com/doc/en/UserGuide/UserGuide/Algorithms_(Repeated_Measures_ANOVA).html

Parameters

SetSignificanceLevel(number significanceLevel)

Sets the significance level of the test (default is 0.05).

Parameters

  • number significanceLevel: the significance level between 0 and 1.

SetStatisticalFormatting(Libraries.Compute.Statistics.Reporting.StatisticsFormatting formatting)

Create a new frame based on that list

Parameters

UseMeanAsCenter()

Used in independent-sample tests

UseMedianAsCenter()

Used in independent-sample tests

UseTrimmedMeanAsCenter(number percent)

Used in independent-sample tests

Parameters

  • number percent