Article Contents
Article Contents

# Hidden Markov models with threshold effects and their applications to oil price forecasting

• * Corresponding author
• In this paper, we propose a Hidden Markov Model (HMM) which incorporates the threshold effect of the observation process. Simulated examples are given to show the accuracy of the estimated model parameters. We also give a detailed implementation of the model by using a dataset of crude oil price in the period 1986-2011. The prediction of crude oil spot price is an important and challenging issue for both government policy makers and industrial investors as most of the world's energy comes from the consumption of crude oil. However, many random events and human factors may lead the crude oil price to a strongly fluctuating and highly non-linear behavior. To capture these properties, we modulate the mean and the variance of log-returns of commodity prices by a finite-state Markov chain. The $h$-day ahead forecasts generated from our model are compared with regular HMM and the Autoregressive Moving Average model (ARMA). The results indicate that our proposed HMM with threshold effect outperforms the other models in terms of predicting ability.

Mathematics Subject Classification: Primary: 90C40, 90C15; Secondary: 60J05.

 Citation:

• Figure 1.  µ

Figure 2.  σ

Figure 3.  A1

Figure 4.  A2

Figure 5.  Prediction

Figure 6.  Year 2011

Table 1.  Accuracy of estimated parameters

 It=5, ${\rm It}_{\rm r}$=10 It=10, ${\rm It}_{\rm r}$=20 It=15, ${\rm It}_{\rm r}$=30 MAE RMSE SSE MAE RMSE SSE MAE RMSE SSE $\mu_1$ 0.2105 0.3055 4.6652 0.2373 0.3232 5.2230 0.2583 0.3462 5.9937 $\mu_2$ 0.3028 0.3936 7.7456 0.3021 0.3773 7.1170 0.2821 0.3643 6.6375 $\mu_3$ 0.2372 0.3330 5.5452 0.2484 0.3258 5.3082 0.2781 0.3745 7.0111 $\sigma_1$ 0.1641 0.2285 2.6099 0.1804 0.2404 2.8899 0.2321 0.3385 5.7275 $\sigma_2$ 0.2396 0.3266 5.3347 0.2408 0.3287 5.4033 0.2494 0.3350 5.6124 $\sigma_3$ 0.2243 0.3114 4.8493 0.2462 0.3250 5.2813 0.2115 0.2788 3.8873 $a^1_{11}$ 0.3038 0.3637 6.6139 0.3768 0.4281 9.1632 0.2863 0.3344 5.5903 $a^1_{12}$ 0.3456 0.4060 8.2436 0.2979 0.3799 7.2170 0.3022 0.3526 6.2180 $a^1_{13}$ 0.2419 0.3059 4.6793 0.3467 0.4280 9.1571 0.3021 0.3642 6.6336 $a^1_{21}$ 0.2338 0.2981 4.4419 0.2488 0.3076 4.7312 0.2556 0.3086 4.7619 $a^1_{22}$ 0.2895 0.3597 6.4692 0.2979 0.3631 6.5927 0.3408 0.4053 8.2130 $a^1_{23}$ 0.2913 0.3469 6.0166 0.3329 0.3895 7.5851 0.3155 0.3786 7.1687 $a^1_{31}$ 0.2140 0.2742 3.7592 0.2687 0.3223 5.1940 0.3125 0.3757 7.0575 $a^1_{32}$ 0.3032 0.3512 6.1654 0.2646 0.3207 5.1414 0.2750 0.3268 5.3387 $a^1_{33}$ 0.2498 0.3233 5.2261 0.2997 0.3510 6.1592 0.3013 0.3629 6.5848 $a^2_{11}$ 0.2499 0.2963 4.3883 0.2597 0.3260 5.3139 0.2878 0.3671 6.7391 $a^2_{12}$ 0.3213 0.3809 7.2547 0.2946 0.3569 6.3691 0.2896 0.3631 6.5922 $a^2_{13}$ 0.2939 0.3453 5.9599 0.2746 0.3301 5.4489 0.3085 0.3638 6.6193 $a^2_{21}$ 0.2613 0.3335 5.5595 0.2789 0.3375 5.6964 0.3076 0.3629 6.5858 $a^2_{22}$ 0.2988 0.3511 6.1621 0.2791 0.3417 5.8363 0.3134 0.3695 6.8273 $a^2_{23}$ 0.3027 0.3638 6.6178 0.3301 0.3938 7.7553 0.3298 0.3947 7.7913 $a^2_{31}$ 0.3093 0.3620 6.5520 0.2088 0.2808 3.9438 0.2558 0.3121 4.8694 $a^2_{32}$ 0.2781 0.3270 5.3472 0.2779 0.3310 5.4777 0.2969 0.3636 6.6100 $a^2_{33}$ 0.3370 0.4104 8.4216 0.3540 0.4139 8.5662 0.3264 0.3925 7.7025 $r$ 1.3506 2.0633 212.8582 0.8303 1.4174 100.4480 0.5571 0.8851 39.1680

