View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
MIDAS Matlab Toolbox

4.64706
4.6 | 27 ratings Rate this file 73 Downloads (last 30 days) File Size: 1.11 MB File ID: #45150 Version: 2.2
image thumbnail

MIDAS Matlab Toolbox

by

Hang Qian (view profile)

 

21 Jan 2014 (Updated )

Repack of Mi(xed) Da(ta) S(ampling) regressions (MIDAS) written by Eric Ghysels and collaborators

| Watch this File

File Information
Description

The mixed frequency regression studies the explanatory power of high frequency variables on the low frequency outcome. The weights associated with high frequency regressors are usually assumed some functional form. This toolbox is a repack of the Mi(xed) Da(ta) S(ampling) regressions (MIDAS) programs written by Eric Ghysels. It supports ADL-MIDAS type regressions. The package also includes two functions for GARCH-MIDAS and DCC-MIDAS estimation. See the enclosed user guide for details.
Syntax:
[...] = MIDAS_ADL(DataY,DataYdate,DataX,DataXdate)
[...] = MIDAS_ADL(DataY,DataYdate,DataX,DataXdate,name,value,...)
[...] = GarchMidas(y, name,value,...)
[...] = DccMidas(Data, name,value,...)

Required Products Optimization Toolbox
MATLAB
MATLAB release MATLAB 8.6 (R2015b)
MATLAB Search Path
/
/MIDASv2.2
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (126)
04 Feb 2017 Hang Qian

Hang Qian (view profile)

Hi Anup,

Matlab 2011b is an old version that does not support some name-value pairs of the inputParser class. You may try to replace addParameter by addParamValue. I think the syntax is the same. However, there are updates to the optimization tools in recent years. I am not sure if the codes yield good results under older version of MATLAB.

Comment only
03 Feb 2017 czbx51

czbx51 (view profile)

Hi Hang,
Thank you so much! I have solved my problem.The data Y begins ealier than the suggested start date, which is determined by X and the lags. Without exoreg, the program works well and reports" Start date cannot be earlier than 24-Mar-2003 due to lagged regressors. Reset start date to 24-Mar-2003 ". But it cannot run with the exoregs. I cut Y to the suggested starting date and it works well.

Comment only
02 Feb 2017 Anup Chowdhury

Dear Qian,

Many thanks for uploading this fantastic resource. I am using Matlab2011b version and getting following error messeages:

For ADL-MIDAS:

No appropriate method, property, or field addParameter for class inputParser.

Error in MIDAS_ADL (line 201)
parseObj.addParameter('Xlag',9,@(x)validateattributes(x,{'numeric','char'},{},callerName));

For GARCH-MIDAS:

Undefined function 'addParameter' for input
arguments of type 'inputParser'.

Error in GarchMidas (line 146)
addParameter(parseObj,'X',[],@(x)validateattributes(x,{'numeric'},{'2d'},callerName));

Can you please help me to fix these. Many thanks again for your nice cooperation.

Anup

01 Feb 2017 Hang Qian

Hang Qian (view profile)

Hi czbx51,
You may take a look at the example file appADLMIDAS4, in which there is an example of running the program with exogenous regressors. In that example, I saw ExoReg and Y are both column vectors with the same length. To process exogenous regressors, make sure the time series is a column vector with long enough length (taking the presample truncation caused by Xlag, Ylag into account as well). I am not sure why there is an error when you run the codes, but you may also set a break point at 297. Ideally, you would see both EstY and Mimic.EstY are two column vectors of the same length. Otherwise, try if it helps to remove that line (which only does some error checking). Also, check the date format, which varies from country to country. If MATLAB fails recognize your date format correctly, then the program will not run properly as well.

Comment only
01 Feb 2017 czbx51

czbx51 (view profile)

Hi Hang,
Thank you so much for this toolbox, it really helps a lot.
However, I cannot apply the exogenous variable into the ADL_MIDAS program. Matlab reports the bug as'错误使用 ~= 矩阵维度必须一致。MIDAS_ADL (line 297) if any(EstY ~= Mimic.EstY)', saying the dimension of the matrix is not the same. However the ExoReg data is exactly same date and length with the low frequency dependent variable Y, and it doesn't have any NaN value. Can you tell me what's wrong with this mimic part? Thank you!

15 Jan 2017 Hang Qian

Hang Qian (view profile)

Hi Ning,

The toolbox supports multi-step forecast. If you run the example file appADLMIDAS1.m. There are four outputs of the main function MIDAS_ADL. The first one is the forecasted values after the estimation sample, and the fourth output variable is the out-of-sample forecast after DataY is exhausted.

Comment only
15 Jan 2017 ning xu

Hi Hang,
First, Thanks for uploading this toolbox! Especially the ADL-MIDAS is very useful to me.
I wonder how do you perform h-step ahead forecast using this toolbox? I have referred to the MIDAS user guide for the multi-step forecast, but I still don't understand how to operate. Can you give me an example?
Thank you.

Comment only
09 Jan 2017 Hang Qian

Hang Qian (view profile)

Hi Chen Ryan,

It seems that the MATLAB Optimization Toolbox is not installed on your computer. The DccMIDAS uses a numeric optimization function FMINCON for maximum likelihood estimation. When that function is not available, it is supposed to switch to another optimization function FMINSEARCH in the core MATLAB. However, there was a bug that FMINSEARCH was not invoked properly. I just fixed the problem and the updated files should work in the absence of Optimization Toolbox. Thank you very much for reporting the issue!

Comment only
07 Jan 2017 Chen Ryan

Hi Hang,
Thank you for the nice toolbox. Whe I ran the code of the GARCH-MIDAS model, no problem emrged. When I ran the DCC-MIDAS model ,however, the follow error pops up:
警告: FMINCON failed... Switch to FMINSEARCH.
> In DccMidas (line 386)
In appDCCMIDAS1 (line 43)
错误使用
DccMidas>@(params)-nansum(fML(params,Resid,CrossResid,ResidCorr,period,nlagCorr,adjustLag,zeroLogL,beta2Para,rollWindow))
输入参数太多。

出错 fminsearch (line 200)
fv(:,1) = funfcn(x,varargin{:});

出错 DccMidas (line 387)
estParamsStep2 = fminsearch(myfun,params0,[],[],[],[],lb,ub,[],options);

would you pls help to point out where the prolem lies? Thanks a lot.

03 Jan 2017 Hang Qian

Hang Qian (view profile)

Hi Yu,

The codes only support one predictors, either the realized volatility or a macroeconomic variable. You may consider forecast combination by running two models. If you would like to put more than one macro variables in the regression, you will have to modify the codes. There is a subfunction [logL,...]=fML(params...) which computes the log likelihood. So you may want to expand the length of params and then add those macroeconomic variables that contribute to the log likelihood.

Comment only
03 Jan 2017 Hang Qian

Hang Qian (view profile)

Hi Sebastian,

When the MIDAS component is suppressed (Set Xlag=0), the parameters in the Beta polynomials, etc, become unidentified. Refer to the Davies problem. The codes do not support regression without high frequency regressors. If you really want to run an AR(p) without high-frequency predictors, you might extract the regressors and response variables from the output variable MixedFreqData, in which there are variables like EstY, EstX, EstLagY. By extracting those regression data, you could call the MATLAB function regress, fitlm or arima so as to run a AR(p) model. Then you could still compare R^2 of the two models.

