admin管理员组

文章数量:1291103

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.

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.

Share Improve this question asked Feb 13 at 15:04 OriolOriol 112 bronze badges 1
  • see comment to previous question stackoverflow/questions/79382081/… – Josef Commented Feb 13 at 19:14
Add a comment  | 

1 Answer 1

Reset to default 0

This is currently a bug in statsmodels.

work around: assign svar_results.k_exog_user = 0 before calling summary

本文标签: pythonAttributeError 39SVARResults39 object has no attribute 39kexoguser39Stack Overflow