Table 2.  Accuracy of predictions

 Step MAE MAPE RMSE THMM HMM ARMA THMM HMM ARMA THMM HMM ARMA 1 0.6571 0.6772 38.5056 70.1171 70.1162 70.6075 1.2772 1.2900 44.6933 2 0.8618 0.8767 38.4588 70.1171 70.1157 70.6071 1.5165 1.5291 44.6933 3 1.0943 1.1075 38.2271 70.1170 70.1152 70.6048 1.7544 1.7672 44.3661 4 1.3337 1.3252 38.5154 70.1191 70.1168 70.6107 2.1103 2.1094 44.4763 5 1.5809 1.5720 38.1649 70.1200 70.1171 70.6049 2.4751 2.4744 44.2075 6 1.7653 1.7512 39.0297 70.1190 70.1157 70.6191 2.6917 2.6858 44.8844 7 1.9091 1.9004 37.9088 70.1182 70.1143 70.6022 2.8747 2.8849 43.8580 8 2.0631 2.0395 36.8175 70.1197 70.1153 70.5854 3.1950 3.1885 42.8849 9 2.3027 2.2690 37.0833 70.1225 70.1176 70.5901 3.4312 3.4062 43.0634 10 2.4098 2.3912 37.0323 70.1221 70.1168 70.5893 3.6031 3.6021 43.0214 11 2.4520 2.4237 38.0120 70.1213 70.1153 70.6041 3.6323 3.6301 43.9126 12 2.7095 2.6502 38.3527 70.1256 70.1192 70.6088 3.9464 3.9046 44.2681 13 2.7674 2.7020 38.2748 70.1234 70.1166 70.6077 3.9701 3.9416 44.1929 14 3.1003 3.0394 38.7028 70.1207 70.1132 70.6143 4.6993 4.7048 44.5676 15 3.3073 3.2407 39.8606 70.1216 70.1138 70.6318 4.8768 4.8855 45.6269 16 3.0475 2.9143 39.8835 70.1256 70.1173 70.6321 4.2991 4.2164 45.6542 17 3.2624 3.2002 38.7757 70.1220 70.1131 70.6147 4.9488 4.9643 44.7068 18 3.8019 3.7099 38.6336 70.1287 70.1195 70.6121 5.3424 5.2526 44.6244 19 3.3387 3.2340 39.8483 70.1258 70.1160 70.6302 4.6491 4.5823 45.7631 20 3.5091 3.4241 39.9252 70.1265 70.1162 70.6313 5.0282 4.9773 45.8393

Table 3.  Directional Forecasts

 Step Harding-Pagan Test THMM HMM ARMA 1 0.3475 0.5111 0.4737 2 0.2158 0.2786 0.4569 3 0.1403 0.1494 0.4443 4 0.1479 0.1515 0.4559 5 0.1378 0.1337 0.4382 6 0.1474 0.1489 0.4321 7 0.1312 0.1302 0.4311 8 0.1398 0.1383 0.4265 9 0.1398 0.1393 0.4235 10 0.1530 0.1570 0.4281 11 0.1555 0.1525 0.4326 12 0.1520 0.1459 0.4265 13 0.1575 0.1494 0.4306 14 0.1611 0.1631 0.4250 15 0.1601 0.1575 0.4250 16 0.1702 0.1636 0.4235 17 0.1499 0.1525 0.4159 18 0.1738 0.1651 0.4169 19 0.1651 0.1520 0.4139 20 0.1550 0.1550 0.4144