Comment only
28 Dec 2016 Yu

Yu (view profile)

Dear Hank,

I want to estimate a two-component(or more components ) GARCH-MIDAS model, e.g., two or more macroeconomic fundamentals once in a GARCH-MIDAS model.
Is it possible?
Thank you very much!

20 Dec 2016 Sebastian Bentele

Hi Hang,

for my research I would like to compare my results of the MIDA model to an Ar(p) process. I tried to estimate and forecast the AR-process with the MIDAs toolbox as it is described in the manual (Set Xlag=0) but everytime I get an error: "Error using *
Inner matrix dimensions must agree".

How may I solve this problem?

Thanks in advance.

09 Dec 2016 jianjian lyu

07 Dec 2016 Hang Qian

Hang Qian (view profile)

Hi Johann,

I am sorry but there is no such magic function that could identify the appropriate starting values for numeric optimization.

Comment only
06 Dec 2016 johann guenkel

Hi Hang,
I have tried to increase the number of iterations but I cannot eliminate the problem. Is there a function I can use to identify the appropriate starting values?

Comment only
05 Dec 2016 Hang Qian

Hang Qian (view profile)

Yes, increasing the number of iterations may help convergence. For GarchMidas.m and DccMidas.m, there is a name-value pair called 'Options', in which you could specify the number of iterations for the numeric solver. For MIDAS_ADL.m, that option is not available, but one may step into the internal functions (in the private folder) such as bnls_adl_new.m (for Beta polynomials) and modify the variable ‘options’. Refer to MATLAB documentation page for optimoptions.

Comment only
05 Dec 2016 johann guenkel

Hi Hang,
another idea that just came into mind is to increase the number of iterations. Sometimes I get the message that the solver stopps prematurely as by default the number of iterations is 3000. Do you think it helps to increase the number of iterations to 10000? How can I adjust the number of iterations?

Comment only
04 Dec 2016 johann guenkel

Hi Hang,
Thanks for your reply. If I get it right, the warning indicates that the model does not converge. In some cases I fiddled with the starting values and it now works for most variables. However, there are still few cases that do not work must I change the optimization method in this case? How can I do that in the code?

Comment only
30 Nov 2016 Hang Qian

Hang Qian (view profile)

Hi Johann,
When we resort to numeric methods for likelihood maximization (squared residual minimization), it may or may not converge to a local optimal point. When it fails to converge, the warning message is likely to pop up. In that case, we will need to experiment on different starting values and alternative optimization methods.

Comment only
29 Nov 2016 johann guenkel

Hi Hang,
I want to analyse the relationship between stock index returns and macroeconomic variables such as inflation or GDP growth. In some cases the midas analysis returns good results i.e. I get significance and no warning message. However, in some cases I get the warning

Warning: Covariance matrix of estimators cannot be computed precisely due to
inversion difficulty.
In my code, I assumed the starting values given by default. I neither changed them nor did I determine my own starting values. What does that mean? How can I avoid this message?

Comment only
23 Nov 2016 Hang Qian

Hang Qian (view profile)

Ting -
The name-value pairs W0, Alpha0, Beta0 control for the initial parameters for MLE, while ZeroLogL controls for the initial observations. You may try both. Also consider setting the name-value pair 'LogTau' if the regressor X is other than the realized volatility.

Comment only
23 Nov 2016 Ting XIA

Hello Hang,
Thanks for your reply.
I checked my X data, there was no abnormal values, and its statistical characteristic seems normal, I changed other X data, it returned the same.
You mean reset the starting values, is it to reset W0, Alpha0, Beta0 which are used in MLE OR to set the ‘ZeroLogL’ to, such as in the input Syntax like ‘ZeroLogL’,[1,2] ?
I tried both, it returned the same. I also tried to set the ‘Options’, it seemed a little complex and didn’t get it work well yet, does it matter?
Regards.

Comment only
21 Nov 2016 Hang Qian

Hang Qian (view profile)

Ting - Yes, the data might have some problems, for example excessive amount of missing values, and the log likelihood at the initial parameter values is not finite. You may try some other starting values. If all the reasonable starting values return infinite/NaN log likelihood, then the data are possibly have some problems.

Alex - You may contact Eric for codes request.

Comment only
21 Nov 2016 Ting XIA

Hi Hang Qian,
Thanks for you great toolbox. I just started with GarchMidas model, it worked well. But when I tried my data, using a macroeconomic variable (X) to model GarchMidas, the X is monthly data, it replied this problem:

Warning: FMINCON failed... Switch to FMINSEARCH. Error
Message: Objective function is undefined at initial
point. Fmincon cannot continue.
>In GarchMidas (line 303)

Is it my data(X) problem? Could you give any suggestion?
Thanks in advance.

Comment only
20 Nov 2016 Alex L

Alex L (view profile)

Excellent tool. For my research I am very interested in the "mixed frequency VAR model" programs (classical approach), based on Ghysels (2016). Will they be included in the toolbox? I read in the userguide that they can be available upon request.
Thank you very much for sharing the toolbox.

20 Nov 2016 Alex L

Alex L (view profile)

18 Nov 2016 Sam Rolland

Thank you Hang

It was my date configuration for the Y-data. I had chosen different representations of quarterly data. Eventually worked with a 1 lead configuration.

Comment only
17 Nov 2016 Hang Qian

Hang Qian (view profile)

Hi Sam,

If your model does not include lagged autoregressive Y terms, you may try to append some values to the end of the Y series. If there are sufficient amount of X data, OutputForecast might produce some outputs.

Comment only
17 Nov 2016 Sam Rolland

Hello Hang

I am trying to run a basic nowcast (Horizon= -2) variation of the model, using MIDAS1- My Y-Data goes to 2016-06-30, and my X-Data goes to 2016-08-31. However, when I try and run the model at EstEnd: 2016-06-30, there is no OutputForecast produced, and when I take it back (say, a year), it only goes to my last Y-Date. Why would this be, and where should I be looking to make it that I can produce a forecast for 2016-09-31?

Thanks in advance

Comment only
17 Nov 2016 Hang Qian

Hang Qian (view profile)

Hi Trung,

If you would like to impose constraints on the coefficients, you will have to step into the codes and make changes. You may go to bnls_adl_new.m and search for the unconstrained numeric optimizer 'fminunc', and replace it by the constrained optimizer 'fmincon' with the desired constraints.

Comment only
16 Nov 2016 Trung Le

Hi Hang Quian
Thanks for the great toolbox.
Currently, I am working on the MIDAS_ADL function with the Beta polynomial specification. I would like to put a constraint on Beta1 of Beta polynomial to 1 to ensure the monotonic pattern of weight. How could I do that in the toolbox?
Thanks
T

03 Nov 2016 Ghulam Abbas

26 Oct 2016 Hang Qian

Hang Qian (view profile)

Yes, you may need to modify the codes. When we combine models in forecast, we need weights, which are proportional to the inverse of the forecast MSE. Both X and y data are needed to compute MSE.

Comment only
26 Oct 2016 Sam Rolland

Hi Hanq Qian

Thank you for this, I understand the theory behind it. One further question, to perform an extended forecast to a point where DataX is exhausted, am I correct in saying that appADLMIDAS3.m requires alteration to include the function 'ExtendedForecast.m' to perform a true out-of-sample forecast? I a struggling to understand the 'Combined Forecast by xxx' numbers and how they only go to the end of the DataY sample size.

