View in Telegram
Π₯ΠžΠ›ΠžΠ”ΠΠ«Π™ РАБЧЕВ βˆ…
πŸ˜‡ BQ-SVAR: MATLAB 1. Π—Π°Π±ΠΈΡ€Π°Π΅ΠΌ VAR Toolbox 3.0 ΠΎΡ‚ΡΡŽΠ΄Π° 2. Π‘ΠΎΠ±ΠΈΡ€Π°Π΅ΠΌ Π΄Π°Π½Π½Ρ‹Π΅ ΠΈ ΠΎΡ†Π΅Π½ΠΈΠ²Π°Π΅ΠΌ VAR addpath(genpath('F:/RussiaCEE/tools/matlab/v3dot0')) clear all; clear session; close all; clc warning off all % Load data [xlsdata, xlstext] = xlsread("databq.xlsx"…
πŸ˜‡ BQ-SVAR: Wolfram 1. Π—Π°Π±ΠΈΡ€Π°Π΅ΠΌ ΠΌΠΎΠΉ ΠΏΠ°ΠΊΠ΅Ρ‚ Economica ΠΎΡ‚ΡΡŽΠ΄Π° (Π½Π΅ ΡΠΏΡ€Π°ΡˆΠΈΠ²Π°ΠΉΡ‚Π΅ - Ρƒ ΠΊΠ°ΠΆΠ΄ΠΎΠ³ΠΎ Ρ‡Π΅Π»ΠΎΠ²Π΅ΠΊΠ° Π΅ΡΡ‚ΡŒ Π² ΠΆΠΈΠ·Π½ΠΈ ΠΏΠ΅Ρ€ΠΈΠΎΠ΄, ΠΊΠΎΠ³Π΄Π° ΠΎΠ½ Π½Π΅ Π²ΠΏΠΎΠ»Π½Π΅ ΠΏΠΎΠ½ΠΈΠΌΠ°Π΅Ρ‚, Ρ‡Ρ‚ΠΎ ΠΎΠ½ Π΄Π΅Π»Π°Π΅Ρ‚) 2. Π‘ΠΎΠ±ΠΈΡ€Π°Π΅ΠΌ Π΄Π°Π½Π½Ρ‹Π΅ ΠΈ ΠΎΡ†Π΅Π½ΠΈΠ²Π°Π΅ΠΌ VAR:
dfoi = TimeSeriesImport["databq.xlsx"]

val = Values[dfoi];
data = Transpose[#@"Values" & /@ val];
dates = First[val]["Dates"];

varlag = 12
varm = VARModelFit[data, varlag];
2. Π˜Π΄Π΅Ρ‚ΠΈΡ„ΠΈΡ†ΠΈΡ€ΡƒΠ΅ΠΌ SVAR:
svar = VARImpulseResponse[varm, Length@data - varm["nlags"],   "BlanchardQuah", 0];
irf = svar["IRF"];
irfs = Chop@irf[[ ;; ]];
structuralResiduals = 
  varm["FitResiduals"] . Inverse[svar["invA"]]\[Transpose];

3. Π”Π΅Π»Π°Π΅ΠΌ ΠΈΡΡ‚ΠΎΡ€ΠΈΡ‡Π΅ΡΠΊΡƒΡŽ Π΄Π΅ΠΊΠΎΠΌΠΏΠΎΠ·ΠΈΡ†ΠΈΡŽ Π²ΠΊΠ»Π°Π΄ΠΎΠ² структурных шоков:
empirf = irfs[[All, 1, All]];
histDecomp = ((Plus @@ (Reverse[empirf[[;; #]]]*
         structuralResiduals[[;; #]]))) & /@ 
   Range[(Length@data - varm["nlags"])];
resid = Total /@ histDecomp;


bchart = (Join[
    histDecomp, {yd[[-(Length@data - varm["nlags"]) ;;]] - 
       resid}\[Transpose], 2]);

4. Наш Ρ†Π΅Π»Π΅Π²ΠΎΠΉ ряд - это накоплСнная сумма Π²ΠΊΠ»Π°Π΄ΠΎΠ² "собствСнных" шоков выпуска:
trendbq = 
 TimeSeries[{dates[[varlag +1 ;;]], 
    Total /@ (bchart[[All, {1, 5}]])}\[Transpose]]
tsoi = TimeSeriesIntegrate[trendbq]
@c0ldness
Please open Telegram to view this post
VIEW IN TELEGRAM
Love Center - Dating, Friends & Matches, NY, LA, Dubai, Global
Love Center - Dating, Friends & Matches, NY, LA, Dubai, Global
Find friends or serious relationships easily