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
1 Answer
Reset to default 0This 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
版权声明:本文标题:python - AttributeError: 'SVARResults' object has no attribute 'k_exog_user' - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741526125a2383474.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论