Comment only
25 Oct 2016 Hang Qian

Hang Qian (view profile)

Prof. Ghysels added comments on Sam’s question: “While it is in principle possible to estimate MIDAS regressions with various HF regressors, it is preferred to use forecast combination techniques as HF regressors often tend to be highly co-linear, which causes estimation problems. Nevertheless, some packages such as EViews have implemented MIDAS regressions with multiple HF regressors. It is a possibility but has to be applied with caution in many practical applications.”

Comment only
24 Oct 2016 Hang Qian

Hang Qian (view profile)

Hi Sam,

Basically we estimate two or more models separately and then combine the forecast results by ForecastCombine(Output1,Output2). The example file appADLMIDAS3.m illustrates forecast combination.

Comment only
24 Oct 2016 Sam Rolland

Hello Hang Qian

I am new to this toolbox, although it appears to be very well constructed.

Potentially a silly question, but how does one add a second variable to then use in ForecastCombine.m? It mentions it "By adding the industrial production as a second high frequency series", but does not elaborate.

Can you assist please?

18 Oct 2016 Hang Qian

Hang Qian (view profile)

Hi Ruiru,

I do not have codes on your MIDAS_CJ model. The licence of the toolbox gives you permission to do modifications on the original codes. It is fine to adapt the codes so it is more suitable for your own studies.

Comment only
18 Oct 2016 Ruiru Guo

Hello,Qian,thank you for the great toolbox! I am now trying to apply a MIDAS_CJ model where I seperate the continuous part and the jump part in the high frequency data. I am wondering if I could do some change to your original function MIDAS_ADL to realize it or it is better for me to write a new function on MIDAS_CJ? Or do you have any related code on MIDAS_CJ? Thank you so much!

18 Oct 2016 Hang Qian

Hang Qian (view profile)

Hi Chen Ryan,

It is possible that the numeric optimizer fails to find an optimum. I do not have a good solution, but you may experiment different starting values by setting the name-value pairs. Also, turn on 'Gradient' and try to set the FMINCON 'Options' and see how alternative numeric optimization algorithms work.

Comment only
17 Oct 2016 Chen Ryan

Hello,Qian,thank you for the nice toolbox. I have tried to use the code you provided and they all work just fine. However, when I tried to implement more than one macroeconomic variables in GARCH-MIDAS and DCC-MIDAS models through constructing a linear model x = f(X,theta) that incorporates the macroeconomic variables, I failed numerous times. Would you like to be a little more specific on how to implement more than one macroeconomic variables in GARCH-MIDAS and DCC-MIDAS models? Thank you!

17 Oct 2016 Jason

Jason (view profile)

hi Hang Qian
I have solve the problem of the “corr" function you are right there is another "corr" function ,I did not find it is misused .
thank you

Comment only
17 Oct 2016 Jason

Jason (view profile)

HI Hang Qian
I am using 2014a matlab ,is it possible that the error is caused by the version difference?

thank you

Comment only
17 Oct 2016 Hang Qian

Hang Qian (view profile)

Hi Jason,

Thank you for your interest in DCC MIDAS. The codes work on my computer. One reason that it might fail on yours is the "corr" function is overloaded by your own. The error message seemed to indicate that "corr" is not the original MATLAB function.

Comment only
17 Oct 2016 Jason

Jason (view profile)

Hi Hang Qian
I am using the DCC-midas command. I follow the
the code in the user guide
options = optimoptions('fmincon','Algorithm','active-set');
[estParamsStep1,¬,estParamsStep2,¬,Variance,LongRunVar,CorrMatrix,LongRunCorrMatrix]...
= DccMidas(Data,'Period',20,'NumLagsVar',36,'NumLagsCorr',144,...
'options',options,'ZeroLogL',1:3600,'mu0',0.001);
CorrMatrix = reshape(CorrMatrix,9,nobs)';
LongRunCorrMatrix = reshape(LongRunCorrMatrix,9,nobs)';
and the data is from the toolbox, NASDAQCOM, DEXJPUS, DGS10 .
but when I execute the code ,their is running error, the warning is
"错误使用 pe (line 54)
输入参数的数目不足。

出错 corr (line 3)
k=x(1)*price+x(2)*fund+x(3)*pe

出错 DccMidas (line 489)
sampleCorr = corr(Resid);
I can not get the correlation varience ,the code is just exactly the same as in the userguide .
thank you .

08 Sep 2016 Hang Qian

Hang Qian (view profile)

Hi mael Blanchet,

When that warning message shows up, the most likely reason is that the model fit is poor and the optimizer gets trapped somewhere other than the maximum point. In that case, usually we have to make adjustment on the model specification.

Comment only
07 Sep 2016 mael Blanchet

Hello,
Thank you for toolbox.
However, I have a problem with the Maximum Likelihood Estimator. The software displays a warning message: "Warning: Covariance matrix of estimators cannot be computed precisely due to inversion difficulty.

Warning: Matrix is close to singular or badly scaled. Results may be inaccurate."

Do you have any advice?

thank you.

Comment only
23 Jul 2016 Hang Qian

Hang Qian (view profile)

Hi Amor-Aniss,

The periods are in OutputForecast.YfDates. Weights such as RMFE and others are also retrieved from OutputForecast. Refer to the help header of the corresponding functions for details. Thank you.

Comment only
22 Jul 2016 Amor-Aniss Benmoussa

Hello , how I can know the period for estimating weight for the combination of forecasts with DMSFE or MSFE approach? For exemple the page 29 in the user guide.

thank you

Comment only
20 Jul 2016 Stephen Zhang

Hi Hang Qian,
Thank you very much.

Stephen

Comment only
19 Jul 2016 Hang Qian

Hang Qian (view profile)

Hi Stephen,

When 'Beta2Para' is set to be false, it fixes one parameter equal to one and varies the other parameter, so that the weights are monotone decreasing. Basically, the default behavior of the software is as you described.

For DccMidas, residuals can be changed if you replace Line 274-283 by whatever estimation method.

Thank you.

Comment only
19 Jul 2016 Stephen Zhang

Hi Hang Qian,
Thanks a lot for the toolbox. I am working on the GarchMidas and DccMidas and I have two questions:
1: For GarchMidas, when setting 'Beta2Para' to be true, we have two weights, w1 and w2. Based on Asgharian, How and Javed, 2013, its better to set w1 fixed equal to 1, and vary w2. Can we do this with the toolbox?
2: For DccMidas, the 2nd step estimation(the dcc part) is based on the residuals of the Garch-Midas, can we keep the second part but change the residuals to be from the basic Garch model?

Thank you for your concerns. I really appreciate your work on the toolbox.

Best,
Stephen Zhang

11 Jul 2016 chengyuan Ai

05 Jul 2016 Hang Qian

Hang Qian (view profile)

Hi luis,

The date matching algorithm is not perfect, and it could fail in some cases. You may try to append zero values to the end of the series and make them look as if they were estimation data points. This might help you if the program correctly aligns the estimation data. Also try to format your dates and data in the same format as those in the example file. They are so many ways to write down calendar dates, and I am not sure which format works better than other formats.

Comment only
04 Jul 2016 luis gomez

Hello:

