TVP-VAR model
69 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Savas Gayaker
il 11 Ago 2019
Thank you for your answer. can this code be extended to five or more variables
Risposte (3)
Savas Gayaker
il 25 Giu 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 Commento
Ameer Fahmi
il 2 Nov 2019
Modificato: Ameer Fahmi
il 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
zhen lu
il 11 Ago 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
song song
il 27 Ott 2019
How to draw the 3D impulse response figure ?
3 Commenti
song song
il 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?
Ameer Fahmi
il 3 Nov 2019
Modificato: Ameer Fahmi
il 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.
Vedere anche
Categorie
Scopri di più su Annotations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!