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

Abierto Apto para principiantes
#1,108 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@bennibyx ya está trabajando en esto.

Desde el 9/11/2026.

  • #1116 de @bennibyx — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
77/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
numpy, python

Línea de trabajo

Busca kalman_forward e inspecciona cómo construye r a partir de la trayectoria de volatilidad h; el issue identifica el indexado actual y la alineación prevista de h[1:]. Lee el código del sampler que construye h y el bucle del filtro para confirmar que las fechas de 1 a T se alinean con las observaciones. Se considera terminado cuando cada observación usa la volatilidad de la misma fecha y una comprobación específica confirma que se usa la última fila de volatilidad.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
TeX
Estrellas
129
Forks
59
Merge medio
2 d 10 h
PR fusionados (30 d)
11

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de QuantEcon/lecture-python.myst

Todos los issues de QuantEcon/lecture-python.myst

Issues similares

Más issues de Data Engineering

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.