1

Scipy には、配列を使用して適合度を計算するかなり優れた方法があります。

import scipy, scipy.stats.chisquare

observed_values=scipy.array([1,1]) 
expected_values=scipy.array([2,2]) 

chisquare(observed_values, f_exp=expected_values)

def chisquare(observed_values,expected_values): #Calculating the value for the test statistic,x^2
    test_statistic=0
    for observed, expected in zip(observed_values, expected_values):
        test_statistic+=(float(observed)-float(expected))**2/float(expected)
        return test_statistic

これ以外に、一般的な適合度をテストする別の方法はありますか?

4

0 に答える 0