1

I am using the following code to conduct a SVAR estimation but it keeps crashing, always the same kind of error:

len(A_guess) != n_masked_a: TypeError: object of type 'int' has no len().

CAN ANYONE HELP?

`data_q = pd.DataFrame({'GDP': GDP,
                       'CPI': CPI_q, 
                       'Interest_rate': Interest_rate_q, 
                       'Unemployment_rate': Unemployment_rate_q, 
                       'Yearly_inflation': Yearly_inflation_q}).dropna()

#SVAR model
A = np.array([
    [1, 0, 0, 0],
    ['E', 1, 0, 0],
    ['E', 'E', 1, 0],
    ['E', 'E', 'E', 1]
])
B = np.array([
    [1, 0, 0, 0],
    ['E', 1, 0, 0],
    ['E', 'E', 1, 0],
    ['E', 'E', 'E', 1]
])

endogenous_vars = ['GDP', 'Interest_rate', 'Unemployment_rate', 'Yearly_inflation']
exogenous_vars=["CPI"]

svar_model = SVAR(data_q[endogenous_vars], svar_type='AB', A=A, B=B)
svar_results = svar_model.fit(2)
print(svar_results.summary(), '\n')

irf_svar = svar_results.irf(10)
irf_svar.plot(orth=True)
plt.show()`

I tried to use the optional parameteres A_guess myself and trying to only using A or B, also using NAN and NONE instead of 'E'.

8
  • Can you include the full error? Commented Jan 23 at 17:49
  • The fit arg 2 in svar_model.fit(2) is interpreted as A_guess which is an integer instead of array and has the wrong length. A has (n_masked_a=) 6 free parameters so A_guess should be a 1 dim array with 6 elements. Commented Jan 23 at 20:28
  • greetings, it seems that as @Josef suggested, i should have used svar_results = svar_model.fit(maxlags=5), however, the issue i encounter now is self.summary = self.make() buf.write(self._coef_table() + '\n'), _coef_table dim = k * model.k_ar + model.k_trend + model.k_exog_user Commented Jan 24 at 10:40
  • any idea @Josef? Commented Jan 25 at 13:31
  • I don't know what your comment wants to say. I don't see an issue. Commented Jan 25 at 13:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.