计算此统计测试时无法理解问题
ljung_box_results = sm.stats.acorr_ljungbox(arima_fit1.resid)
fig, ax = plt.subplots(1, figsize=(10, 6))
sns.scatterplot(x=range(len(ljung_box_results)), y=ljung_box_results.iloc [:, 1], ax=ax)
ax.axhline(0.05, ls='--', color='red')
ax.set(title=f"Ljung-Box test results (after modeling {ticker8} stock prices)", xlabel='Lags', ylabel='p-value')
我遇到的错误是:
AttributeError Traceback (most recent call last)
/var/folders/1l/x64tmr_d4yg4qr9l0kcplqdm0000gn/T/ipykernel_17122/3984955723.py in <module>
3 ljung_box_results = sm.stats.acorr_ljungbox(arima_fit1.resid)
4 fig, ax = plt.subplots(1, figsize=(10, 6))
----> 5 sns.scatterplot(x=range(len(ljung_box_results)), y=ljung_box_results.iloc [:, 1], ax=ax)
6 ax.axhline(0.05, ls='--', color='red')
7 ax.set(title=f"Ljung-Box test results (after modeling {ticker8} stock prices)", xlabel='Lags', ylabel='p-value')
AttributeError: 'tuple' object has no attribute 'iloc'
ljung_box_results = sm.stats.acorr_ljungbox(arima_fit1.resid)
fig, ax = plt.subplots(1, figsize=(10, 6))
sns.scatterplot(x=range(len(ljung_box_results)), y=ljung_box_results.iloc [:, 1], ax=ax)
ax.axhline(0.05, ls='--', color='red')
ax.set(title=f"Ljung-Box test results (after modeling {ticker8} stock prices)", xlabel='Lags', ylabel='p-value')
The error I'm getting is:
AttributeError Traceback (most recent call last)
/var/folders/1l/x64tmr_d4yg4qr9l0kcplqdm0000gn/T/ipykernel_17122/3984955723.py in <module>
3 ljung_box_results = sm.stats.acorr_ljungbox(arima_fit1.resid)
4 fig, ax = plt.subplots(1, figsize=(10, 6))
----> 5 sns.scatterplot(x=range(len(ljung_box_results)), y=ljung_box_results.iloc [:, 1], ax=ax)
6 ax.axhline(0.05, ls='--', color='red')
7 ax.set(title=f"Ljung-Box test results (after modeling {ticker8} stock prices)", xlabel='Lags', ylabel='p-value')
AttributeError: 'tuple' object has no attribute 'iloc'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论