Effacer les filtres
Effacer les filtres

TVP-VAR model

64 vues (au cours des 30 derniers jours)
f x
f x le 8 Juil 2016
Commenté : Luyao Yang le 25 Déc 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 commentaires
Savas Gayaker
Savas Gayaker le 11 Août 2019
Thank you for your answer. can this code be extended to five or more variables
Luyao Yang
Luyao Yang le 25 Déc 2022
Hi, do you know how to draw a 3D-irf in Matlab?it should be tvp-var model

Connectez-vous pour commenter.

Réponses (3)

Savas Gayaker
Savas Gayaker le 25 Juin 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 commentaire
Ameer Fahmi
Ameer Fahmi le 2 Nov 2019
Modifié(e) : Ameer Fahmi le 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

Connectez-vous pour commenter.


zhen lu
zhen lu le 11 Août 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 commentaire
yuanxin
yuanxin le 9 Fév 2022
请问后面的代码该怎么改?它的图还是三个变量的图

Connectez-vous pour commenter.


song song
song song le 27 Oct 2019
How to draw the 3D impulse response figure ?
  3 commentaires
song song
song song le 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 le 3 Nov 2019
Modifié(e) : Ameer Fahmi le 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Conditional Mean Models dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by