Repository navigation
Closed
Description
This has been happening silently during test_arma_order_select_ic due to the broad except inside model.py. I found this when looking at the Hinv issue. The solution seems to be to ensure P is fortran contiguous
dcomplex[::1,:] P = asfortranarray(dot(pinv(identity(r**2)-kron(T_mat, T_mat)),
dot(R_mat,R_mat.T).ravel('F')).reshape(r,r, order='F'))
The ValueError was occurring during the attempt to compute the hessian, and was caught.
The traceback is
Traceback (most recent call last):
File "C:\git\statsmodels\statsmodels\base\model.py", line 447, in fit
H = -1 * self.hessian(xopt)
File "C:\git\statsmodels\statsmodels\tsa\arima_model.py", line 593, in hessian
return approx_hess_cs(params, self.loglike, args=(False,))
File "C:\git\statsmodels\statsmodels\tools\numdiff.py", line 243, in approx_hess_cs
**kwargs)).imag/2./hess[i, j]
File "C:\git\statsmodels\statsmodels\tsa\arima_model.py", line 776, in loglike
return self.loglike_kalman(params, set_sigma2)
File "C:\git\statsmodels\statsmodels\tsa\arima_model.py", line 786, in loglike_kalman
return KalmanFilter.loglike(params, self, set_sigma2)
File "C:\git\statsmodels\statsmodels\tsa\kalmanf\kalmanfilter.py", line 666, in loglike
R_mat, T_mat)
File "statsmodels\tsa\kalmanf\kalman_loglike.pyx", line 359, in statsmodels.tsa.kalmanf.kalman_loglike.kalman_loglike_complex (statsmodels/tsa/kalmanf/kalman_loglike.c:6432)
v, F, loglikelihood = kalman_filter_complex(y,k,p,q,r,nobs,Z_mat,R_mat,T_mat)
File "statsmodels\tsa\kalmanf\kalman_loglike.pyx", line 229, in statsmodels.tsa.kalmanf.kalman_loglike.kalman_filter_complex (statsmodels/tsa/kalmanf/kalman_loglike.c:4956)
dot(R_mat,R_mat.T).ravel('F')).reshape(r,r, order='F'))
File "statsmodels\tsa\kalmanf\stringsource", line 644, in View.MemoryView.memoryview_cwrapper (statsmodels/tsa/kalmanf/kalman_loglike.c:14545)
File "statsmodels\tsa\kalmanf\stringsource", line 345, in View.MemoryView.memoryview.__cinit__ (statsmodels/tsa/kalmanf/kalman_loglike.c:10820)
ValueError: ndarray is not Fortran contiguous
Activity
bashtage commentedon Jul 6, 2016
@ChadFulton This might be up your alley to verify.
TST: Add test for PD hessian
ChadFulton commentedon Jul 6, 2016
What you have looks right to me. I guess the original code had a misunderstanding about the effect of
order='F'inreshape.ChadFulton commentedon Jul 6, 2016
Yes, I see that the problem is fixed in the
# initial variancecomputation (lines 73-74) in the same way that you have there.TST: Add test for PD hessian
TST: Add test for PD hessian
add basic distributed_estimation notebook