2016-10-07 4 views
0

그래서 resudual에서 box-ljung 테스트를 시도하고 있는데 이상한 오류가 발생하여 이유를 파악할 수 없습니다.acsmr_ljungbox in statsmodel

x = diag.acorr_ljungbox(np.random.random(20)) 

나는 또한 임의의 배열과 같은 일을 여전히 같은 오류를 시도 :

ValueError: operands could not be broadcast together with shapes (19,) (40,) 
+0

주변 코드 –

+0

게시 할 수 있습니까? 문제는 기본적으로 지연 = 40이고 배열이 그보다 짧기 때문입니다. 명시 적으로 지연을 설정하면 해결됩니다. 아래 답변을 참조하십시오 –

답변

0

이 길이의 40 독립적으로 설정되는 기본 지연 설정의 버그처럼 보인다 데이터의

해결 방법 및 적절한 통계를 얻으려면 lags을 제한해야합니다. 예 : 아래 5 단계를 사용합니다.

>>> from statsmodels.stats import diagnostic as diag 

>>> diag.acorr_ljungbox(np.random.random(50))[0].shape 
(40,) 

>>> diag.acorr_ljungbox(np.random.random(20), lags=5) 
(array([ 0.36718151, 1.02009595, 1.23734092, 3.75338034, 4.35387236]), 
array([ 0.54454461, 0.60046677, 0.74406305, 0.44040973, 0.49966951])) 
+0

이것은 이제 여기에보고됩니다 https://github.com/statsmodels/statsmodels/issues/3229 – user333700