Discussion:
[pystatsmodels] sirf_errband_mc / error message
김민
2018-09-30 06:11:55 UTC
Permalink
Hi,

I get error message when I try to find error band of my SVAR model. "shape
mismatch: value array of shape (0,) could not be broadcast to indexing
result of shape (0,4,4)" Can you guys help me out?



ValueError Traceback (most recent call last)<ipython-input-208-fd4534490cf8> in <module>()----> 1 result.sirf_errband_mc(orth=False, repl=1000, T=10,signif=0.05, seed=None, burn=100, cum=False)
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in sirf_errband_mc(self, orth, repl, T, signif, seed, burn, cum) 721 if i < 10: 722 sol = SVAR(sim, svar_type=s_type, A=A_pass,--> 723 B=B_pass).fit(maxlags=k_ar) 724 g_list.append(np.append(sol.A[A_mask].tolist(), 725 sol.B[B_mask].tolist()))
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in fit(self, A_guess, B_guess, maxlags, method, ic, trend, verbose, s_method, solver, override, maxiter, maxfun) 183 return self._estimate_svar(start_params, lags, trend=trend, 184 solver=solver, override=override,--> 185 maxiter=maxiter, maxfun=maxfun) 186 187
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in _estimate_svar(self, start_params, lags, maxiter, maxfun, trend, solver, override) 253 solver=solver, 254 maxiter=maxiter,--> 255 maxfun=maxfun) 256 A_mask = self.A_mask 257 B_mask = self.B_mask
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in _solve_AB(self, start_params, maxiter, maxfun, override, solver) 357 A_len = len(A[A_mask]) 358 --> 359 A[A_mask] = start_params[:A_len] 360 B[B_mask] = start_params[A_len:] 361
ValueError: shape mismatch: value array of shape (0,) could not be broadcast to indexing result of shape (0,4,4)
j***@gmail.com
2018-09-30 12:10:18 UTC
Permalink
Post by 김민
Hi,
I get error message when I try to find error band of my SVAR model. "shape
mismatch: value array of shape (0,) could not be broadcast to indexing
result of shape (0,4,4)" Can you guys help me out?
What is your A or your A_mask matrix?

From the traceback it looks like that there are no unknown parameters in A
and that "empty" case is not handled correctly, or numpy became more picky
since this was written.
AFAIR, there are no unit tests for this.

Can you make a reproducible example?
I guess the problem is not data specific, so the example doesn't need to
use your own data, but I guess should have the same A, and maybe B matrices.

