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

조회 수: 10 (최근 30일)
克
2023년 7월 19일
댓글: 2023년 11월 25일
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
Debadipto
Debadipto 2023년 7월 31일
편집: Debadipto 2023년 7월 31일
Hi, could you please provide more information about the setvar method? When I run the code, it throws "Unrecognized function or variable 'setvar'." error.

댓글을 달려면 로그인하십시오.

채택된 답변

Garmit Pant
Garmit Pant 2023년 9월 1일
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
克
2023년 11월 25일
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,

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Conditional Variance Models에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by