All problems
Invariance Delta
Problem
Return the change in chi-square per degree of freedom between two nested measurement models: (chi2_metric - chi2_config)/(df_metric - df_config). Return 0.0 when the degrees-of-freedom difference is not positive.
Hint
A large chi-square change per df signals that the constraint hurts fit.
Test cases
case 1
in: [30,10,45,15]
expected: 3
case 2
in: [30,10,30,10]
expected: 0
case 3
in: [20,8,40,18]
expected: 2
case 4
in: [50,20,45,25]
expected: -1
case 5
in: [10,5,30,4]
expected: 0
Starter codePython
def invariance_delta(chi2_config, df_config, chi2_metric, df_metric):
# Your code here
pass5 test cases · run your code against them in the editor