I am not able to get the "Extended Forecast". In the subroutine there seems to be something wrong when calling "MixFreqData" because the structure I get back from it does not have the padded "Y" or the correct "X". I have quarterly data till 2016Q1 and monthly till march 2016 and I want to forecast 2016Q2. I'd really appreciate your help.

Regards

LMGZ

Comment only
06 Jun 2016 Test Topi

Dear Hang Qian,
Dear Eric,

many thanks for your responses.

Regards,
Topi

Comment only
01 Jun 2016 Eric

Eric (view profile)

Dear Test Topi:

I'd like to add to Hang's reply that the Engle, Ghysels and Sohn (REStat, 2013) paper suggests to profile the likelihood function to decide on the lag structure. Hang's reply is absolutely correct. If one wants to decide on lag length and also the aggregation level of say the RV measures in the long run component - then profiling is a good idea. See the aforementioned paper for further details

EG

Comment only
01 Jun 2016 Hang Qian

Hang Qian (view profile)

Dear Test Topi,

'NumLagsVar' specifies the number of lags in filtering the secular component by MIDAS weights in the first step estimation. In term of parameter estimation, there is no penalty of many lags, except that some initial values will be lost. It should be fine if the lag length is long enough to make the weights vanish to zero.

'NumLagsCorr' specifies the number of lags for the second step estimation of correlation matrix. The number of parameters does not increase, so a long lag length should be fine provided that there are sufficient amount of observations.

Comment only
01 Jun 2016 Test Topi

Dear Hang Qian,

many thanks for the quick response. However, I have one last question, hope is not to clumsy: is there a method in order to determine the optimal values for 'NumLagsVar' and 'NumLagsCorr'?

Thanks in advance.

Comment only
31 May 2016 Hang Qian

Hang Qian (view profile)

Dear Test Topi,

The DCC MIDAS codes support an arbitrary number of series. Just provide a T-by-n matrix input to the function DccMidas(...). The output variables CorrMatrix and LongRunCorrMatrix should be n-by-n-by-T. Of course, you might want to adapt the demo scripts appDCCMIDAS1 when you plot the results. For example, Line 44 and 45 can be reshaped as

CorrMatrix = reshape(CorrMatrix,n^2,nobs)';

LongRunCorrMatrix = reshape(LongRunCorrMatrix,n^2,nobs)';

Comment only
28 May 2016 Test Topi

Dear Hang Qian,

many thanks for the DCC MIDAS code. However, I wonder if it is possible to change the tri-variate code for DCC MIDAS in order to estimate a bi-variate DCC MIDAS model? Should I replace the output arguments for CorrMatrix and LongRunCorrMatrix?

Comment only
23 May 2016 Eric

Eric (view profile)

Dear Raphael:

In the ADL-MIDAS model one typically selects the Ylag using information criteria such as BIC - see e.g. Andreou, Ghysels and Kourtelos (JBES, 2013). For the Xlag, one typically uses a long enough lag such that the weights vanish to zero. The only downside of having too many lags is the loss of initial values at the start of the sample. With MIDAS polynomial there is no penalty in terms of parameter estimation when adding lags since the hyper parameters stay the same. Of course, that is not true with U-MIDAS or MIDAS with stepfunction - in which case one uses again information criteria

Comment only
22 May 2016 Raphael Zagaglia

Hi, I would like to know what is the procedure to choose the Ylag and Xlag in the model ? Is there any test to figure out which value must I use ?

Thanks in advance.

Comment only
20 May 2016 Hang Qian

Hang Qian (view profile)

Hi Hafize,
When we see the estimated covariance matrix is not positive definite in numerical maximum likelihood or nonlinear least squares, some causes are: 1) some parameters are not individually identified; 2) the numerical optimizer does not find a local maximum or minimum point; and 3) the data is not suitable for the proposed model. Some possible solutions: 1) try a more parsimonious model; 2) transform the data, either in the statistical or economic sense; and 3) change the starting values for numerical optimization and consider alternative solvers. Good luck!

Comment only
20 May 2016 Hafize

Hafize (view profile)

Hi Hang Qian,

Many thanks for the matlab code. I want to estimate monthly variance of returns using daily returns, but when I run the code, I get a warning saying that the covariance matrix is not positive definite and that's why get NaN for the standard deviations and t-values of the beta1 and beta2 parameters. Now I know that this can be a result of variables which are highly correlated (multicollineairty), but I have no idea how I can solve this, can you help me out?

Hafize

Comment only
16 May 2016 Hang Qian

Hang Qian (view profile)

Hi Joyce,

The codes you are running are different from those used in the original paper, so it can only replicate (or nearly replicate) a subset of results in the paper. The codes treat parameters symmetrically among equations and do not impose cross-equation constraints (i.e., some parameters are shared by multiple equations). It does not get the result of dcc=2. However, you can adapt the codes to impose constraints by modifying the subfunction fml(...) in line 526 – 683. Basically, you may reduce the length of the variable "params" and allocate it to various equations in the DCC-MIDAS regression.

Comment only
14 May 2016 Joyce L

Hi!
Thanks a lot for this matlab package.
I am studying DCC-Midas model and trying to replicate the empirical part of Colacito et al. (2011).After reading the userguide,I try to set the "MorePara"(DccMidas.m) to 1 and then I get a1 a2 a3&b1 b2 b3.Is this the result of DCC=3?
And I wonder if there is a way to get the result of dcc=2 using this packages?
Really sorry to bother you.
Thanks in advance.

Joyce

03 May 2016 Hang Qian

Hang Qian (view profile)

Hi Daisy,
Double check your data and make sure all the dates are properly recorded. The MATLAB internal function datevec throws an error message "Cannot parse date 0" when some dates look like a string of zero, say datevec('0'). Also, some users cannot run the program if their operating system locale is not US English, when MATLAB or EXCEL interprets the date string in a different way.

Comment only
03 May 2016 Daisy Doan

Hi Hang,
Thank you very much for pointing out the problem. I have adjusted my data to a balanced one with the same number of daily obs (19) in each month. However, when running MIDAS_ADL, I encountered the following errors:
Error using datevec (line 276)
Cannot parse date 0.

Error in MixFreqData (line 99)
DataYdateVec = datevec(DataYdate)

do you think explicitly specifying the format of the input string as'mm-dd-yyyy HH:MM:SS' will solve the problem?
Below is a sample of the data for Y
DATE VALUE
01/31/1974 -0.006483
02/28/1974 0.003119
03/31/1974 -0.021241
and for X:
DATE VALUE
01/02/1974 3.67E-06
01/03/1974 0.000474398
01/04/1974 7.40E-05
01/07/1974 6.41E-05

03 May 2016 Hang Qian

Hang Qian (view profile)

Hi Daisy,

Daily-monthly aggregation is unbalanced, and I am not sure if the program’s data-date conversion routine can work properly in that case. However, you may try Xlag = 22 so as to approximate daily-monthly aggregation. Does the program generate an error message or produce unreasonable results? If the program can still run, you may check the mixed frequency regression time frame displayed on the screen. It shows how the program matches y with X. Also, the output variable MixedFreqData will display the matched y and X matrices, based on which the nonlinear least squares are run. Good luck.

Comment only
02 May 2016 Daisy Doan

