Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-229

Chi-Square/df and RMSEA

Problem

Return [chi2/df, rmsea] with rmsea = sqrt(max(chi2 - df, 0)/(df*(n-1))). Return [0.0, 0.0] when df <= 0 or n <= 1.

Hint

RMSEA rewards parsimony because it divides by the degrees of freedom.

Test cases

case 1
in: [30,10,200]
expected: [3,0.1002509414234171]
case 2
in: [5,10,100]
expected: [0.5,0]
case 3
in: [60,20,500]
expected: [3,0.06330889378329184]
case 4
in: [0,5,100]
expected: [0,0]
case 5
in: [30,0,100]
expected: [0,0]
Starter codePython
def chi2_rmsea(chi2, df, n):
    # Your code here
    pass

5 test cases · run your code against them in the editor