Runing TVP-SV-VAR model, interation have no reaction for a long-time

8 visualizzazioni (ultimi 30 giorni)
When I runing the TVP-SV-VAR model, the model was stuck a Interation for hours long, and it did not remind any error message. The question that I try to solve is to find the change the sign of variable between mutual fund flow and EPU. The excel file that I insert is 7 column 363300 line of data. I run this data in Matlab using VAR model and GARCH model without any problems. Could anyone can give me any suggestion, it either my code problems or simply the file is too large ?
%%--------------------------------------------------------%%
%% tvpvar_ex1.m %%
%%--------------------------------------------------------%%
%%
%% MCMC estimation for Time-Varying Parameter VAR model
%% with stochastic volatility
%%
clear all;
close all;
my = xlsread('/Users/make/Desktop/小论文啊啊啊啊/数据/MATLAB /TVP-SV-VAR全流程附件/3_Matlab程序/tvpvar_m/FUNDSHARENEW-0418晚.xlsx'); % load data
asvar = {'LOG(TotalRedemptionFundShare)'; 'LOG(EPU)';'LOG(TotalPurchaseFundShare)'}; % variable names
nlag = 2; % # of lags
setvar('data', my, asvar, nlag); % set data
setvar('fastimp', 1); % fast computing of response
mcmc(1000); % MCMC
drawimp([1 4 8], 1); % draw impulse reponse(1)
% : 4-,8-,12-period ahead
drawimp([335 627 1199], 0); % draw impulse response(2)
% : response at t=30,60,90
  1 Commento
Debadipto
Debadipto il 31 Lug 2023
Modificato: Debadipto il 31 Lug 2023
Hi, could you please provide more information about the setvar method? When I run the code, it throws "Unrecognized function or variable 'setvar'." error.

Accedi per commentare.

Risposta accettata

Garmit Pant
Garmit Pant il 1 Set 2023
Hello ,
I understand that you are trying to find the change the sign of variable between mutual fund flow and EPU using a custom, user-generated code.
Please know that as per my findings, the code that you are trying to use is the “tvpvar_m.zip” by Jouchi Nakajima that can be found here: https://sites.google.com/site/jnakajimaweb/tvpvar
I tried testing the code using the data provided by the author. The example data that the author has provided is of the size 124x3. On testing using this data, the average time elapsed per iteration was 0.0191 seconds.
Besides, I also tried testing the same function using dummy data, passing an input matrix of the size 372x3. On testing using this data, the average time elapsed per iteration was found to be 0.1033 seconds.
It can thus be observed that, the average time per iteration increased by a factor of 10 for input data of a larger size.
Since you are passing an input matrix that is of the size 363300x7, it is very likely that the computation time per iteration is increasing manifold and thus the iterations keep running for multiple hours.
In this case, you can try running your calculations on a subset of your data to resolve the issue or try to look for a different method to solve your problem.
I hope you find the above explanation and suggestions useful!
  1 Commento
克
il 25 Nov 2023
Thanks Garmit
I find the iteration was cost a lot of time. I have tried to switch to another method to solve this problem, and indeed their is always another way to solve the problem,

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Conditional Variance Models in Help Center e File Exchange

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by