All problems
Communality and Uniqueness
Problem
Return [communality, uniqueness] = [sum of squared loadings, 1 - sum of squared loadings] for a variable's factor loadings. Return [0.0, 1.0] for empty input.
Hint
Communality is the variance a variable shares with the factors.
Test cases
case 1
in: [[0.8,0.5]]
expected: [0.8900000000000001,0.10999999999999988]
case 2
in: [[1,0]]
expected: [1,0]
case 3
in: [[0,0]]
expected: [0,1]
case 4
in: [[]]
expected: [0,1]
case 5
in: [[0.6,0.6,0.6]]
expected: [1.08,-0.08000000000000007]
Starter codePython
def communality_uniqueness(loadings):
# Your code here
pass5 test cases · run your code against them in the editor