snotskie / EpistemicNetworkAnalysis.jl

Native implementation of Epistemic Network Analysis written in the Julia programming language. Based on rENA 0.2.0.1.
https://snotskie.github.io/EpistemicNetworkAnalysis.jl/
GNU General Public License v3.0
6 stars 2 forks source link

document group-wise tests on non-grouped rotations #60

Open snotskie opened 7 months ago

snotskie commented 7 months ago

Add an example page, like cross validation, to document how to perform group-wise tests on non-grouped rotations, like SVD, as well as say in a sentence why these tests are not automatically run (because the rotation does not know what to group by)

This can be based on how it's done in AbstractGroupDifference already

import HypothesisTests: KruskalWallisTest, VarianceEqualityTest
import EpistemicNetworkAnalysis: GroupwiseCoregistrationTest, test!
function addGroupedTests!(model, groupVar)

    # Parameters used by EpistemicNetworkAnalysis.jl to determine which version of test! to run
    M = typeof(model)
    trainmodel = model
    testmodel = model
    tests = [GroupwiseCoregistrationTest, KruskalWallisTest, VarianceEqualityTest]

    # Find group labels
    groups = sort(unique(trainmodel.metadata[!, groupVar]))

    # Run tests on each axis
    for i in 1:nrow(testmodel.embedding)
        for test in tests
            test!(M, trainmodel, testmodel, test, dim=i, groupVar=groupVar, groups=groups)
        end
    end
end