time-series - python中Arch和GARCH模型的问题
问题描述
我正在尝试对 Apple 数据进行研究,以获得有关数据集波动性和方差的更多信息。我的想法是使用 Garch 和 Arch 模型。但是,当用训练好的部分进行预测时,结果没有逻辑。
from arch import arch_model
n_test = 100
train, test = AAPL[:-n_test], AAPL[-n_test:]
model = arch_model(train, mean='Zero', vol='ARCH', p = 20)
model_fit = model.fit()
我用 ARCH 模型拟合模型,当我做预测时
import matplotlib.pyplot as plt
yhat =model_fit.forecast(horizon=n_test)
var = [i*0.01 for i in range(0,100)]
plt.plot(var[-n_test:])
plt.plot(yhat.variance.values[-1, :])
plt.show()
解决方案
推荐阅读
- sql-server - 从备份还原时,源数据库中的数据库状态是否会带入新数据库?
- bash - Pass variable from YAD slider bar whenever slider is moved, without clicking Ok
- rethinkdb - rethinkdb,我怎样才能通过一个值特别是“数组索引”来提取结果?
- c++ - remapBilinear 中的断言失败 (!ssize.empty())
- reactjs - 在我的 redux 传奇中调用两个 api 异步,我需要来自第一个响应的数据来调用第二个 api
- visual-studio - MSVC 与工具集
- r - 根据分组条件从数据框中选择行
- jquery - 发布包含许多选择列表输入的表单数据不发布任何内容
- kotlin - 在最后插入 observable 之后,switchOnNext 运算符不会为订阅发出
- apache-kafka - 在 Apache Kafka 中记录主题数据时使用 log.retention.bytes 参数的困惑