Table 4.  The Diebold-Mariano Test

 Step DM Test based on THMM and HMM DM Test based on THMM and ARMA 1 -7.3944 -39.8539 2 -3.5605 -23.0956 3 -1.9302 -18.0701 4 0.0952 -15.6151 5 0.0506 -13.6254 6 0.3246 -12.6574 7 -0.4322 -11.4710 8 0.2511 -10.4746 9 0.8516 -9.9699 10 0.0270 -9.4191 11 0.0532 -9.0919 12 0.9990 -8.6963 13 0.5196 -8.3548 14 -0.0829 -8.0797 15 -0.1185 -7.9669 16 1.2755 -7.6941 17 -0.1728 -7.2728 18 1.1428 -6.9931 19 0.8583 -6.9341 20 0.5422 -6.7681
•  [1] W. K. Ching, T. K. Siu, L. M. Li, T. Li and W. K. Li, Modeling default data via an interactive hidden Markov model, Computational Economics, 34 (2009), 1-19.  doi: 10.1007/s10614-009-9183-5. [2] E. G. De Souza e Silva, L. Legey and E. A. De Souza e Silva, Forecasting oil price trends using wavelet and hidden Markov models, Energy Economics, 32 (2010), 1507-1519. [3] F. X. Diebold and R. Mariano, Comparing predictive accuracy, Journal of Business and Economic Statistics, 13 (1995), 253-265. [4] R. J. Elliott, L. Aggoun and J. Moore, Hidden Markov Models: Estimation and Control, Springer, New York, 1995. [5] R. J. Elliott, L. L. Chan and T. K. Siu, Option pricing and Esscher transform under regime switching, Annals of Finance, 1 (2005), 423-432.  doi: 10.1007/s10436-005-0013-z. [6] R. J. Elliott, C. C. Liew and T. K. Siu, On filtering and estimation of a threshold stochastic volatility model, Applied Mathematics dand Computation, 218 (2011), 61-75.  doi: 10.1016/j.amc.2011.05.052. [7] R. J. Elliott, T. K. Siu and A. Badescu, On mean-variance portfolio selection under a hidden Markovian regime-switching model, Economic Modelling, 27 (2010), 678-686.  doi: 10.1016/j.econmod.2010.01.007. [8] R. J. Elliott, T. K. Siu and A. Badescu, On pricing and hedging options in regime-switching models with feedback effect, Journal of Economic Dynamics and Control, 35 (2011), 694-713.  doi: 10.1016/j.jedc.2010.12.014. [9] R. J. Elliott, T. K. Siu and J. W. Lau, Filtering a double threshold model with regime switching, IEEE Transactions on Automatic Control, 58 (2013), 3185-3190.  doi: 10.1109/TAC.2013.2261186. [10] R. J. Elliott, T. K. Siu and H. L. Yang, Ruin theory in a hidden Markov-modulated risk model, Stochastic Models, 27 (2011), 474-489.  doi: 10.1080/15326349.2011.593408. [11] R. J. Elliott and J. van der Hoek, An application of hidden Markov models to asset allocation problems, Finance and Stochastic, 1 (1997), 229-238.  doi: 10.1007/s007800050022. [12] C. Erlwein and R. Mamon, An online estimation scheme for a Hull and White model with HMM-driven parameters, Statistical Methods and Applications, 18 (2009), 87-107.  doi: 10.1007/s10260-007-0082-4. [13] C. Erlwein, R. Mamon and M. Davison, An examination of HMM-based investment strategies for asset allocation, Applied Stchastic Models in Business and Industry, 27 (2011), 204-221.  doi: 10.1002/asmb.820. [14] G. Frey, M. Manera, A. Markandya and E. Scarpa, Econometric models for oil price forecasting, A Critical Survey CESinfo Forum, 10 (2009), 29-44. [15] D. Harding and A. R. Pagan, Synchronisation of Cycles, mimeo., Australian National University. [16] H. G. Huntington, Oil price forecasting in the 1980s: What went wrong?, The Energy Journal, 15 (1994), 1-22.  doi: 10.5547/ISSN0195-6574-EJ-Vol15-No2-1. [17] R. K. Kaufman, S. Dees, P. Karadeloglou and M. Sanchez, Does OPEC matter? An econometric analysis of oil prices, The Energy Journal, 25 (2004), 67-90.  doi: 10.5547/ISSN0195-6574-EJ-Vol25-No4-4. [18] M. W. Korolkiewica and R. J. Elliott, Smoothed parameter estimation for a Markov model of credit quality, Hidden Markov Models in Finance, Springer, New York, 104 (2007), 69–90. doi: 10.1007/0-387-71163-5_5. [19] C. C. Liew and T. K. Siu, A hidden Markov regime-switching model for option valuation, Insurance: Mathematics and Economics, 47 (2010), 374-384.  doi: 10.1016/j.insmatheco.2010.08.003. [20] R. S. Mamon, C. Erlwein and R. B. Gopaluni, Adaptive signal processing of asset price dynamics with predictability analysis, Information Sciences, 178 (2008), 203-219.  doi: 10.1016/j.ins.2007.05.021. [21] T. K. Siu, W. K. Ching, E. Fung, M. Ng and X. Li, A high-order Markov-switching model for risk measurement, Computers and Mathematics with Applications, 58 (2009), 1-10.  doi: 10.1016/j.camwa.2008.10.099. [22] T. K. Siu, W. K. Ching, E. S. Fung and M. K. Ng, Extracting information from spot interest rates and credit ratings using double higher-order hidden Markov models, Computational Economics, 26 (2005), 251-284. [23] S. J. Taylor, Asset Price Dynamics, Volatility, and Prediction, Princeton University Press, Princeton, 2005. doi: 10.1515/9781400839254. [24] H. Tong, Determination of the order of a Markov chain by Akaike's information criterion, Journal of applied probability, 12 (1975), 488-497.  doi: 10.1017/S0021900200048294. [25] H. Tong, On a threshold model, Pattern Recognition and signal processing, NATO ASI Series E: Applied Sc. No. 29, ed. C.H.Chen. The Netherlands: Sijthoff & Noordhoff, (1978), 575-586. [26] H. Tong, A view on non-linear time series model building, Time Series, ed. O. D. Anderson, Amsterdam: North-Holland, 1980, 41–56. [27] H. Tong, Threshold Models in Non-linear Time Series Analysis, Lecture Notes in Statistics, No. 21, Springer-Verlag, New York, 1983. doi: 10.1007/978-1-4684-7888-4. [28] H. Tong, Non-linear Time Series: A Dynamical System Approach, Oxford University Press, Oxford, 1990. [29] W. Xie, L. Yu, L. Xu and S. Wang, A new method for crude oil price forecasting based on support vector machines, International Conference on Computational Science, (Part Ⅳ), 3994 (2006), 444-451.  doi: 10.1007/11758549_63. [30] M. Ye, J. Zyren and J. Shore, Forecasting crude oil spot price using OECD petroleum invenvory levels, International Advances in Economic Research, 8 (2002), 324-333. [31] M. Ye, J. Zyren and J. Shore, A monthly crude oil spot price forecasting model using relative inventories, International Journal of Forecasting, 21 (2005), 491-501.  doi: 10.1016/j.ijforecast.2005.01.001. [32] M. Zakai, On the optimal filtering of diffusion processes, Zeitschrift für Wahrscheinlichkeitstheorie und Verwandte Gebiete, 11 (1969), 230-243.  doi: 10.1007/BF00536382.

Figures(6)

Tables(4)