Borrar filtros
Borrar filtros

TVP-VAR model

64 visualizaciones (últimos 30 días)
f x
f x el 8 de Jul. de 2016
Comentada: Luyao Yang el 25 de Dic. de 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 comentarios
Savas Gayaker
Savas Gayaker el 11 de Ag. de 2019
Thank you for your answer. can this code be extended to five or more variables
Luyao Yang
Luyao Yang el 25 de Dic. de 2022
Hi, do you know how to draw a 3D-irf in Matlab?it should be tvp-var model

Iniciar sesión para comentar.

Respuestas (3)

Savas Gayaker
Savas Gayaker el 25 de Jun. de 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 comentario
Ameer Fahmi
Ameer Fahmi el 2 de Nov. de 2019
Editada: Ameer Fahmi el 2 de Nov. de 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

Iniciar sesión para comentar.


zhen lu
zhen lu el 11 de Ag. de 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 comentario
yuanxin
yuanxin el 9 de Feb. de 2022
请问后面的代码该怎么改?它的图还是三个变量的图

Iniciar sesión para comentar.


song song
song song el 27 de Oct. de 2019
How to draw the 3D impulse response figure ?
  3 comentarios
song song
song song el 2 de Nov. de 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 el 3 de Nov. de 2019
Editada: Ameer Fahmi el 3 de Nov. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Conditional Mean Models en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by