Josef
Post by 김민
ValueError Traceback (most recent call last)<ipython-input-208-fd4534490cf8> in <module>()----> 1 result.sirf_errband_mc(orth=False, repl=1000, T=10,signif=0.05, seed=None, burn=100, cum=False)
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in sirf_errband_mc(self, orth, repl, T, signif, seed, burn, cum) 721 if i < 10: 722 sol = SVAR(sim, svar_type=s_type, A=A_pass,--> 723 B=B_pass).fit(maxlags=k_ar) 724 g_list.append(np.append(sol.A[A_mask].tolist(), 725 sol.B[B_mask].tolist()))
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in fit(self, A_guess, B_guess, maxlags, method, ic, trend, verbose, s_method, solver, override, maxiter, maxfun) 183 return self._estimate_svar(start_params, lags, trend=trend, 184 solver=solver, override=override,--> 185 maxiter=maxiter, maxfun=maxfun) 186 187
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in _estimate_svar(self, start_params, lags, maxiter, maxfun, trend, solver, override) 253 solver=solver, 254 maxiter=maxiter,--> 255 maxfun=maxfun) 256 A_mask = self.A_mask 257 B_mask = self.B_mask
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in _solve_AB(self, start_params, maxiter, maxfun, override, solver) 357 A_len = len(A[A_mask]) 358 --> 359 A[A_mask] = start_params[:A_len] 360 B[B_mask] = start_params[A_len:] 361
ValueError: shape mismatch: value array of shape (0,) could not be broadcast to indexing result of shape (0,4,4)
j***@gmail.com
2018-09-30 12:13:24 UTC
Permalink
Post by j***@gmail.com
Post by 김민
Hi,
I get error message when I try to find error band of my SVAR model.
"shape mismatch: value array of shape (0,) could not be broadcast to
indexing result of shape (0,4,4)" Can you guys help me out?
What is your A or your A_mask matrix?
From the traceback it looks like that there are no unknown parameters in A
and that "empty" case is not handled correctly, or numpy became more picky
since this was written.
AFAIR, there are no unit tests for this.
Can you make a reproducible example?
I guess the problem is not data specific, so the example doesn't need to
use your own data, but I guess should have the same A, and maybe B matrices.
I just saw that you opened an issue already. It's better to discuss,
comment on the details in the issue than mailing list.
Post by j***@gmail.com
Josef
Post by 김민
ValueError Traceback (most recent call last)<ipython-input-208-fd4534490cf8> in <module>()----> 1 result.sirf_errband_mc(orth=False, repl=1000, T=10,signif=0.05, seed=None, burn=100, cum=False)
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in sirf_errband_mc(self, orth, repl, T, signif, seed, burn, cum) 721 if i < 10: 722 sol = SVAR(sim, svar_type=s_type, A=A_pass,--> 723 B=B_pass).fit(maxlags=k_ar) 724 g_list.append(np.append(sol.A[A_mask].tolist(), 725 sol.B[B_mask].tolist()))
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in fit(self, A_guess, B_guess, maxlags, method, ic, trend, verbose, s_method, solver, override, maxiter, maxfun) 183 return self._estimate_svar(start_params, lags, trend=trend, 184 solver=solver, override=override,--> 185 maxiter=maxiter, maxfun=maxfun) 186 187
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in _estimate_svar(self, start_params, lags, maxiter, maxfun, trend, solver, override) 253 solver=solver, 254 maxiter=maxiter,--> 255 maxfun=maxfun) 256 A_mask = self.A_mask 257 B_mask = self.B_mask
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in _solve_AB(self, start_params, maxiter, maxfun, override, solver) 357 A_len = len(A[A_mask]) 358 --> 359 A[A_mask] = start_params[:A_len] 360 B[B_mask] = start_params[A_len:] 361
ValueError: shape mismatch: value array of shape (0,) could not be broadcast to indexing result of shape (0,4,4)
Min
2018-09-30 21:00:24 UTC
Permalink
Hi Josef,

Thank you for your reply. I will make a comment in the issues.

Min
Post by j***@gmail.com
Post by j***@gmail.com
Post by 김민
Hi,
I get error message when I try to find error band of my SVAR model.
"shape mismatch: value array of shape (0,) could not be broadcast to
indexing result of shape (0,4,4)" Can you guys help me out?
What is your A or your A_mask matrix?
From the traceback it looks like that there are no unknown parameters in
A and that "empty" case is not handled correctly, or numpy became more
picky since this was written.
AFAIR, there are no unit tests for this.
Can you make a reproducible example?
I guess the problem is not data specific, so the example doesn't need to
use your own data, but I guess should have the same A, and maybe B matrices.
I just saw that you opened an issue already. It's better to discuss,
comment on the details in the issue than mailing list.
Post by j***@gmail.com
Josef
Post by 김민
ValueError Traceback (most recent call last)<ipython-input-208-fd4534490cf8> in <module>()----> 1 result.sirf_errband_mc(orth=False, repl=1000, T=10,signif=0.05, seed=None, burn=100, cum=False)
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in sirf_errband_mc(self, orth, repl, T, signif, seed, burn, cum) 721 if i < 10: 722 sol = SVAR(sim, svar_type=s_type, A=A_pass,--> 723 B=B_pass).fit(maxlags=k_ar) 724 g_list.append(np.append(sol.A[A_mask].tolist(), 725 sol.B[B_mask].tolist()))
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in fit(self, A_guess, B_guess, maxlags, method, ic, trend, verbose, s_method, solver, override, maxiter, maxfun) 183 return self._estimate_svar(start_params, lags, trend=trend, 184 solver=solver, override=override,--> 185 maxiter=maxiter, maxfun=maxfun) 186 187
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in _estimate_svar(self, start_params, lags, maxiter, maxfun, trend, solver, override) 253 solver=solver, 254 maxiter=maxiter,--> 255 maxfun=maxfun) 256 A_mask = self.A_mask 257 B_mask = self.B_mask
~\Anaconda3\lib\site-packages\statsmodels\tsa\vector_ar\svar_model.py in _solve_AB(self, start_params, maxiter, maxfun, override, solver) 357 A_len = len(A[A_mask]) 358 --> 359 A[A_mask] = start_params[:A_len] 360 B[B_mask] = start_params[A_len:] 361
ValueError: shape mismatch: value array of shape (0,) could not be broadcast to indexing result of shape (0,4,4)
Loading...