Diebold and Mariano test for predictive accuracy
rdb = diebmar(namey,arg1,...,argn)
* namey = observed vector TS: a time series, a real (nx1) vector or a string equal to the name of a time series or a (nx1) real vector between quotes
* argi = arguments which can be:
- 2 time series (the first serie is the benchmark model)
- a real (nx2) vector
- a real (nx2) matrix
- a string equal to the name of a time series or a (nx2) real vector or matrix between quotes
- a list of such elements
- 'smallc =1' if the user want to perform a small sample correction will be done (optional; default = 0: no small sample correction)
- 'trunc = xx' truncation point of the bartlett window (optional; default = floor(5*nobs^0.25))
- the string 'noprint' if the user doesn't want to display the results of the regression
- 'dropna' if the user wants to remove the NA values from the data
* rdb = a results tlist with
- rdb('meth') = 'diebmar'
- rdb('y') = input forecasted series
- rdb('x') = forecasts resp. under the null hypothesis and forecast under the alternative hypothesis
- rdb('namey') = name of forecasted serie
- rdb('namex') = names of forecasts resp. under the null hypothesis and under the alternative hypothesis
- rdb('mse') = vector of MSE
- rdb('stat') = value of the Diebold-Mariano statistics
- rdb('pvalue') = p-value of the Diebold-Mariano statistics
- rdb('smallc') = flag for a small sample correction
- rdb('trunc') = truncation lag of the Barlett window
- rdb('prests') = flag for the presence of time series
- rdb('bounds') = if there is a timeseries in the forecast, the bounds of the regression
- rdb('dropna') = boolean indicating if NAs have been droped
- rdb('nonna') = vector indicating position of non-NAs (if the option 'dropna' was active)
bounds('1979q1','2003q4'); ri = rolreg('delts(log(y))','ypast','delts(yfut)','cte',... 'dates=[''1992q1'',''2003q4'']','hstep=1'); rb = rolreg('delts(log(y))','delts(lagts(log(y)))','delts(lagts(2,log(y)))','cte',... 'dates=[''1992q1'',''2003q4'']','hstep=1'); bounds(); y_indic =ri('yfor'); y_bench = rb('yfor'); bounds('1992q2','2003q4'); // select an appropriate sample period rdb=diebmar('delts(log(y))','y_bench','y_indic','smallc=1','trunc=4") //Examples taken from function diebmar_d(). The forecasted series is delts(log(y)), the benchmark series is y_bench, the alternative one is y_indic. Here, a small sample correction is performed and the Barlett window is truncated at 4 lags. rdb=diebmar('delts(log(y))','y_bench','y_indic','smallc=1') // Now, a small sample correction is performed and the Barlett window is automatically determined rdb=diebmar('delts(log(y))','y_bench','y_indic') // Now, no small sample correction is performed and the Barlett window is the same as in example 2. | ![]() | ![]() |