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

Aperta Adatta ai principianti
#1,108 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@bennibyx ci sta già lavorando.

Dal 9/11/2026.

  • #1116 di @bennibyx — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
77/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
numpy, python

Direzione di ricerca

Trova kalman_forward e controlla come costruisce r a partire dal percorso di volatilità h; l’issue indica l’indicizzazione attuale e l’allineamento previsto di h[1:]. Leggi il codice del sampler che costruisce h e il ciclo del filtro per confermare che le date da 1 a T siano allineate con le osservazioni. Il lavoro è completato quando ogni osservazione usa la volatilità della stessa data e un controllo mirato conferma che viene usata l’ultima riga di volatilità.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TeX
Stelle
129
Fork
59
Merge medio
2g 10h
PR unite (30g)
11

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di QuantEcon/lecture-python.myst

Tutte le issue di QuantEcon/lecture-python.myst

Issue simili

Altre issue su Data Engineering

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.