We’re sorry, something doesn't seem to be working properly.

Please try refreshing the page. If that doesn't work, please contact support so we can address the problem.

We’re sorry, something doesn't seem to be working properly.

Please try refreshing the page. If that doesn't work, please contact support so we can address the problem.


Using Markov-switching models with Markov chain Monte Carlo inference methods in agricultural commodities trading

We’re sorry, something doesn't seem to be working properly.

Please try refreshing the page. If that doesn't work, please contact support so we can address the problem.

  • 15 Accesses


In this work, the use of Markov-switching GARCH (MS-GARCH) models is tested in an active trading algorithm for corn and soybean future markets. By assuming that a given investor lives in a two-regime world (with low- and high-volatility time periods), a trading algorithm was simulated (from January 2000 to March 2019), which helped the investor to forecast the probability of being in the high-volatility regime at t + 1. Once this probability was known, the investor could decide to invest either in commodities, during low-volatility periods or in the 3-month US Treasury bills, during high-volatility periods. Our results suggest that the Gaussian MS-GARCH model is the most appropriate to generate alpha or extra returns (from a passive investment strategy) in the corn market and the t-Student MS-GARCH is the best one for soybean trading.

This is a preview of subscription content, log in to check access.

Access options

Buy single article

Instant unlimited access to the full article PDF.

US$ 39.95

Price includes VAT for USA

Subscribe to journal

Immediate online access to all issues from 2019. Subscription will auto renew annually.

US$ 99

This is the net price. Taxes to be calculated in checkout.

Fig. 1

Source: Own elaboration with data from our simulations and input data from Thomson Reuters (2018)

Fig. 2

