phillips_drifts_volatilities: `kalman_forward` pairs each observation with the previous date's volatility

未关闭 适合新手
#1,108 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@bennibyx 已经在做这个了。

开始于 2026年11月9日。

  • #1116 来自 @bennibyx —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
77/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
numpy, python

调研方向

找到 kalman_forward,检查它如何根据波动率路径 h 构造 r;issue 指出了当前的索引方式以及预期的 h[1:] 对齐方式。阅读构造 h 的 sampler 代码和 filter 循环,确认日期 1 到 T 与观测值对齐。每个观测值使用同一日期的波动率,并且有针对性的检查确认使用了最后一行波动率时,即为完成。

由索引模型根据 Issue 内容生成。

描述

kalman_forward builds r from the whole volatility path h, whose rows are dates 0 to T: run_sampler starts it with T + 1 rows, and draw_volatility_path updates log h_0 to log h_T. The filter's loop then uses r[t] for y[t], the observation at date t + 1, so each observation is filtered with R built from the previous date's volatility: R_1 comes from h_0, and h_T is never used. The rest of the sampler pairs h[t] with date t: draw_volatility_path matches h[t] with the residual at date t, draw_β standardises the residuals by h[1:], and the retained draws keep h[1:]. The model is R_t = B^{-1} H_t B^{-1}′ at the same date, which is also what the line's own comment (# R_1, ..., R_T) says.

This came in with the vectorised filter in #1105. The version before it paired h[t] with y[t - 1] in draw_coefficient_path.

The change is to build r from h[1:]:

r = np.einsum('ij,tj,kj->tik', b_inverse, h[1:], b_inverse)    # R_1, ..., R_T

The size of the effect on the posterior has not been measured: the figures and tables would need re-running with the change.

Found by Copilot's review of QuantEcon/lectures#36, which copies this lecture at 4d82fff: https://github.com/QuantEcon/lectures/pull/36#discussion_r4464453856

主要语言
TeX
星标
129
派生
59
平均合并
2 天 10 小时
30 天内合并 PR
11

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

QuantEcon/lecture-python.myst 的其他 Issue

查看 QuantEcon/lecture-python.myst 的全部 Issue

相似的 Issue

更多 Data Engineering Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。