Hi Qian,
thank you for the MIDAS program. I try with monthly and daily data but it does not seem to work.
Here is the sample of my data:
Monthly data:
DATE VALUE
01/31/1974 -0.006483
02/28/1974 0.003119
03/31/1974 -0.021241
Daily
DATE VALUE
01/02/1974 3.67E-06
01/03/1974 0.000474398
01/04/1974 7.40E-05
01/07/1974 6.41E-05
and my codes:
[DataY,DataYdate] = xlsread('mydata1.xlsx','sheet1');
DataYdate1 = DataYdate(2:end,1);
datadatesformat1='dd/mm/yyyy';
DateYnum=datenum(DataYdate1,datadatesformat1);
datadatesformat2='mm/dd/yyyy';
DataYdate=datestr(DateYnum,datadatesformat2);
[DataX,DataXdate] = xlsread('mydata1.xlsx','sheet2');
DataXdate1 = DataXdate(2:end,1);
DateXnum=datenum(DataXdate1,datadatesformat1);
DataXdate=datestr(DateXnum,datadatesformat2);
Xlag = 0;
Ylag = 0;
Horizon = 1;
EstStart = '01/01/1989';
EstEnd = '01/01/2010'; % to match with Baker and Wurgler's period for investment sentiment.
Method = 'fixedWindow';
[OutputForecast,OutputEstimate,MixedFreqData,ExtendedForecast] = MIDAS_ADL(DataY,DataYdate,DataX,DataXdate)

[OutputForecast1,OutputEstimate1,MixedFreqData,ExtendedForecast] = MIDAS_ADL(DataY,DataYdate,DataX,DataXdate,...
'Xlag',Xlag,'Ylag',Ylag,'Horizon',Horizon,'EstStart',EstStart,'EstEnd',EstEnd,'Polynomial','beta','Method',Method);

Hope you can shed light into my problem. Many thanks.
Daisy

30 Apr 2016 ququxi

ququxi (view profile)

Hi Hang Qian,thank you for your work about MIDAS model! But when I run the data of China, I find the function doesn't converge to global optimal point!So I want to know if we can use simulated annealing algorithm to solve this problem with linear constraint!

20 Apr 2016 Hang Qian

Hang Qian (view profile)

Hi EMEL,
It appears that your MATLAB does not recognize the ‘private’ folder. It might be caused by some global preference that overloads the default file-system precedence. You may try the program on another machine. Also, you may consider dragging all the files out of the ‘private’ folder and place them into your current folder, or adding the folder on your MATLAB search path. Good luck!

Comment only
19 Apr 2016 EMEL ODABASI

Hi Hang Quian,

First of all many thanks for your sharing. I am a very new user of Matlab. Before uploding my own data in the toolbox, I tried to run programme. But It gives error as follows:

Undefined function or variable 'bnls_adl_new'.

Error in MIDAS_ADL>MIDAS_Estimate (line 462)
Results = bnls_adl_new(y,x,numofparams,output_type,polyconstr);

Error in MIDAS_ADL (line 315)
OutputEstimate = MIDAS_Estimate(EstY,EstX,EstLagY,EstXdate,polynomial,stepfun,almonDegree,nExoReg,ylagVec);

