[Python] AttributeError: 'SVARResults' object has no attribute 'k_exog_user'

Discussão em 'Python' iniciado por Stack, Fevereiro 13, 2025.

  1. Stack

    Stack Membro Participativo

    I am using the following code to conduct a SVAR estimation:

    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()


    but it keeps crashing, always the same kind of error:

    `self.summary = self.make()`


    buf.write(self._coef_table() + '\n')

    dim = k * model.k_ar + model.k_trend + model.k_exog_user

    AttributeError: 'SVARResults' object has no attribute 'k_exog_user'

    I tried to change the matrices A and B, the type of SVAR and including optional parameters, but stil does not work.

    Continue reading...

Compartilhe esta Página