All problems
Hausman Test Lite
Problem
Return the Hausman-style statistic (b_fe - b_re)^2 / (se_fe^2 - se_re^2) comparing fixed and random effects estimates. Return 0.0 when the variance difference is not positive.
Hint
Large values suggest the random effects estimator is inconsistent.
Test cases
case 1
in: [1.2,1,0.3,0.2]
expected: 0.7999999999999998
case 2
in: [1,1,0.5,0.5]
expected: 0
case 3
in: [0.5,0.3,0.2,0.1]
expected: 1.3333333333333333
case 4
in: [1,2,0.2,0.1]
expected: 33.33333333333333
case 5
in: [0,0,0.1,0.05]
expected: 0
Starter codePython
def hausman_lite(b_fe, b_re, se_fe, se_re):
# Your code here
pass5 test cases · run your code against them in the editor