All problems
BIC Difference
Problem
Return BIC2 - BIC1, where BIC = -2*log_likelihood + k*ln(n). Return 0.0 when n <= 0. Negative values favor the second model.
Hint
The penalty k*ln(n) grows with the sample size.
Test cases
case 1
in: [-100,2,-110,5,100]
expected: 33.8155105579643
case 2
in: [-50,1,-50,1,10]
expected: 0
case 3
in: [-10,3,-12,2,50]
expected: 0.0879769945718536
case 4
in: [-200,10,-180,10,1000]
expected: -40
case 5
in: [-5,0,-6,0,5]
expected: 2
Starter codePython
import math
def bic_difference(ll1, k1, ll2, k2, n):
# Your code here
pass5 test cases · run your code against them in the editor