Source: Own elaboration with data from our simulations and input data from Thomson Reuters (2018)


  1. 1.

    A method that later Pelletier (2006) would improve without the presence of factors and Rotta and Valls Pereira (2016)would use for the Latin American case.

  2. 2.

    The most relevant research in the subject will be discussed in the next section.

  3. 3.

    The previous literature review gives some proofs of this statement.

  4. 4.

    With zero mean and a finite scale parameter for each regime.

  5. 5.

    With finite degrees of freedom \( (\nu_{s} ) \).

  6. 6.

    For the sake of simplicity in the calculations made in our simulations, an MS-GARCH model with only one lag in the ARCH and GARCH terms will be used. This was done by following the estimation method of the MSGARCH (2016) library that only estimates one lag in these terms.

  7. 7.

    With the method proposed by Kim (1994).

  8. 8.

    That is, the same pdf at \( t \) for both regimes.

  9. 9.

    As will be mentioned in more detail in the next two sections, weekly simulations of the investment system were made from 7 January 2000 to 29 March 2019. As a consequence, the simulation period has 1004 weeks or simulation dates.

  10. 10.

    With \( p_{D} = \left( {\text{TM}} \right)^{ - 1} \sum\nolimits_{m = 1}^{M} {\sum\nolimits_{t = 1}^{T} {{\text{LLF}}\left( {r,\theta_{i,j} } \right) - {\text{LLF}}\left( {r,{\acute{\theta}}} \right)} } \) and \( {\acute{\theta}} = \left( {NM} \right)^{ - 1} \sum\nolimits_{m = 1}^{M} {\sum\nolimits_{t = 1}^{T} {\theta_{i,j} } } \). Being \( M \) the number of simulations and \( T \) the time series length.


  1. Ailliot P, Bessac J, Monbet V, Pène F (2015) Non-homogeneous hidden Markov-switching models for wind time series. J Stat Plan Inference 160:75–88. https://doi.org/10.1016/J.JSPI.2014.12.005

  2. Akaike H (1974) A new look at the statistical model identification. IEEE Trans Autom Control 19:716–723. https://doi.org/10.1016/J.CUB.2017.09.001

  3. Alizadeh AH, Nomikos NK, Pouliasis PK (2008) A Markov regime switching approach for hedging energy commodities. J Bank Finance 32:1970–1983. https://doi.org/10.1016/j.jbankfin.2007.12.020

  4. Aloui C, Jammazi R (2009) The effects of crude oil shocks on stock market shifts behaviour: a regime switching approach. Energy Econ. https://doi.org/10.1016/j.eneco.2009.03.009

  5. Alvarez-Plata P, Schrooten M (2006) The Argentinean currency crisis: a Markov-switching model estimation. Dev Econ 44:79–91. https://doi.org/10.1111/j.1746-1049.2006.00004.x

  6. Ang A, Bekaert G (2002a) International asset allocation with regime shifts. Rev Financ Stud 15:1137–1187

  7. Ang A, Bekaert G (2002b) Regime switches in interest rates. J Bus Econ Stat 20:163–182. https://doi.org/10.1198/073500102317351930

  8. Ang A, Bekaert G (2002c) Short rate nonlinearities and regime switches. J Econ Dyn Control 26:1243–1274. https://doi.org/10.1016/S0165-1889(01)00042-2

  9. Ang A, Bekaert G (2004) How regimes affect asset allocation. Financ Anal J 60:86–99. https://doi.org/10.2469/faj.v60.n2.2612

  10. Ardia D (2008) Financial risk management with Bayesian estimation of GARCH models. Springer, Berlin

  11. Ardia D, Bluteau K, Boudt K, Trottier D (2016) Markov-switching GARCH models in R: The MSGARCH Package

  12. Ardia D, Kolly J, Trottier D-A (2017) The impact of parameter and model uncertainty on market risk predictions from GARCH-type models. J Forecast 36:808–823. https://doi.org/10.1002/for.2472

  13. Ardia D, Bluteau K, Boudt K, Catania L (2018) Forecasting risk with Markov-switching GARCH models: a large-scale performance study. Int J Forecast 34:733–747. https://doi.org/10.1016/j.ijforecast.2018.05.004

  14. Areal N, Cortez MC, Silva F (2013) The conditional performance of US mutual funds over different market regimes: Do different types of ethical screens matter? Financ Mark Portf Manag 27:397–429. https://doi.org/10.1007/s11408-013-0218-5

  15. Balcilar M, Abidin Ozdemir Z (2013) The causal nexus between oil prices and equity market in the US: a regime switching model. Energy Econ 39:271–282. https://doi.org/10.1016/j.eneco.2013.04.014

  16. Balcilar M, Demirer R, Hammoudeh S (2013) Investor herds and regime-switching: evidence from Gulf Arab stock markets. J Int Financ Mark Inst Money 23:295–321. https://doi.org/10.1016/j.intfin.2012.09.007

  17. Balcilar M, Gupta R, Miller SM (2015) Regime switching model of US crude oil and stock market prices: 1859 to 2013. Energy Econ 49:317–327. https://doi.org/10.1016/j.eneco.2015.01.026

  18. Basher SA, Haug AA, Sadorsky P (2016) The impact of oil shocks on exchange rates: a Markov-switching approach. Energy Econ 54:11–23. https://doi.org/10.1016/j.eneco.2015.12.004

  19. Basher SA, Haug AA, Sadorsky P (2018) The impact of oil-market shocks on stock returns in major oil-exporting countries. J Int Money Finance 86:264–280. https://doi.org/10.1016/j.jimonfin.2018.05.003

  20. Baum LE, Petrie T, Soules G, Weiss N (1970) A maximization technique occurring in the statistical analysis of probabilistic functions of Markov chains. Ann Appl Stat 41:164–171

  21. Boamah NA, Watts EJ, Loudon G (2016) Investigating temporal variation in the global and regional integration of African stock markets. J Multinatl Financ Manag 36:103–118. https://doi.org/10.1016/j.mulfin.2016.06.001

  22. Bollerslev T (1986) Generalized autoregressive conditional heteroskedasticity. J Econom 31:307–327

  23. Brooks C, Persand G (2001) The trading profitability of forecasts of the gilt–equity yield ratio. Int J Forecast 17:11–29

  24. Bundoo SK (2017) Stock market development and integration in SADC (Southern African Development Community). J Adv Res 7:64–72. https://doi.org/10.1016/j.rdf.2017.01.005

  25. Cabrera G, Coronado S, Rojas O, Venegas-Martínez F (2017) Synchronization and changes in volatilities in the Latin America’s stock exchange markets. Int J Pure Appl Math. https://doi.org/10.12732/ijpam.v114i1.10

  26. Camacho M, Perez-Quiros G (2014) Commodity prices and the business cycle in Latin America: Living and dying by commodities? Emerg Mark Finance Trade 50:110–137. https://doi.org/10.2753/ree1540-496x500207

  27. Chen C-M, Lin Y-L, Hsu C-L (2017) Does air pollution drive away tourists? A case study of the Sun Moon Lake National Scenic Area, Taiwan. Transp Res Part D Transp Environ 53:398–402. https://doi.org/10.1016/J.TRD.2017.04.028

  28. CME group I (2019) CMEG exchange volume report-monthly. In: Dly. Agric. Vol. open Interes. https://www.cmegroup.com/daily_bulletin/monthly_volume/Web_Volume_Report_CMEG.pdf. Accessed 22 Apr 2019

  29. Commodity Futures Trading Commission (2019) Commitments of Traders| US. Commodity Futures Trading Commission. In: Mark. Data Anal. https://www.cftc.gov/MarketReports/CommitmentsofTraders/index.htm. Accessed 22 Apr 2019

  30. De la Torre O, Galeana-Figueroa E, Álvarez-García J (2018) Using Markov-switching models in Italian, British, US and Mexican equity portfolios: a performance test. Electron J Appl Stat Anal 11:489–505. https://doi.org/10.1285/i20705948v11n2p489

  31. De la Torre-Torres O, Álvarez-García J, Santillán-Salgado J, López-Herrera F (2019a) Potential improvements to pension funds performance in Mexico Mejoras potenciales al desempeño de los fondos de pensiones en México. Rev Espac 40:26–41

  32. De la Torre-Torres OV, Aguilasocho-Montoya D, Álvarez-García J (2019b) Active portfolio management in the Andean countries’ stock markets with Markov-switching GARCH models. Rev Mex Econ y Finanz 14:601–616. https://doi.org/10.21919/remef.v14i0.425

  33. Dempster AP, Laird NM, Rubin DB (1977) Maximum likelihood from incomplete data via the EM algorithm. J R Stat Soc Ser B 39:1–38. https://doi.org/10.2307/2984875

  34. Doğan İ, Bilgili F (2014) The non-linear impact of high and growing government external debt on economic growth: a Markov Regime-switching approach. Econ Model 39:213–220. https://doi.org/10.1016/j.econmod.2014.02.032

  35. Dufrénot G, Keddad B (2014) Business cycles synchronization in East Asia: a Markov-switching approach. Econ Model 42:186–197. https://doi.org/10.1016/j.econmod.2014.07.001

  36. Elias RS, Wahab MIM, Fang L (2014) Stochastics and statistics a comparison of regime-switching temperature modeling approaches for applications in weather derivatives. Eur J Oper Res 232:549–560. https://doi.org/10.1016/j.ejor.2013.07.015

  37. Engel J, Wahl M, Zagst R (2018) Forecasting turbulence in the Asian and European stock market using regime-switching models. Quant Finance Econ 2:388–406. https://doi.org/10.3934/QFE.2018.2.388

  38. Engle R (1982) Autoregressive conditional heteroscedasticity with estimates of the variance of United Kingdom inflation. Econometrica 50:987–1007

  39. Haas M, Mittnik S, Paolella MS (2004) A new approach to Markov-switching GARCH models. J Financ Econom 2:493–530

  40. Hache E, Lantz F (2013) Speculative trading and oil price dynamic: a study of the WTI market. Energy Econ 36:334–340. https://doi.org/10.1016/j.eneco.2012.09.002

  41. Hamilton JD (1989) A new approach to the economic analysis of nonstationary time series and the business cycle. Econometrica 57:357–384

  42. Hamilton JD (1990) Analysis of time series subject to changes in regime. J Econom 45:39–70. https://doi.org/10.1016/0304-4076(90)90093-9

  43. Hamilton JD (1994) Time series analysis. Princeton University Press, Princeton

  44. Hamilton JD, Susmel R (1994) Autoregressive conditional heteroskedasticity and changes in regime. J Econom 64:307–333. https://doi.org/10.1016/0304-4076(94)90067-1

  45. Hastings WK (1970) Monte Carlo sampling methods using Markov chains and their applications. Biometrika 57:97–109. https://doi.org/10.1093/biomet/57.1.97

  46. Hauptmann J, Hoppenkamps A, Min A et al (2014) Forecasting market turbulence using regime-switching models. Financ Mark Portf Manag 28:139–164. https://doi.org/10.1007/s11408-014-0226-0

  47. Herrera R, Rodriguez A, Pino G (2017) Modeling and forecasting extreme commodity prices: a Markov-switching based extreme value model. Energy Econ 63:129–143. https://doi.org/10.1016/j.eneco.2017.01.012

  48. Isasi P, Quintana D, Saez Y, Mochon A (2007) Applied computational intelligence for finance and economics. Comput Intell 23:111–116. https://doi.org/10.1111/j.1467-8640.2007.00297.x

  49. Kanas A (2005) Regime linkages between the Mexican currency market and emerging equity markets. Econ Model 22:109–125. https://doi.org/10.1016/j.econmod.2004.05.003

  50. Kim C-J (1994) Dynamic linear models with Markov-switching. J Econom 60:1–22. https://doi.org/10.1016/0304-4076(94)90036-1

  51. Klaassen F (2002) Improving GARCH volatility forecasts with regime-switching GARCH. In: Advances in Markov-switching models. Physica-Verlag, Heidelberg, pp 223–254

  52. Klein AC (2013) Time-variations in herding behavior: evidence from a Markov switching SUR model. J Int Financ Mark Inst Money 26:291–304. https://doi.org/10.1016/j.intfin.2013.06.006

  53. Kristjanpoller WR, Michell KV (2018) A stock market risk forecasting model through integration of switching regime, ANFIS and GARCH techniques. Appl Soft Comput J 67:106–116. https://doi.org/10.1016/j.asoc.2018.02.055

  54. Kritzman M, Page S, Turkington D (2012) Regime shifts: implications for dynamic strategies. Financ Anal J 68:22–39

  55. Kutty G (2010) The relationship between exchange rates and stock prices: the case of Mexico. North Am J Financ Bank Res 4:1–12

  56. Malyshkina NV, Mannering FL, Tarko AP (2009) Markov switching negative binomial models: an application to vehicle accident frequencies. Accid Anal Prev 41:217–226. https://doi.org/10.1016/j.aap.2008.11.001

  57. Mejía-Reyes P (2000) Asymmetries and common cycles in Latin America: evidence from Markov-switching models. Econ Mex Nueva Época IX:189–225

  58. Metropolis N, Rosenbluth AW, Rosenbluth MN et al (1953) Equation of state calculations by fast computing machines. J Chem Phys 21:1087–1092. https://doi.org/10.1063/1.1699114

  59. Misas M, Ramírez MT (2007) Depressions in the Colombian economic growth during the twentieth century: a Markov switching regime model. Appl Econ Lett 14:803–808. https://doi.org/10.1080/13504850600689881

  60. Mochón A, Quintana D, Isasi P, Sáez Y (2008) Soft computing techniques applied to finance. Appl Intell 29:111–115. https://doi.org/10.1007/s10489-007-0051-5

  61. Monbet V, Ailliot P (2017) Sparse vector Markov switching autoregressive models. Application to multivariate time series of temperature. Comput Stat Data Anal 108:40–51. https://doi.org/10.1016/J.CSDA.2016.10.023

  62. Parikakis GS, Merika A (2009) Evaluating volatility dynamics and the forecasting ability of Markov switching models. J Forecast 28:736–744. https://doi.org/10.1002/for.1135

  63. Pelletier D (2006) Regime switching for dynamic correlations. J Econ 131:445–473

  64. Refinitiv (2018) Refinitiv Eikon. In: Thomson Refinitiv Eikon login. https://eikon.thomsonreuters.com/index.html. Accessed 3 Jun 2019

  65. Riedel C, Thuraisamy KS, Wagner N (2013) Credit cycle dependent spread determinants in emerging sovereign debt markets. Emerg Mark Rev 17:209–223. https://doi.org/10.1016/j.ememar.2013.03.002

  66. Rotta PN, Valls Pereira PL (2016) Analysis of contagion from the dynamic conditional correlation model with Markov regime switching. Appl Econ 48:2367–2382. https://doi.org/10.1080/00036846.2015.1119794

  67. Shen X, Holmes MJ (2013) Do Asia-Pacific stock prices follow a random walk? A regime-switching perspective. Appl Econ Lett 21:189–195. https://doi.org/10.1080/13504851.2013.848016

  68. Sosa M, Ortiz E, Cabello A (2018) Dynamic linkages between stock market and exchange rate in mila countries: a Markov regime switching approach (2003–2016). Análisis Económico 33:57–74. https://doi.org/10.24275/uam/azc/dcsh/ae/2018v33n83/sosa

  69. Sottile P (2013) On the political determinants of sovereign risk: evidence from a Markov-switching vector autoregressive model for Argentina. Emerg Mark Rev. https://doi.org/10.1016/j.ememar.2013.02.005

  70. Thomson Reuters (2018) Thomson Reuters Eikon. In: Thomson Refinitiv Eikon login. https://eikon.thomsonreuters.com/index.html. Accessed 10 Dec 2018

  71. Uddin GS, Rahman ML, Shahzad SJH, Rehman MU (2018) Supply and demand driven oil price changes and their non-linear impact on precious metal returns: a Markov regime switching approach. Energy Econ 73:108–121. https://doi.org/10.1016/j.eneco.2018.05.024

  72. Valera HGA, Lee J (2016) Do rice prices follow a random walk? Evidence from Markov switching unit root tests for Asian markets. Agric Econ 47:683–695. https://doi.org/10.1111/agec.12265

  73. Viterbi A (1967) Error bounds for convolutional codes and an asymptotically optimum decoding algorithm. IEEE Trans Inf Theory 13:260–269. https://doi.org/10.1109/TIT.1967.1054010

  74. Walid C, Duc Khuong D (2014) Exchange rate movements and stock market returns in a regime-switching environment: evidence for BRICS countries. Res Int Bus Finance. https://doi.org/10.1016/j.ribaf.2013.11.007

  75. Walid C, Chaker A, Masood O, Fry J (2011) Stock market volatility and exchange rates in emerging countries: a Markov-state switching approach. Emerg Mark Rev 12:272–292. https://doi.org/10.1016/j.ememar.2011.04.003

  76. Wu J-T (2015) Markov regimes switching with monetary fundamental-based exchange rate model. Asia Pacific Manag Rev 20:79–89. https://doi.org/10.1016/j.apmrv.2014.12.009

  77. Xiong Y, Tobias JL, Mannering FL (2014) The analysis of vehicle crash injury-severity data: a Markov switching approach with road-segment heterogeneity. Transp Res Part B Methodol 67:109–128. https://doi.org/10.1016/J.TRB.2014.04.007

  78. Zhao H (2010) Dynamic relationship between exchange rate and stock price: evidence from China. Res Int Bus Finance 24:103–112. https://doi.org/10.1016/j.ribaf.2009.09.001

  79. Zheng T, Zuo H (2013) Reexamining the time-varying volatility spillover effects: a Markov switching causality approach. North Am J Econ Finance 26:643–662. https://doi.org/10.1016/j.najef.2013.05.001

Download references

Author information

Correspondence to José Álvarez-García.

Ethics declarations

Conflict of interest

All authors declare that they have no conflict of interest to disclose.

Ethical approval

This article does not contain any studies with human participants or animals performed by any of the authors.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Communicated by M. Squillante.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

De la Torre-Torres, O.V., Aguilasocho-Montoya, D., Álvarez-García, J. et al. Using Markov-switching models with Markov chain Monte Carlo inference methods in agricultural commodities trading. Soft Comput (2020). https://doi.org/10.1007/s00500-019-04629-5

Download citation


  • Markov-switching GARCH
  • Markovian chain processes
  • Markov chain Monte Carlo
  • Commodities
  • Alpha creation
  • Financial crisis
  • Computational finance
  • Financial market crisis prediction
  • Commodities market trading