Error in appADLMIDAS1 (line 40)
[OutputForecast1,OutputEstimate1,MixedFreqData,ExtendedForecast] = MIDAS_ADL(DataY,DataYdate,DataX,DataXdate,...

How can I correct this error to obtain the results?

Thanks in advance
EMEL

Comment only
18 Apr 2016 Hang Qian

Hang Qian (view profile)

Hi Xiaojun,

Though the software supports a single macroeconomic variable, the GARCH-MIDAS with a single index series indeed could be a function of multiple macro series.... x = f(X,theta), where f is a linear function and X a set of macro series. The parameters theta were estimated along with the rest of the model. You will have to modify the codes and insert those macro series in the likelihood function. In the subfunction fML(...) starting from Line 432, you may replace the scalar theta0 by a vector theta0 and then add the macro series in that subfunction. It needs some coding work, but the model with multiple macro series is valid. You may consider the similar for DccMidas as well.

Yes, estParamsStep1 is 6-by-n estimated parameters for [mu;alpha;beta;theta;w;m] obtained from univariate GARCH-MIDAS models

Comment only
18 Apr 2016 Chu xiaojun

Hi Hang Qian,
First of all thanks for the toolbox.
When I run GARCH- MIDAS, I find only one macroeconomic variables X is supported. If I want to use N macroeconomic variables, i.e., X is TxN, how could it be implemented?
Is it possible with DccMidas code to run GARCH- MIDAS with N macroeconomic variables?
Is the estParamsStep1 GARCH- MIDAS result?
Thanks
Xiaojun

Comment only
12 Apr 2016 Hang Qian

Hang Qian (view profile)

Hi Aniss,

The codes address one high frequency regressor. In your case, one quarterly variable with one or more yearly variables. Thank you.

Comment only
12 Apr 2016 Amor-Aniss Benmoussa

Hello,
I have a very quick question. The code you provide is it enough to make a general MIDAS regression with annual data (low frequency) and quarterly (high frequencies) and also to do with a combination of quarterly indicators ?

Thank you!!

Aniss

Comment only
12 Apr 2016 Hang Qian

Hang Qian (view profile)

Hi KK Chen,

The MIDAS toolbox supports multiple low frequency regressors. Users may specify the name-value pairs 'ExoReg' and 'ExoRegDate', where the former is a matrix of low-frequency exogenous regressors and latter is a vector date of those regressors. There is a toolbox demo file appADLMIDAS4.m that illustrates how to include exogenous predictors in MIDAS regression.

Currently the toolbox handles a single high frequency regressor. Users may consider forecast combination if there are multiple high frequency regressors. Forecast combination might yield more robust prediction results. The toolbox demo file appADLMIDAS3.m shows an application of forecast combination.

Thank you!

Comment only
12 Apr 2016 KK Chen

Hi Qian,

May I know if the MIDAS function supports multi-factors of low frequency and high frequency data? It seems that the argument DataX and DataY in function MixFreqData only accept vector instead of a matrix.

Comment only
29 Mar 2016 Elle TIAN

Hi Qian,
May I ask you why, in the MidasGarch.m line 34, when plotting, you scaled LongRunVar by 252?
line 34:
plot(year(seq),sqrt(252*LongRunVar(seq)),'b-','LineWidth',2);

Comment only
28 Mar 2016 Amor-Aniss Benmoussa

Hi Hang Qian,
Thanks you!

I solved the problem, which came from the convertion of time in excel to Matlab.

Amor

Comment only
28 Mar 2016 Hang Qian

Hang Qian (view profile)

Hi Amor,

I just tried appADLMIDAS2 on Matlab 2015a, and the codes worked with no error messages. I am not sure about the cause of failure on your machine, but I guess these two possibilities:

* The xlsx file is not opened by the MS EXCEL server, and the loaded data series are different.

* The language locale is not U.S. English and the date format is different.

Anyway, after your modification of codes, would you be able to obtain the same results, which look like

RMSE Beta: 0.3146
RMSE Beta Non-Zero: 0.3311
RMSE Exp Almon: 0.3395
RMSE U-MIDAS: 0.3272
RMSE Stepfun: 0.3245
RMSE Almon: 0.3376

Thank you.

Comment only
26 Mar 2016 Amor-Aniss Benmoussa

Hi Hang Qian,

I use Matlabr2015a and I can not make the example appADLMIDAS2 (or others). I always get the following errors :

Index exceeds matrix dimensions.

Error in MixFreqData (line 264)
fprintf('Reg Y(%s) on ',datestr(EstYdate(m),2));

Error in MIDAS_ADL (line 255)
MixedFreqData = MixFreqData(DataY,DataYdate,DataX,DataXdate,xlag,ylag,horizon,estStart,estEnd,dispTime);

Error in appADLMIDAS1 (line 45)
[OutputForecast1,OutputEstimate1,MixedFreqData,ExtendedForecast] = MIDAS_ADL(DataY,DataYdate,DataX,DataXdate,...

I had to modify the Load data section of this code to be able to have my growth vectors as well as time:

% Load data
[DataY,DataYdate] = xlsread('mydata.xlsx','Sheet1');
DataYdate = DataYdate(2:end,1);
[DataX,DataXdate] = xlsread('mydata.xlsx','Sheet2');
DataXdate = DataXdate(2:end,1);

DataXgrowth = log(DataX(2:end,2)./DataX(1:end-1,2))*100;
DataYgrowth = log(DataY(2:end,2)./DataY(1:end-1,2))*100;

DataYdate = DataY(2:end,1);
DataXdate = DataX(2:end,1);

DataX=DataXgrowth;
DataY=DataYgrowth;

Thank you,

Amor

Comment only
23 Mar 2016 Hang Qian

Hang Qian (view profile)

Hi Nicolas,

I wrote the GARCH-MIDAS codes several months ago, and they are not the codes used in the original paper. The original codes can be found in the data archives of Review of Economics and Statistics:

https://dataverse.harvard.edu/dataverse/restat

You may search the item “Replication data for: Stock Market Volatility and Macroeconomic Fundamentals”.

I did not notice any problems in your specified input arguments, but I do not have the original data and thus are not aware of the source of discrepancy. For the realized volatility MIDAS models, the results obtained from my codes are usually similar to the original codes, given the exactly identical data (both the data source and the method to pre-treat the data have to be exactly the same).

Also, I feel that GARCH-MIDAS models are robust: the estimated parameters may vary, but the conditional variance patterns and forecasted volatility are similar. My suggestion is to focus on the graphs of the conditional volatility and check if surge and drop of the volatilities have good economic interpretations, and evaluate the predictive power of your estimated volatility model.

Thank you. Good luck!

Hang Qian

Comment only
23 Mar 2016 Nicolas Soemer

Hallo,
First of all thanks for the toolbox. Especially the GARCH-MiDaS is very useful to me.
I tried to replicate the results from the 2013 paper “Stock Market Volatility and Macroeconomic Fundamentals” by Engle, Ghysels and Sohn. I used the returns from Schwert’s page and transformed the IP and PPI series as described in the paper, to replicated the results. The descriptive statistics of the returns and macro time series fit. Unfortunately, the results of the regression – especially those with the macro variables – differ a lot. Therefore I was wondering was this matlab model used in the paper?
If yes, what is the correct value for the input arguments? I used 'ThetaM' ,true, 'Period’, 65, and 'NumLag', 16. (This is how I understand it was done in the paper.) Unfortunately, my results differ and are very sensitive to the Period value.

Regards, Nicolas

Comment only
02 Feb 2016 wang

wang (view profile)

Hi Hang Qian,
Thanks for your rely!
Best regards,
wang

Comment only
01 Feb 2016 Hang Qian

Hang Qian (view profile)

Hi Wang,

For volatility forecasting with a macroeconomic variable X, we need the value of X in the forecasting periods. Therefore, the length of y and X must be the same when we run the program GarchMidas. Otherwise, there will be an error message.

In your scripts, I saw 'X' is assigned a value xDay, which does not increases its size within the FOR loop. So you might want to expand the size of the variable xDay in order to match the size of yBig. For example, the codes would look like

xDayBig = [xDay;xNew];

where xNew is the value of the macroeconomic variable in a one-step forecasting period.

Thank you.

Comment only
31 Jan 2016 wang

wang (view profile)

Hi Hang Qian,
In out of sample forecast using direct marcoeconomic variable X, I encounter with an error message:
Error using GarchMidas (line 189)
Macroeconomic regressor must be a vector of the same length as y.
could you give me some advice
this code is shown as follows:
yBig = [y;0];
for t = 1:nForecast
[~,~,Variance,LongRunVar] = GarchMidas(yBig,'Period',period,'NumLags',numLags,'X',xDay,'LogTau',1,'ThetaM',1,'Beta2Para',1,'RollWindow',1,'Params',estParams);
yPseudo = estParams(1) + sqrt(Variance(end));
yBig = [yBig(1:end-1);yPseudo;0];
end

Comment only
03 Jan 2016 wang

wang (view profile)

Hi Hang qian,
Thank you very much for your rely.

Comment only
02 Jan 2016 Hang Qian

Hang Qian (view profile)

Hi Wang,

Thanks for your interests in the toolbox. In reply to your question about the out-of-sample forecast, the variable “yPseudo” is not an observation, but a mathematic construction such that its squared value can recover the conditional variance. Recall that the GARCH-MIDAS variances recursion is given by g(i,t) = (1-a-b) + a * (y(i-1,t)-mu)^2/tau + b*g(i-1,t). In an out-of-sample forecast, the squared yPseudo works as if it were the squared y(i-1,t) because the expected value of (yPseudo – mu)^2 equals the conditional variance. If you would like to add the residual “Resid”, you might want to find a variable whose squared value has the unit variance. Thank you.

Comment only
01 Jan 2016 wang

wang (view profile)

Hi Hang Qian,
thanks for your wondeful toobox. In Out-of-sample forecast, yPseudo = estParams(1) + sqrt(Variance(end)); why not is yPseudo = estParams(1) + sqrt(Variance(end))*Resid.

11 Nov 2015 Di Mo

Di Mo (view profile)

10 Nov 2015 Hang Qian

Hang Qian (view profile)

The “nobs” you saw is a scalar variable that keeps track of the number of observations. I am not aware in the codes that the variable is used before it is defined. You might check the line number that generates the error message?

Comment only
10 Nov 2015 Di Mo

Di Mo (view profile)

Hi Hang Qian,

Thank you for the quick reply. I have received another wrong message when running the GARCH-Midas Command. The error is as follows:

Undefined function or variable 'nobs'.

Do you have any suggestions on this?

Kind Regards
Di

Comment only
09 Nov 2015 Hang Qian

Hang Qian (view profile)

Hi Di,

The error message you saw is most likely a problem of older version of MATLAB. A few years ago, the Optimization Toolbox of MATLAB migrated optimset to optimoptions. If your MATLAB version is older than 2014a, the software will not recognize optimoptions. You may change optimoptions(...) by something like options = optimset(...).

Comment only
09 Nov 2015 Di Mo

Di Mo (view profile)

Hi Hang Qian,

Thank you very much for this wonderful Midas Toolbox. I just started with GarchMidas model and an error appeared as follows:

??? Undefined function or method 'optimoptions' for input arguments of type 'char'.

Error in ==> GarchMidas at 294
options = optimoptions('fmincon','Algorithm','interior-point','Display','notify-detailed');

Could you give me some advice on this please?

Thank you very much!

Best,
Di

Comment only
30 Oct 2015 Hang Qian

Hang Qian (view profile)

Hi Muhammad,

If your MATLAB version is earlier than R2014b, you may see an error message from the input parser. You will have to replace the name “addParameter” by “addParamValue”. They are the same thing, but the former is its new name. Thank you.

Comment only
29 Oct 2015 Muhammad Yudhistira

Hi Qian,

Thanks a lot for this great toolbox. I just start with MIDAS model, and trying one of the example in the toolbox: appADLMIDAS2. I encounter with this problem.

Error in ==> MIDAS_ADL at 201
parseObj.addParameter('Xlag',9,@(x)validateattributes(x,{'numeric','char'},{},callerName));

Could you give any suggestion?

Best

Comment only
13 Sep 2015 Hang Qian

Hang Qian (view profile)

Hi Yijie,

When you adjust the parameter ”Horizon”, it will shift the dates of the high frequency regressors backward or forward. Setting the Horizon = -2 indicates shift the dates two periods ahead. Depending on how many high frequency periods equal to a low frequency period, this may give you a nowcasting effect. When you run the program, the screen will show how the dates of low and high frequency regressions match each other in a regression. This time frame will be the same for both estimation and forecast.

Also, if you want to verify how the dates match, you may look at the output struct MixFreqData, in which the variables OutYdate and OutXdate are the dates of the low and high variables in the forecasting periods, respectively.

Comment only
13 Sep 2015 Hang Qian

Hang Qian (view profile)

Hi Jennifer,

The error message you saw is a date format issue. The program relies on the MATLAB function datevec to translate string dates to vector dates. It supports 14 date formats, but “01.04.1947” is not one of them. Refer to the documentation of the MATLAB function datevec.

You will have to replace 01.04.1947 by 04/01/1947 (or perhaps 01/04/1947?) Both R2015b and earlier versions of MATLAB use the same date convention. Therefore, the easiest solution is to change the date format in your dataset.

Comment only
09 Sep 2015 jennifer

Thanks for sharing useful toolbox.

The program didnt work on MATLAB R2015b. It gives following errors. Could you give some advice ?

Best

error using datevec (line 276)
Cannot parse date 01.04.1947.

Error in MixFreqData (line 99)
DataYdateVec = datevec(DataYdate);

Error in MIDAS_ADL (line 255)
MixedFreqData = MixFreqData(DataY,DataYdate,DataX,DataXdate,xlag,ylag,horizon,estStart,estEnd,dispTime);

Error in appADLMIDAS5 (line 49)
[OutputForecast1,OutputEstimate1,MixedFreqData,ExtendedForecast] = MIDAS_ADL(DataY,DataYdate,DataX,DataXdate,...

Comment only
05 Sep 2015 Yijie Huang

Hi Qian,

Thanks a million for this toolbox.

In your application 3, if setting the Horizon = -2,is it nowcasting GDP with monthly data? E.g. the forecast result is in 10/01/2009 is based one the 10/01/2009 - 12/01/2009 monthly data?

Thanks very much.

11 Aug 2015 Hang Qian

Hang Qian (view profile)

Hi David,

I guess the error message is most likely a MATLAB version issue. Double check that the Optimization Toolbox is installed and your MATLAB version is R2013b or newer.

If you have the Optimization Toolbox, the name-value pairs of the optimization options vary from version to version. If your software cannot recognize parameter names like 'LargeScale and 'Jacobian', simply remove it from the codes and use the default optimization setting.

If you do not have the Optimization Toolbox, the only way you can use this software is to change the solver. Replace the toolbox functions lsqnonlin or fmincon by fminsearch, which is available for the base MATLAB. Also remove the bounds constraints, as fminsearch does not support constrained optimization.

Thank you.

Comment only
10 Aug 2015 David Stephan

Thank you for a great toolbox. I am just getting started with MIDAS models and have been trying to follow the example in the user guide. Although everything works fine for models 4-6 I get a similar error for models 1-3.

For Models 1 and 2:
Error using optimset (line 219)
Unrecognized parameter name 'LargeScale'.

For Model 3 a similar error:
Error using optimset (line 219)
Unrecognized parameter name 'Jacobian'.

Any ideas what I am doing wrong?

Thanks again for a great toolbox

10 Aug 2015 Saeed

Saeed (view profile)

Thanks much Eric.

And yes I am using ExoReg to have couple of variables on the right hand side that have the same frequency as the dependent variable.

And yes you are totally correct, I can improve upon simple averaging by using more sophisticated forecast combination approaches.

Thanks,
Saeed

Comment only
10 Aug 2015 Eric

Eric (view profile)

Dear Saeed:

Thanks for your kind words about the MIDAS Matlab Toolbox.

You are correct that multiplicative MIDAS is not yet implemented. Empirical evidence seems to indicate that regular MIDAS specifications typically do better though.

Regarding your question of adding leads of another variable which you call var2. In principle you can use the ExoReg specification to do this, if you properly align the var2 series. So, you can do the direct estimation, assuming that the var2 is not a variable you estimate via a MIDAS polynomial.

Otherwise, if the var2 series is also high frequency it is much easier to run two MIDAS regressions with leads, one for var1 and one for var2, and do forecast combination. You mention that you simply take the average. That is typically not a good idea. Better forecast combination methods exist and are available in the Toolbox

EG

Comment only
09 Aug 2015 Saeed

Saeed (view profile)

Dear Eric and Hang:
First of all, I have found the toolbox extremely useful and the accompanying user guide quite detailed and very well written, and so many thanks for making this availabe to all.

Secondly, I am assuming that multiplicative MIDAS is still not implemented (page 16 of the userguide mentions it as well). I ask, because many papers published do seem to apply multiplicative MIDAS such as Andreou, Ghysels, and Kourtellos (2013): Should macroeconomic forecasters look at daily financial data? (JBES).

So currently, I am using daily series named var1 with leads to forecast a monthly series Y. But on the right hand side I also want to have leads of another variable, var2. Since I cannot use multiplicative MIDAS, so I run one MIDAS regression using only leads of var1, and then I run another MIDAS regression using only leads of var2. I average the two forecasts of Y. But it will be nice to just run "one" MIDAS regression that allows for leads of both variables var1, and var2.

Any help in that regard will be very much appreciated. Thanks in advance.

Comment only
30 Jul 2015 Eric

Eric (view profile)

Dear Philippe:

This is essentially a question about mixed frequency VAR models. There is a literature on this. See for example the paper entitled "Macroeconomics and the reality of mixed frequency data", forthcoming in the Journal of Econometrics which I wrote. Estimation can be done with standard VAR packages.

Regards,

EG

Comment only
29 Jul 2015 Philippe

Hello,
Is it possible with this code to run multivariate MIDAS regressions? If not, how could it be implemented?

Regards,
Philippe

Comment only
08 May 2015 Eric

Eric (view profile)

Dear Du-hyun:

The MIDAS Toolbox only covers MIDAS regression analysis. To my knowledge there is no user friendly MIDAS volatility model code publicly available. Still to be done, unfortunately. However, it is not so difficult to start from Matlab ARCH-type code and replace the volatility dynamics with a MIDAS polynomial specification. It would not be generic, but easy to tailor to a specific application you have in mind.

I agree that it would be useful to have generic MIDAS volatility code publicly available. I've had discussions with Hang on this topic.

Sincerely,

Eric Ghysels

Comment only
08 May 2015 Du-hyun Cho

It is honor to say to you Eric
Actually, I am deeply interested asymmetric MIDAS model in your paper "There is risk return tradeoff after all"

One of my focuses is finding empirical relations between risk and return though estimating ICAPM model in Asian Pacific stock market.

Anyway I found a related toolbox manual

the ULR is that
http://pages.stern.nyu.edu/~ehedegaa/PDFs/MidasManual.pdf

However, there was only manual of a toolbox but I couldn't find original toolbox still.

If I wouldn't be bothering you, I want to ask a help about the toolbox.

Anyway,thank you for giving a change to me describing my focus. I will wait your answer Thank you very much

Comment only
08 May 2015 Du-hyun Cho

It is honor to say to you Eric
Actually, I am deeply interested asymmetric MIDAS model in your paper "There is risk return tradeoff after all"

One of my focuses is finding empirical relations between risk and return though estimating ICAPM model in Asian Pacific stock market.

Anyway I finded a related toolbox manual

the ULR is that
http://pages.stern.nyu.edu/~ehedegaa/PDFs/MidasManual.pdf

However, there was only manual of a toolbox but I couldn't find original toolbox still.

If I wouldn't be bothering you, I want to ask a help about the toolbox.

Anyway,thank you for giving a change to me describing my focus. I will wait your answer Thank you very much

07 May 2015 Eric

Eric (view profile)

Dear Du-hyun:

Would you mind being more specific about asymmetric MIDAS - what exactly you are thinking of?

Thanks

Eric Ghysels

Comment only
07 May 2015 Du-hyun Cho

Thnak you very much for your kindness
I tried again as I mentioned before and there is no problem the error message has been completely removed.

If it wouldn't be annoying you, I want to ask one more question with respect to asymmetric MIDAS regression.

first, is this code available for asymmetric MIDAS? or needed to change some codes or syntax of this toolbox.

I tried to find asymmetric model form Eric Ghysels homepage and other authors of academic papers related to MIDAS model but this is not really easy task to find it.

could you give me an idea? I shall wait your answer

06 May 2015 Hang Qian

Hang Qian (view profile)

Hi Du-hyun,

Thank you for catching that.

The error message at Line 392 pops up after parameter estimation. The estimation results have displayed on the screen. This line just makes date display more beautiful. The error comes from reshaping a vectorized empty matrix; it changes the row/column dimension of an empty matrix.

I have updated the codes. The error message should disappear.

Comment only
06 May 2015 Du-hyun Cho

Hi Qian

firstly, Thanks for uploading the toolbox

Actually, I wander how to use DL MIDAS model in this tool box.

I tried several times Ylag = 0 in the toolbox because, in my research, autoregression terms do not needed.

unfortunately, there is several error massage in matlab like

Error : MIDAS_ADL (line 392)
MixedFreqData.EstLagYdate = reshape(cellstr(datestr(MixedFreqData.EstLagYdate)),size(MixedFreqData.EstLagYdate));

is there any method to clean that error?

Comment only
06 May 2015 Hang Qian

Hang Qian (view profile)

Hi Ruizhi,

I did not test and do not know whether the program can work properly using minute or second data, but you may have a try. DataXdate and DataYdate follow the MATLAB supported time format. For example, 01-Mar-2000 15:45:17 and 2000-03-01 15:45:17 can be recognized by MATLAB.

Thank you.

Comment only
05 May 2015 Ruizhi Ma

Hello! Really thanks for the upload! I'm curious about using intra-daily data to forecast daily stock returns by MIDAS, how can I write the DataXdate and DataYdate ? Thank you!

Comment only
05 May 2015 Anni208

Thank you for the very fast answer!
I will follow your advice!

Comment only
04 May 2015 Hang Qian

Hang Qian (view profile)

Hi Anni208,

The date string '01.04.1947' is not a supported MATLAB date format, so it cannot be parsed by the program. MATLAB has 14 supported formats, such as '01/04/1947', '1947-01-04', '04-Jan-1947', 'Jan.01,1947', etc.. If you could change your date format to one of the supported formats, the error message will disappear.

You may refer to this page for the MATLAB date string format:

http://www.mathworks.com/help/matlab/ref/datevec.html

Thank you.

Comment only
04 May 2015 Anni208

Hello!
I'm very cuurious to try your code unfortunately while running appADLMIDAS1.m I receive the following error message:

Error using datevec (line 277)
Cannot parse date 01.04.1947.

Why is there a problem with datevec? Can you please help me with this?
Thanks in advance!
Anni208

Comment only
27 Apr 2015 WMendieta89

Thank you very much for your reply! It worked!

Thanks again for this great toolkit.

William M.

Comment only
14 Apr 2015 Hang Qian

Hang Qian (view profile)

Hi WMendieta,
MIDAS uses a direct multi-step forecast. For example, if we want a 3-step ahead forecast, we specify a MIDAS model as
Y(t+3) = b0 + b1*Y(t) + b2*Y(t-1) + ... + high frequency regressor terms X(j,t-i), j=1,...,Nd, i = 0,1,2,...
Similarly, for a 5-step ahead forecast, we use a model like
Y(t+5) = b0 + b1*Y(t) + b2*Y(t-1) + ... + high frequency regressor terms X(j,t-i), j=1,...,Nd, i = 0,1,2,...
By direct forecast, we mean the left hand side of the model is the h-step ahead dependent variable. This is in contrast to the iterated forecast in an autoregressive model.
Please refer to Section 2.3 of the MIDAS user guide for the multi-step forecast:
http://www.unc.edu/~eghysels/papers/MIDAS_Usersguide_V1.0.pdf
For the software usage, put the lagged dependent variables in 'ExoReg' and then adjust the name-value pair 'Horizon' accordingly.
Thank you.

Comment only
13 Apr 2015 WMendieta89

Hi! Thanks for uploading this toolbox! I wonder how do you perform h-step ahead forecast using this toolbox? I have performed 1 step ahead out-of-sample forecast but i´ve been unable to do so for h-step ahead forecasts

thanks in advanced,

WMendieta

Updates
08 Apr 2014 1.1

Allow leads and lags specification 'horizon' be negative.

Add true out-of-sample forecast; results are restored in the last output argument 'Extended Forecast' struct.

06 May 2015 1.2

Support the special case DL_MIDAS by setting Ylag = 0

09 Jun 2015 1.2

Update the user guide (version Dec 21, 2014)

16 Jul 2015 1.5

Support Ylag as a cell array such as Ylag = {3,6,9} for flexible low frequency lagged regressors
Support Xlag = 0, so that the high frequency regressors are suppressed. OLS results will be produced.
User guide is updated to the version July 16, 2015

01 Nov 2015 2.0

Add GARCH-MIDAS and DCC-MIDAS functions

01 Nov 2015 2.0

Update the toolbox title from "MIDAS Regression" to "MIDAS Matlab Toolbox"

01 Nov 2015 2.0

Package written by Eric Ghysels and collaborators

06 Aug 2016 2.1

version2.1 Add MIDAS quantile regression

15 Oct 2016 2.2

Update user guide

09 Jan 2017 2.2

Fix a bug in DccMIDAS FMINSEARCH when MATLAB Optimization Toolbox is not available.

Contact us