SPB Git

Repository Public

var-impulse-response.ts 35.8 KB 324 lines typescript

1import type { Locale, SheetInput } from "@/schema";2import type { TemplateDef } from "../types";3import { T, doiSource, r, round } from "./shared";45/**6 * Orthogonalised impulse responses Theta_i = A^i P of a bivariate VAR(1) with hand-chosen coefficients:7 * A = [[0.5, 0.1], [0.2, 0.6]] (eigenvalues 0.7 and 0.4), P = [[1, 0], [0.5, 1]] (lower triangular).8 */9function illustrativeIrf(horizons: number) {10  const A = [[0.5, 0.1], [0.2, 0.6]];11  const P = [[1, 0], [0.5, 1]];12  const mul = (X: number[][], Y: number[][]) => X.map((row) => Y[0].map((_, j) => row.reduce((s, x, k) => s + x * Y[k][j], 0)));13  const out: number[][][] = [];14  let pow = [[1, 0], [0, 1]];15  for (let i = 0; i <= horizons; i++) { out.push(mul(pow, P)); pow = mul(pow, A); }16  return out;17}1819function build(locale: Locale): SheetInput {20  const t = T(locale);21  const irf = illustrativeIrf(12);22  const series = (row: number, col: number) => irf.map((m, i) => ({ x: i, y: round(m[row][col], 4) }));23  return {24    schemaVersion: 1,25    metadata: {26      title: t("Vecteurs autorégressifs et fonctions de réponse impulsionnelle", "Vector autoregressions and impulse response functions"),27      locale,28      summary: t(29        "Du VAR sous forme réduite aux réponses à un choc structurel : stabilité, représentation moyenne mobile, problème d'identification, décomposition de Cholesky et bandes de confiance.",30        "From the reduced-form VAR to responses to a structural shock: stability, moving-average representation, the identification problem, Cholesky decomposition and confidence bands.",31      ),32      topics: [t("Économétrie", "Econometrics"), t("Macroéconomie", "Macroeconomics"), t("Séries temporelles", "Time series")],33      tags: ["VAR", "SVAR", t("réponse impulsionnelle", "impulse response"), "Cholesky", t("identification", "identification"), t("matrice compagnon", "companion matrix")],34      level: "advanced",35      kind: "explainer",36      objectives: [37        t("Écrire un VAR(p) sous forme réduite et vérifier sa stabilité à l'aide de la matrice compagnon.", "Write a reduced-form VAR(p) and check its stability with the companion matrix."),38        t("Passer à la représentation MA(∞) et calculer les coefficients $\\Phi_i$ par récurrence.", "Move to the MA(∞) representation and compute the coefficients $\\Phi_i$ recursively."),39        t("Expliquer pourquoi la forme réduite n'identifie pas les chocs structurels et ce qu'impose la décomposition de Cholesky.", "Explain why the reduced form does not identify structural shocks and what the Cholesky decomposition imposes."),40        t("Lire une fonction de réponse orthogonalisée et ses bandes de confiance.", "Read an orthogonalised impulse response and its confidence bands."),41      ],42      example: true,43    },44    theme: { preset: "finance", accent: "blue" },45    blocks: [46      { id: "title", type: "heading", level: 1, eyebrow: t("Économétrie des séries temporelles", "Time-series econometrics"), text: t("Vecteurs autorégressifs et réponses impulsionnelles", "Vector autoregressions and impulse responses") },47      {48        id: "lead", type: "paragraph", lead: true,49        text: t(50          "Un VAR traite toutes les variables comme endogènes : chacune est régressée sur les retards de toutes. Sims l'a proposé comme solution de rechange aux restrictions d'identification « incroyables » des grands modèles macroéconométriques[^sims-1980]. Le VAR décrit bien la dynamique conjointe, mais pour répondre à « que se passe-t-il après un choc ? », il faut une hypothèse de plus : l'**identification**.",51          "A VAR treats every variable as endogenous: each is regressed on the lags of all of them. Sims proposed it as an alternative to the \"incredible\" identifying restrictions of large macroeconometric models[^sims-1980]. The VAR describes the joint dynamics well, but answering \"what happens after a shock?\" takes one more assumption: **identification**.",52        ),53      },5455      { id: "sec-reduced", type: "heading", level: 2, eyebrow: t("Étape 1", "Step 1"), text: t("La forme réduite et sa stabilité", "The reduced form and its stability") },56      {57        id: "eq-var", type: "equation", span: 6, label: t("VAR(p) sous forme réduite", "Reduced-form VAR(p)"), sourceIds: ["lutkepohl-2005"],58        latex: r`y_t = c + A_1 y_{t-1} + \dots + A_p y_{t-p} + u_t, \qquad \mathbb{E}[u_t]=0,\quad \mathbb{E}[u_t u_t^\top]=\Sigma_u,\quad \mathbb{E}[u_t u_s^\top]=0\ (s\neq t)`,59        explanation: t(60          "Chaque équation a les mêmes régresseurs ; les moindres carrés ordinaires équation par équation sont alors identiques aux moindres carrés généralisés du système[^lutkepohl-2005].",61          "Every equation has the same regressors; equation-by-equation ordinary least squares then coincides with generalised least squares on the system[^lutkepohl-2005].",62        ),63        variables: [64          { symbol: r`y_t`, meaning: t("vecteur $K\\times 1$ des variables observées à la date $t$", "$K\\times 1$ vector of variables observed at date $t$") },65          { symbol: r`c`, meaning: t("vecteur $K\\times 1$ de constantes", "$K\\times 1$ vector of intercepts") },66          { symbol: r`A_j`, meaning: t("matrices $K\\times K$ de coefficients, $j=1,\\dots,p$", "$K\\times K$ coefficient matrices, $j=1,\\dots,p$") },67          { symbol: r`p`, meaning: t("nombre de retards", "number of lags") },68          { symbol: r`u_t`, meaning: t("erreurs de prévision à un pas (bruit blanc vectoriel)", "one-step-ahead forecast errors (vector white noise)") },69          { symbol: r`\Sigma_u`, meaning: t("matrice de covariance des erreurs, en général non diagonale", "covariance matrix of the errors, generally not diagonal") },70        ],71      },72      {73        id: "eq-companion", type: "equation", span: 6, label: t("Matrice compagnon et condition de stabilité", "Companion matrix and stability condition"), sourceIds: ["lutkepohl-2005"],74        latex: r`\mathbf{A} = \begin{bmatrix} A_1 & A_2 & \cdots & A_{p-1} & A_p \\ I_K & 0 & \cdots & 0 & 0 \\ 0 & I_K & \cdots & 0 & 0 \\ \vdots & & \ddots & & \vdots \\ 0 & 0 & \cdots & I_K & 0 \end{bmatrix}, \qquad \max_i \left|\lambda_i(\mathbf{A})\right| < 1`,75        explanation: t(76          "Tout VAR(p) se réécrit comme un VAR(1) de dimension $Kp$. Il est **stable** si toutes les valeurs propres de $\\mathbf{A}$ sont de module strictement inférieur à 1, ce qui équivaut à $\\det(I_K-A_1z-\\dots-A_pz^p)\\neq 0$ pour $|z|\\le 1$. Un VAR stable est stationnaire.",77          "Any VAR(p) can be rewritten as a VAR(1) of dimension $Kp$. It is **stable** if every eigenvalue of $\\mathbf{A}$ has modulus strictly below 1, which is equivalent to $\\det(I_K-A_1z-\\dots-A_pz^p)\\neq 0$ for $|z|\\le 1$. A stable VAR is stationary.",78        ),79        variables: [80          { symbol: r`\mathbf{A}`, meaning: t("matrice compagnon, de taille $Kp\\times Kp$", "companion matrix, of size $Kp\\times Kp$") },81          { symbol: r`I_K`, meaning: t("matrice identité d'ordre $K$", "identity matrix of order $K$") },82          { symbol: r`\lambda_i(\mathbf{A})`, meaning: t("valeurs propres de $\\mathbf{A}$", "eigenvalues of $\\mathbf{A}$") },83        ],84      },85      {86        id: "diagram-pipeline", type: "diagram", span: 8, kind: "flow", direction: "LR", routing: "orthogonal",87        title: t("Des données aux réponses impulsionnelles", "From data to impulse responses"),88        caption: t(89          "Les étapes en bleu ne demandent que les données ; l'étape en ambre exige une hypothèse économique que les données ne peuvent pas confirmer.",90          "Steps in blue only need the data; the step in amber requires an economic assumption that the data cannot confirm.",91        ),92        alt: t(93          "Diagramme de flux en trois groupes. Forme réduite : les séries servent à choisir le nombre de retards puis à estimer le VAR par moindres carrés, ce qui donne les coefficients A et la covariance des résidus ; la stabilité se vérifie sur les valeurs propres de la matrice compagnon. Identification : la covariance est factorisée par Cholesky selon un ordre des variables choisi par l'analyste, d'où la matrice d'impact P. Résultats : les coefficients moyenne mobile Phi combinés à P donnent les réponses orthogonalisées, puis les bandes de confiance et la décomposition de variance.",94          "Flow diagram in three groups. Reduced form: the observed series are used to choose the lag length, then to estimate the VAR by least squares, giving the coefficients A and the residual covariance; a stability check looks at the eigenvalues of the companion matrix. Identification: the covariance is factorised by Cholesky following a variable ordering chosen by the analyst, giving the impact matrix P. Results: the moving-average coefficients Phi combined with P give the orthogonalised responses, then bootstrap confidence bands and the variance decomposition.",95        ),96        groups: [97          { id: "g-reduced", label: t("Forme réduite", "Reduced form"), tone: "blue" },98          { id: "g-ident", label: t("Identification", "Identification"), tone: "amber" },99          { id: "g-out", label: t("Résultats", "Results"), tone: "green" },100        ],101        nodes: [102          { id: "n-data", label: t("Séries y(1)…y(T)", "Series y(1)…y(T)"), shape: "cylinder", tone: "neutral", icon: "database", group: "g-reduced" },103          { id: "n-lags", label: t("Choix de p", "Choice of p"), sublabel: t("critères d'information", "information criteria"), shape: "diamond", tone: "blue", group: "g-reduced" },104          { id: "n-ols", label: t("MCO équation par équation", "OLS equation by equation"), shape: "round", tone: "blue", icon: "calculator", group: "g-reduced" },105          { id: "n-coef", label: "A₁ … Aₚ", sublabel: t("coefficients estimés", "estimated coefficients"), shape: "rect", tone: "blue", group: "g-reduced" },106          { id: "n-sigma", label: "Σᵤ", sublabel: t("covariance des résidus", "residual covariance"), shape: "rect", tone: "blue", group: "g-reduced" },107          { id: "n-stable", label: t("Stabilité ?", "Stable?"), sublabel: t("valeurs propres de la compagnon", "companion eigenvalues"), shape: "diamond", tone: "blue", group: "g-reduced" },108          { id: "n-order", label: t("Ordre des variables", "Variable ordering"), sublabel: t("hypothèse économique", "economic assumption"), shape: "note", tone: "amber", icon: "user", group: "g-ident" },109          { id: "n-chol", label: t("Cholesky : Σᵤ = P Pᵀ", "Cholesky: Σᵤ = P Pᵀ"), sublabel: t("P triangulaire inférieure", "P lower triangular"), shape: "hexagon", tone: "amber", icon: "split", group: "g-ident" },110          { id: "n-ma", label: "Φ₀, Φ₁, Φ₂ …", sublabel: t("représentation MA(∞)", "MA(∞) representation"), shape: "round", tone: "green", group: "g-out" },111          { id: "n-irf", label: "Θᵢ = Φᵢ P", sublabel: t("réponses orthogonalisées", "orthogonalised responses"), shape: "round", tone: "green", icon: "trend", group: "g-out" },112          { id: "n-bands", label: t("Bandes de confiance", "Confidence bands"), sublabel: t("bootstrap ou asymptotique", "bootstrap or asymptotic"), shape: "round", tone: "green", icon: "chart", group: "g-out" },113          { id: "n-fevd", label: t("Décomposition de variance", "Variance decomposition"), shape: "round", tone: "green", group: "g-out" },114        ],115        edges: [116          { id: "e-data-lags", from: "n-data", to: "n-lags", tone: "blue" },117          { id: "e-lags-ols", from: "n-lags", to: "n-ols", tone: "blue" },118          { id: "e-ols-coef", from: "n-ols", to: "n-coef", tone: "blue" },119          { id: "e-ols-sigma", from: "n-ols", to: "n-sigma", label: t("résidus", "residuals"), tone: "blue" },120          { id: "e-coef-stable", from: "n-coef", to: "n-stable", tone: "blue" },121          { id: "e-stable-ma", from: "n-stable", to: "n-ma", label: t("oui", "yes"), tone: "green" },122          { id: "e-sigma-chol", from: "n-sigma", to: "n-chol", tone: "amber" },123          { id: "e-order-chol", from: "n-order", to: "n-chol", label: t("impose", "imposes"), style: "dashed", tone: "amber" },124          { id: "e-chol-irf", from: "n-chol", to: "n-irf", label: "P", tone: "amber" },125          { id: "e-ma-irf", from: "n-ma", to: "n-irf", label: "Φᵢ", tone: "green" },126          { id: "e-irf-bands", from: "n-irf", to: "n-bands", tone: "green" },127          { id: "e-irf-fevd", from: "n-irf", to: "n-fevd", tone: "green" },128        ],129        legend: [130          { label: t("Bleu : déterminé par les données", "Blue: determined by the data"), tone: "blue", shape: "square" },131          { label: t("Ambre : repose sur une hypothèse d'identification", "Amber: rests on an identifying assumption"), tone: "amber", shape: "square" },132          { label: t("Vert : résultats interprétés", "Green: interpreted results"), tone: "green", shape: "square" },133          { label: t("Flèche tiretée : choix de l'analyste", "Dashed arrow: analyst's choice"), tone: "amber", shape: "dashed" },134        ],135      },136      {137        id: "cards-reduced", type: "cards", span: 4, columns: 2,138        items: [139          { icon: "layers", title: t("Retards", "Lags"), tone: "blue", text: t("$p$ se choisit par critères d'information (AIC, HQ, BIC) puis en vérifiant l'absence d'autocorrélation des résidus.", "$p$ is chosen with information criteria (AIC, HQ, BIC), then by checking that residuals are not autocorrelated.") },140          { icon: "calculator", title: t("Paramètres", "Parameters"), tone: "blue", text: t("$K + K^2p$ coefficients de moyenne : leur nombre croît avec le carré du nombre de variables.", "$K + K^2p$ mean coefficients: their number grows with the square of the number of variables.") },141          { icon: "check", title: t("Stabilité", "Stability"), tone: "green", text: t("Sans elle, pas de représentation MA(∞) convergente et les réponses ne s'éteignent pas.", "Without it there is no convergent MA(∞) representation and responses do not die out.") },142          { icon: "warning", title: t("Corrélation des erreurs", "Correlated errors"), tone: "amber", text: t("$\\Sigma_u$ non diagonale : un « choc sur $u_{1t}$ seul » n'est pas une expérience bien définie.", "$\\Sigma_u$ is not diagonal: a \"shock to $u_{1t}$ alone\" is not a well-defined experiment.") },143        ],144      },145146      { id: "sec-ma", type: "heading", level: 2, eyebrow: t("Étape 2", "Step 2"), text: t("La représentation moyenne mobile", "The moving-average representation") },147      {148        id: "eq-ma", type: "equation", span: 8, label: t("Représentation MA(∞)", "MA(∞) representation"), sourceIds: ["lutkepohl-2005"],149        latex: r`y_t = \mu + \sum_{i=0}^{\infty} \Phi_i\, u_{t-i}, \qquad \Phi_0 = I_K, \qquad \Phi_i = \sum_{j=1}^{\min(i,p)} \Phi_{i-j} A_j`,150        explanation: t(151          "Pour un VAR stable, $y_t$ est une somme pondérée de toutes les erreurs passées. L'élément $(j,k)$ de $\\Phi_i$ est la réponse de la variable $j$, $i$ périodes après une erreur unitaire sur la variable $k$, les autres erreurs étant maintenues à zéro : c'est la réponse **à l'erreur de prévision**, pas encore à un choc structurel.",152          "For a stable VAR, $y_t$ is a weighted sum of all past errors. Element $(j,k)$ of $\\Phi_i$ is the response of variable $j$, $i$ periods after a unit error in variable $k$, the other errors being held at zero: it is the response **to a forecast error**, not yet to a structural shock.",153        ),154        variables: [155          { symbol: r`\mu`, meaning: t("moyenne du processus, $\\mu=(I_K-A_1-\\dots-A_p)^{-1}c$", "mean of the process, $\\mu=(I_K-A_1-\\dots-A_p)^{-1}c$") },156          { symbol: r`\Phi_i`, meaning: t("matrice $K\\times K$ des réponses à l'horizon $i$", "$K\\times K$ matrix of responses at horizon $i$") },157          { symbol: r`i`, meaning: t("horizon", "horizon"), unit: t("périodes", "periods") },158        ],159      },160      {161        id: "callout-companion-power", type: "callout", span: 4, tone: "tip", title: t("Calcul pratique", "In practice"),162        text: t(163          "Avec la matrice compagnon, $\\Phi_i = J\\,\\mathbf{A}^i J^\\top$ où $J=[\\,I_K\\ \\ 0\\ \\cdots\\ 0\\,]$ : les réponses sont le bloc supérieur gauche des puissances de $\\mathbf{A}$. Si les valeurs propres sont de module inférieur à 1, $\\mathbf{A}^i\\to 0$ et les réponses s'éteignent.",164          "With the companion matrix, $\\Phi_i = J\\,\\mathbf{A}^i J^\\top$ where $J=[\\,I_K\\ \\ 0\\ \\cdots\\ 0\\,]$: the responses are the upper-left block of the powers of $\\mathbf{A}$. If the eigenvalues have modulus below 1, $\\mathbf{A}^i\\to 0$ and the responses die out.",165        ),166      },167168      { id: "sec-ident", type: "heading", level: 2, eyebrow: t("Étape 3", "Step 3"), text: t("Le problème d'identification", "The identification problem") },169      {170        id: "para-ident", type: "paragraph", span: 6,171        text: t(172          "Supposons que les erreurs soient des combinaisons linéaires de **chocs structurels** non corrélés et de variance unitaire : $u_t = P\\,\\varepsilon_t$, donc $\\Sigma_u = PP^\\top$. Or $\\Sigma_u$ est symétrique : elle fournit $K(K+1)/2$ moments pour $K^2$ inconnues dans $P$. Il manque $K(K-1)/2$ restrictions, que seule la théorie économique peut fournir[^kilian-lutkepohl-2017]. Pour toute matrice orthogonale $Q$, $PQ$ reproduit aussi bien $\\Sigma_u$ : les données ne tranchent pas.",173          "Suppose the errors are linear combinations of uncorrelated, unit-variance **structural shocks**: $u_t = P\\,\\varepsilon_t$, hence $\\Sigma_u = PP^\\top$. But $\\Sigma_u$ is symmetric: it provides $K(K+1)/2$ moments for $K^2$ unknowns in $P$. That leaves $K(K-1)/2$ restrictions missing, which only economic theory can supply[^kilian-lutkepohl-2017]. For any orthogonal matrix $Q$, $PQ$ reproduces $\\Sigma_u$ just as well: the data cannot tell them apart.",174        ),175      },176      {177        id: "eq-cholesky", type: "equation", span: 6, label: t("Réponses orthogonalisées (Cholesky)", "Orthogonalised responses (Cholesky)"), sourceIds: ["lutkepohl-2005"],178        latex: r`\Sigma_u = P P^\top \ \ (P \text{ triangulaire inférieure}), \qquad \varepsilon_t = P^{-1}u_t, \qquad \Theta_i = \Phi_i P`.replace("triangulaire inférieure", locale === "fr" ? "triangulaire inférieure" : "lower triangular"),179        explanation: t(180          "La factorisation de Cholesky fournit exactement les $K(K-1)/2$ zéros manquants. L'élément $(j,k)$ de $\\Theta_i$ est la réponse de la variable $j$, $i$ périodes après un choc d'un écart-type sur $\\varepsilon_k$.",181          "The Cholesky factorisation supplies exactly the $K(K-1)/2$ missing zeros. Element $(j,k)$ of $\\Theta_i$ is the response of variable $j$, $i$ periods after a one-standard-deviation shock to $\\varepsilon_k$.",182        ),183        variables: [184          { symbol: r`P`, meaning: t("matrice d'impact : effet instantané des chocs structurels", "impact matrix: contemporaneous effect of the structural shocks") },185          { symbol: r`\varepsilon_t`, meaning: t("chocs orthogonalisés, $\\mathbb{E}[\\varepsilon_t\\varepsilon_t^\\top]=I_K$", "orthogonalised shocks, $\\mathbb{E}[\\varepsilon_t\\varepsilon_t^\\top]=I_K$") },186          { symbol: r`\Theta_i`, meaning: t("réponses impulsionnelles orthogonalisées à l'horizon $i$", "orthogonalised impulse responses at horizon $i$") },187        ],188      },189      {190        id: "matrix-impact", type: "matrix", span: 6, dataKind: "illustrative", scale: "sequential", showValues: true, decimals: 0,191        title: t("Ce que l'ordre impose à l'impact", "What the ordering imposes on impact"),192        caption: t(193          "Structure de $P$ pour l'ordre (production, inflation, taux d'intérêt) : 1 = réponse instantanée permise, 0 = réponse instantanée interdite. Schéma illustratif, pas une estimation.",194          "Pattern of $P$ for the ordering (output, inflation, interest rate): 1 = contemporaneous response allowed, 0 = contemporaneous response ruled out. Illustrative pattern, not an estimate.",195        ),196        alt: t(197          "Matrice trois par trois triangulaire inférieure. La production ne réagit le jour même qu'à son propre choc ; l'inflation réagit aux chocs 1 et 2 ; le taux d'intérêt réagit aux trois chocs.",198          "Three-by-three lower-triangular matrix. Output reacts on impact only to its own shock; inflation reacts to shocks 1 and 2; the interest rate reacts to all three shocks.",199        ),200        rowLabels: [t("Production", "Output"), t("Inflation", "Inflation"), t("Taux d'intérêt", "Interest rate")],201        colLabels: [t("Choc 1", "Shock 1"), t("Choc 2", "Shock 2"), t("Choc 3", "Shock 3")],202        values: [[1, 0, 0], [1, 1, 0], [1, 1, 1]],203      },204      {205        id: "callout-ordering", type: "callout", span: 6, tone: "warning", title: t("Pourquoi l'ordre compte", "Why ordering matters"),206        text: t(207          "Placer une variable en premier, c'est supposer qu'elle ne réagit à aucun autre choc dans la période ; la placer en dernier, c'est supposer qu'elle réagit à tous. Changer l'ordre change $P$, donc toutes les réponses, **sans modifier l'ajustement du VAR**. L'ordre ne devient indifférent que si $\\Sigma_u$ est diagonale. Un ordre récursif doit donc être défendu par un argument économique (délais d'information, rigidités), jamais choisi par défaut[^stock-watson-2001].",208          "Putting a variable first assumes it reacts to no other shock within the period; putting it last assumes it reacts to all of them. Changing the ordering changes $P$, hence every response, **without changing the fit of the VAR**. Ordering is irrelevant only when $\\Sigma_u$ is diagonal. A recursive ordering must therefore be defended with an economic argument (information lags, rigidities), never picked by default[^stock-watson-2001].",209        ),210      },211212      { id: "sec-reading", type: "heading", level: 2, eyebrow: t("Étape 4", "Step 4"), text: t("Lire les réponses et leur incertitude", "Reading responses and their uncertainty") },213      {214        id: "chart-irf", type: "chart", span: 6, kind: "line", dataKind: "illustrative",215        title: t("Réponses à un choc 1 dans un VAR(1) bivarié", "Responses to shock 1 in a bivariate VAR(1)"),216        caption: t(217          "Calculé par $\\Theta_i=A^iP$ avec des coefficients choisis à la main : $A$ de lignes (0,5 ; 0,1) et (0,2 ; 0,6), valeurs propres 0,7 et 0,4, et $P$ de lignes (1 ; 0) et (0,5 ; 1). Aucune donnée réelle.",218          "Computed as $\\Theta_i=A^iP$ with hand-chosen coefficients: $A$ with rows (0.5, 0.1) and (0.2, 0.6), eigenvalues 0.7 and 0.4, and $P$ with rows (1, 0) and (0.5, 1). No real data.",219        ),220        alt: t(221          "Deux courbes sur 12 périodes. La réponse de la variable 1 part de 1 et décroît régulièrement vers zéro ; celle de la variable 2 part de 0,5, reste proche de 0,5 à la première période, puis décroît vers zéro.",222          "Two curves over 12 periods. The response of variable 1 starts at 1 and declines steadily towards zero; that of variable 2 starts at 0.5, stays close to 0.5 in the first period, then declines towards zero.",223        ),224        x: { label: t("Horizon", "Horizon"), unit: t("périodes", "periods"), min: 0, max: 12 },225        y: { label: t("Réponse", "Response"), unit: t("écarts-types du choc", "shock standard deviations") },226        series: [227          { name: t("Variable 1", "Variable 1"), tone: "blue", points: series(0, 0) },228          { name: t("Variable 2", "Variable 2"), tone: "amber", points: series(1, 0) },229        ],230        annotations: [{ y: 0, label: t("retour à l'équilibre", "back to equilibrium") }],231      },232      {233        id: "sim-irf", type: "simulation", span: 6, kind: "impulse-response", params: { a11: 0.5, a12: 0.1, a21: 0.2, a22: 0.6, horizon: 12 }, config: { shock: 1 }, seed: 3,234        title: t("Explorer la persistance", "Explore persistence"),235        caption: t(236          "VAR(1) bivarié : réponses $\\Phi_i=A^i$ à une erreur unitaire sur la première variable, **sans** orthogonalisation, calculées à partir des coefficients choisis avec les curseurs. Au départ, la matrice $A$ est celle du graphique voisin. Aucune donnée observée.",237          "Bivariate VAR(1): responses $\\Phi_i=A^i$ to a unit error in the first variable, **without** orthogonalisation, computed from the coefficients set with the sliders. Initially the matrix $A$ is that of the neighbouring chart. No observed data.",238        ),239        alt: t(240          "Simulation interactive : courbes de réponse des deux variables d'un VAR(1) bivarié à un choc unitaire, en fonction de l'horizon ; quatre curseurs modifient les coefficients de la matrice A et un cinquième l'horizon ; les modules des valeurs propres sont affichés et les courbes s'amortissent plus ou moins vite.",241          "Interactive simulation: response curves of the two variables of a bivariate VAR(1) to a unit shock, as a function of the horizon; four sliders change the coefficients of the matrix A and a fifth the horizon; the eigenvalue moduli are displayed and the curves die out more or less quickly.",242        ),243      },244      {245        id: "comparison-bands", type: "comparison", span: 8,246        caption: t("Deux familles de bandes de confiance pour les réponses impulsionnelles.", "Two families of confidence bands for impulse responses."),247        columns: [248          { title: t("Asymptotiques (méthode delta)", "Asymptotic (delta method)"), tone: "blue" },249          { title: t("Bootstrap", "Bootstrap"), tone: "green" },250        ],251        rows: [252          { label: t("Principe", "Principle"), cells: [t("Les réponses sont des fonctions non linéaires des coefficients ; leur variance est approchée par linéarisation[^lutkepohl-2005].", "Responses are nonlinear functions of the coefficients; their variance is approximated by linearisation[^lutkepohl-2005]."), t("On rééchantillonne les résidus, on reconstruit des séries, on réestime le VAR et on recalcule les réponses un grand nombre de fois.", "Residuals are resampled, series rebuilt, the VAR re-estimated and the responses recomputed a large number of times.")] },253          { label: t("Forme des bandes", "Shape of the bands"), cells: [t("Symétriques autour de l'estimation.", "Symmetric around the estimate."), t("Peuvent être asymétriques (quantiles de la distribution simulée).", "Can be asymmetric (quantiles of the simulated distribution).")] },254          { label: t("Petit échantillon", "Small samples"), cells: [t("Approximation parfois médiocre lorsque le VAR est très persistant.", "Approximation can be poor when the VAR is highly persistent."), t("Les coefficients estimés sont biaisés ; Kilian propose un bootstrap corrigé du biais[^kilian-1998].", "Estimated coefficients are biased; Kilian proposes a bias-corrected bootstrap[^kilian-1998].")] },255        ],256        verdict: t(257          "Dans les deux cas, les bandes usuelles sont **ponctuelles** : elles valent horizon par horizon, et non pour la trajectoire entière de la réponse.",258          "In both cases the usual bands are **pointwise**: they hold horizon by horizon, not for the whole path of the response.",259        ),260      },261      {262        id: "callout-assumption", type: "callout", span: 4, tone: "assumption", title: t("Hypothèses à garder en tête", "Assumptions to keep in mind"),263        text: t(264          "Linéarité et coefficients constants sur l'échantillon ; erreurs non autocorrélées ; nombre de retards suffisant ; et surtout, les chocs structurels doivent pouvoir se retrouver à partir des erreurs présentes ($u_t=P\\varepsilon_t$ avec $P$ inversible).",265          "Linearity and constant coefficients over the sample; serially uncorrelated errors; enough lags; and above all, the structural shocks must be recoverable from current errors ($u_t=P\\varepsilon_t$ with $P$ invertible).",266        ),267      },268269      { id: "sec-check", type: "heading", level: 2, eyebrow: t("À retenir", "Takeaways"), text: t("Vérifier sa compréhension", "Check your understanding") },270      {271        id: "quiz-ordering", type: "quiz", span: 6,272        question: t(273          "Dans un VAR à trois variables identifié par Cholesky avec l'ordre (production, inflation, taux d'intérêt), que suppose-t-on du choc associé au taux d'intérêt ?",274          "In a three-variable VAR identified by Cholesky with the ordering (output, inflation, interest rate), what is assumed about the shock attached to the interest rate?",275        ),276        choices: [277          { text: t("Il n'affecte ni la production ni l'inflation dans la période où il survient.", "It affects neither output nor inflation in the period in which it occurs."), correct: true, explanation: t("La dernière colonne de $P$ n'a qu'un élément non nul, celui du taux lui-même.", "The last column of $P$ has a single non-zero entry, that of the interest rate itself.") },278          { text: t("Il n'affecte jamais la production ni l'inflation.", "It never affects output or inflation."), correct: false, explanation: t("La restriction ne porte que sur l'impact ($i=0$) ; aux horizons suivants, les réponses sont libres.", "The restriction only bears on impact ($i=0$); at later horizons the responses are unrestricted.") },279          { text: t("Le taux d'intérêt ne réagit pas aux autres chocs dans la période.", "The interest rate does not react to the other shocks within the period."), correct: false, explanation: t("C'est l'inverse : placé en dernier, le taux réagit instantanément à tous les chocs.", "It is the opposite: placed last, the rate reacts on impact to every shock.") },280          { text: t("Rien : l'ordre n'influence pas les réponses.", "Nothing: ordering does not influence the responses."), correct: false, explanation: t("Ce ne serait vrai que si $\\Sigma_u$ était diagonale.", "That would be true only if $\\Sigma_u$ were diagonal.") },281        ],282      },283      {284        id: "accordion-mistakes", type: "accordion", span: 6,285        items: [286          { title: t("Interpréter les erreurs de forme réduite comme des chocs économiques", "Reading reduced-form errors as economic shocks"), text: t("$u_t$ mélange tous les chocs structurels. Sans identification, « un choc sur l'équation du taux » n'a pas d'interprétation causale.", "$u_t$ mixes all structural shocks. Without identification, \"a shock to the interest-rate equation\" has no causal interpretation.") },287          { title: t("Présenter un ordre de Cholesky sans le justifier", "Reporting a Cholesky ordering without justifying it"), text: t("L'ordre est l'hypothèse d'identification elle-même. Montrer la sensibilité des résultats à d'autres ordres plausibles est un minimum[^stock-watson-2001].", "The ordering is the identifying assumption itself. Showing how results change under other plausible orderings is a minimum[^stock-watson-2001].") },288          { title: t("Confondre causalité au sens de Granger et effet causal", "Confusing Granger causality with a causal effect"), text: t("La causalité de Granger est une propriété de **prévision** de la forme réduite ; elle ne dit rien de l'effet d'un choc structurel.", "Granger causality is a **forecasting** property of the reduced form; it says nothing about the effect of a structural shock.") },289          { title: t("Lire des bandes ponctuelles comme une région pour toute la trajectoire", "Reading pointwise bands as a region for the whole path"), text: t("Une bande à 95 % par horizon ne couvre pas la courbe entière avec une probabilité de 95 %.", "A 95% band at each horizon does not cover the whole curve with 95% probability.") },290          { title: t("Calculer des réponses sur un VAR instable sans s'en apercevoir", "Computing responses from an unstable VAR without noticing"), text: t("Si une valeur propre de la matrice compagnon est de module supérieur ou égal à 1, les réponses ne s'éteignent pas et la théorie asymptotique usuelle ne s'applique plus telle quelle.", "If a companion eigenvalue has modulus at or above 1, responses do not die out and the usual asymptotic theory no longer applies as is.") },291        ],292      },293      { id: "refs", type: "references", title: t("Références", "References") },294    ],295    sources: [296      doiSource("sims-1980", "article", "Macroeconomics and Reality", ["Christopher A. Sims"], 1980, "Econometrica, 48(1), 1", "10.2307/1912017"),297      doiSource("lutkepohl-2005", "book", "New Introduction to Multiple Time Series Analysis", ["Helmut Lütkepohl"], 2005, "Springer Berlin Heidelberg", "10.1007/978-3-540-27752-1"),298      doiSource("kilian-lutkepohl-2017", "book", "Structural Vector Autoregressive Analysis", ["Lutz Kilian", "Helmut Lütkepohl"], 2017, "Cambridge University Press", "10.1017/9781108164818"),299      doiSource("stock-watson-2001", "article", "Vector Autoregressions", ["James H Stock", "Mark W Watson"], 2001, "Journal of Economic Perspectives, 15(4), 101–115", "10.1257/jep.15.4.101"),300      doiSource("kilian-1998", "article", "Small-sample Confidence Intervals for Impulse Response Functions", ["Lutz Kilian"], 1998, "Review of Economics and Statistics, 80(2), 218–230", "10.1162/003465398557465"),301    ],302    claims: [303      { id: "c-sims", text: t("Sims (1980) a proposé les VAR comme solution de rechange aux restrictions d'identification des grands modèles macroéconométriques, qu'il jugeait « incroyables ».", "Sims (1980) proposed VARs as an alternative to the identifying restrictions of large macroeconometric models, which he called \"incredible\"."), status: "sourced", sourceIds: ["sims-1980"], blockId: "lead" },304      { id: "c-stability", text: t("Un VAR(p) est stable si et seulement si toutes les valeurs propres de sa matrice compagnon sont de module inférieur à 1 ; un VAR stable est stationnaire.", "A VAR(p) is stable if and only if every eigenvalue of its companion matrix has modulus below 1; a stable VAR is stationary."), status: "sourced", sourceIds: ["lutkepohl-2005"], blockId: "eq-companion" },305      { id: "c-ma", text: t("Un VAR stable admet une représentation MA(∞) dont les coefficients vérifient Φ₀ = I et Φᵢ = Σⱼ Φᵢ₋ⱼ Aⱼ.", "A stable VAR has an MA(∞) representation whose coefficients satisfy Φ₀ = I and Φᵢ = Σⱼ Φᵢ₋ⱼ Aⱼ."), status: "sourced", sourceIds: ["lutkepohl-2005"], blockId: "eq-ma" },306      { id: "c-ident", text: t("La covariance de forme réduite laisse K(K−1)/2 restrictions manquantes pour identifier la matrice d'impact.", "The reduced-form covariance leaves K(K−1)/2 restrictions missing to identify the impact matrix."), status: "sourced", sourceIds: ["kilian-lutkepohl-2017"], blockId: "para-ident" },307      { id: "c-ordering", text: t("Les réponses orthogonalisées par Cholesky dépendent de l'ordre des variables, sauf si la covariance des erreurs est diagonale.", "Cholesky-orthogonalised responses depend on the ordering of the variables unless the error covariance is diagonal."), status: "sourced", sourceIds: ["lutkepohl-2005", "stock-watson-2001"], blockId: "callout-ordering" },308      { id: "c-bootstrap", text: t("Les estimateurs des coefficients d'un VAR sont biaisés en petit échantillon, ce qui motive le bootstrap corrigé du biais de Kilian (1998).", "VAR coefficient estimators are biased in small samples, which motivates Kilian's (1998) bias-corrected bootstrap."), status: "sourced", sourceIds: ["kilian-1998"], blockId: "comparison-bands" },309      { id: "c-chart", text: t("Dans l'exemple illustratif, les valeurs propres de A sont 0,7 et 0,4 : les réponses s'éteignent géométriquement.", "In the illustrative example the eigenvalues of A are 0.7 and 0.4: the responses die out geometrically."), status: "derived", sourceIds: [], blockId: "chart-irf" },310    ],311  };312}313314export const varImpulseResponse: TemplateDef = {315  id: "var-impulse-response",316  title: { fr: "VAR et fonctions de réponse impulsionnelle", en: "VAR and impulse response functions" },317  description: {318    fr: "VAR(p) sous forme réduite, stabilité et matrice compagnon, représentation MA(∞), identification par Cholesky, importance de l'ordre et bandes de confiance.",319    en: "Reduced-form VAR(p), stability and companion matrix, MA(∞) representation, Cholesky identification, why ordering matters, and confidence bands.",320  },321  category: "finance",322  build,323};324
Files main
Menu

Theme