Filter löschen
Filter löschen

TVP-VAR model

64 Ansichten (letzte 30 Tage)
f x
f x am 8 Jul. 2016
Kommentiert: Luyao Yang am 25 Dez. 2022
i use Nakajima‘s code to do the 3 variable TVP-VAR model。Now I want to do a 4-variable TVP-VAR model but i have no idea how to revise the original code.The code is as follows and i put the entile code in the attachment.Thanks for your help!
clear all; close all;
load tvpvar_ex; % data (.mat)
asvar = {'index'; 'v'; 'm2'; }; % variable names nlag = 2; % lags
setvar('data', my, asvar, nlag); % set data
setvar('fastimp', 1); % fast computing of response
mcmc(10000); % MCMC
drawimp([4 8 12], 1); % draw impulse reponse(1) % : 4-,8-,12-period ahead
drawimp([30 60 90], 0); % draw impulse response(2) % : response at t=30,60,90
  2 Kommentare
Savas Gayaker
Savas Gayaker am 11 Aug. 2019
Thank you for your answer. can this code be extended to five or more variables
Luyao Yang
Luyao Yang am 25 Dez. 2022
Hi, do you know how to draw a 3D-irf in Matlab?it should be tvp-var model

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Savas Gayaker
Savas Gayaker am 25 Jun. 2019
I am looking for the same thing. Since 2016 no one has any answer I guess. Did you find anything ? İf you found, could you share it with me ?
  1 Kommentar
Ameer Fahmi
Ameer Fahmi am 2 Nov. 2019
Bearbeitet: Ameer Fahmi am 2 Nov. 2019
The code can work with four variables, you just neet to introduce your fourth variable in the 'asvar' function as follows
asvar = {'y1'; 'y2'; 'y3'; 'y4' }; % variable names
And that's it

Melden Sie sich an, um zu kommentieren.


zhen lu
zhen lu am 11 Aug. 2019
if you want do a 4-variable TVP-VAR model, firstly you should put the data of the fourth series data into tvpvar_ex file, and add the name of it into "asvar = {'index'; 'v'; 'm2'; }, like {'index'; 'v'; 'm2','X'; } . Here X means the name of variable you want to add. And maybe the format of code is wrong, you may take the following code.
clear all;
close all;
load tvpvar_ex; % data (.mat)
asvar = {'index'; 'v'; 'm0'; }; % variable names
nlag = 2; % lags
setvar('data', my, asvar, nlag); % set data
setvar('fastimp', 1); % fast computing of response
mcmc(10000); % MCMC
drawimp([4 8 12], 1); % draw impulse reponse(1)
% : 4-,8-,12-period ahead
drawimp([30 60 90], 0); % draw impulse response(2)
% : response at t=30,60,90
  1 Kommentar
yuanxin
yuanxin am 9 Feb. 2022
请问后面的代码该怎么改?它的图还是三个变量的图

Melden Sie sich an, um zu kommentieren.


song song
song song am 27 Okt. 2019
How to draw the 3D impulse response figure ?
  3 Kommentare
song song
song song am 2 Nov. 2019
Thank you for your answer.
But my excel filt named "tvpvar_imp.xls" is different with yours. I have three variables, so My form has nine columns. Just like this.Is our code different?
QQ截图20191102211504.png
Ameer Fahmi
Ameer Fahmi am 3 Nov. 2019
Bearbeitet: Ameer Fahmi am 3 Nov. 2019
This is weird, the horizons, the impulse variable and the response variable must be there, otherwise the program will not be able to draw the figure of cumulative impulse responses at different horizons as well as the responses at different time points. The graphs are based on these outputs
I think there's a problem with your results, the values of the response are zero which indicate for singular matrix, meaning that the variables have no impact on each other. Are you using randomly selected variables? or maybe there is a mistake in your settings of the variables and lags
You should also look to the other reported graphs, like the figure of MCMC draws, stochastic volatility figure and simultaeous relations. The MCMC draws must be uncorrelated, follow a stable line and normally distributed. If it doesn't then your estimations are not correct. In addition, you should notice fluctuations in the figure of the stochastic volatility, if it is constant and unchanged then there is no time variations in the parameters of your variables.
I could help you more if you post pictures for the rest of the figures.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Conditional Mean Models finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by